Search in sources :

Example 36 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class LegsFacetTest method testGetFromTemplate.

@Test
public void testGetFromTemplate() {
    rfacet.set(id, new Race());
    PCTemplate t = new PCTemplate();
    t.put(IntegerKey.LEGS, 5);
    tfacet.add(id, t, this);
    assertEquals(5, facet.getLegs(id));
    tfacet.remove(id, t, this);
    assertEquals(2, facet.getLegs(id));
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 37 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class MovementFacetTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    CDOMObject cdo1 = new PCTemplate();
    cdo1.setName("Templ");
    CDOMObject cdo2 = new Race();
    cdo2.setName("Race");
    PCStat pcs1 = new PCStat();
    pcs1.setName("Stat1");
    PCStat pcs2 = new PCStat();
    pcs2.setName("Stat2");
    Movement st1 = new Movement(1);
    Movement st2 = new Movement(1);
    cdo1.addToListFor(ListKey.MOVEMENT, st1);
    cdo2.addToListFor(ListKey.MOVEMENT, st2);
    source = new CDOMObject[] { cdo1, cdo2 };
    target = new Movement[] { st1, st2 };
}
Also used : Movement(pcgen.core.Movement) CDOMObject(pcgen.cdom.base.CDOMObject) Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) PCStat(pcgen.core.PCStat)

Example 38 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class NonProficiencyPenaltyFacetTest method testWithNothingInTemplates.

@Test
public void testWithNothingInTemplates() {
    tfacet.add(id, new PCTemplate(), this);
    assertEquals(SettingsHandler.getGame().getNonProfPenalty(), facet.getPenalty(id));
}
Also used : PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 39 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class NonProficiencyPenaltyFacetTest method testMultipleGenderSetSecondDominatesGender.

@Test
public void testMultipleGenderSetSecondDominatesGender() {
    PCTemplate pct = new PCTemplate();
    pct.setName("PCT");
    pct.put(IntegerKey.NONPP, -2);
    tfacet.add(id, pct, this);
    assertEquals(-2, facet.getPenalty(id));
    PCTemplate pct2 = new PCTemplate();
    pct2.setName("Other");
    pct2.put(IntegerKey.NONPP, -3);
    tfacet.add(id, pct2, this);
    assertEquals(-3, facet.getPenalty(id));
    tfacet.remove(id, pct, this);
    assertEquals(-3, facet.getPenalty(id));
    tfacet.add(id, pct, this);
    assertEquals(-2, facet.getPenalty(id));
    tfacet.remove(id, pct, this);
    assertEquals(-3, facet.getPenalty(id));
    tfacet.remove(id, pct2, this);
    assertEquals(SettingsHandler.getGame().getNonProfPenalty(), facet.getPenalty(id));
}
Also used : PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 40 with PCTemplate

use of pcgen.core.PCTemplate in project pcgen by PCGen.

the class HandsFacetTest method testGetFromTemplateSecondOverrides.

@Test
public void testGetFromTemplateSecondOverrides() {
    Race r = new Race();
    r.put(IntegerKey.CREATURE_HANDS, 5);
    rfacet.set(id, r);
    assertEquals(5, facet.getHands(id));
    PCTemplate t = new PCTemplate();
    t.setName("PCT");
    t.put(IntegerKey.CREATURE_HANDS, 3);
    tfacet.add(id, t, this);
    assertEquals(3, facet.getHands(id));
    PCTemplate t5 = new PCTemplate();
    t5.setName("Other");
    t5.put(IntegerKey.CREATURE_HANDS, 4);
    tfacet.add(id, t5, this);
    assertEquals(4, facet.getHands(id));
    tfacet.remove(id, t, this);
    assertEquals(4, facet.getHands(id));
    tfacet.add(id, t, this);
    assertEquals(3, facet.getHands(id));
    tfacet.remove(id, t, this);
    assertEquals(4, facet.getHands(id));
    tfacet.remove(id, t5, this);
    assertEquals(5, facet.getHands(id));
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Aggregations

PCTemplate (pcgen.core.PCTemplate)215 Test (org.junit.Test)105 Race (pcgen.core.Race)66 PlayerCharacter (pcgen.core.PlayerCharacter)38 CDOMObject (pcgen.cdom.base.CDOMObject)31 ArrayList (java.util.ArrayList)19 CharID (pcgen.cdom.enumeration.CharID)18 ParseResult (pcgen.rules.persistence.token.ParseResult)14 SimpleAssociatedObject (pcgen.cdom.base.SimpleAssociatedObject)13 Vision (pcgen.core.Vision)12 LoadContext (pcgen.rules.context.LoadContext)12 PCClass (pcgen.core.PCClass)11 StringTokenizer (java.util.StringTokenizer)10 VariableKey (pcgen.cdom.enumeration.VariableKey)8 DataFacetChangeEvent (pcgen.cdom.facet.event.DataFacetChangeEvent)8 Ability (pcgen.core.Ability)8 Formula (pcgen.base.formula.Formula)6 Equipment (pcgen.core.Equipment)6 PCStat (pcgen.core.PCStat)6 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)6