Search in sources :

Example 66 with Race

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

the class SizeFacetTest method testGetFromTemplateLowerOverridesDefault.

@Test
public void testGetFromTemplateLowerOverridesDefault() {
    rfacet.set(id, new Race());
    PCTemplate t1 = new PCTemplate();
    t1.put(FormulaKey.SIZE, FormulaFactory.getFormulaFor(1));
    tfacet.add(id, t1, this);
    facet.update(id);
    assertEquals(1, facet.sizeInt(id));
    tfacet.remove(id, t1, this);
    facet.update(id);
    assertEquals(2, facet.sizeInt(id));
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 67 with Race

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

the class SizeFacetTest method testGetWithNegativeBonus.

@Test
public void testGetWithNegativeBonus() {
    assertEquals(2, facet.sizeInt(id));
    assertEquals(2, facet.racialSizeInt(id));
    Race r = new Race();
    r.put(FormulaKey.SIZE, FormulaFactory.getFormulaFor(3));
    rfacet.set(id, r);
    facet.update(id);
    assertEquals(3, facet.sizeInt(id));
    assertEquals(3, facet.racialSizeInt(id));
    bonusInfo.put(altid, -2.0);
    // No pollution
    facet.update(id);
    assertEquals(3, facet.sizeInt(id));
    assertEquals(3, facet.racialSizeInt(id));
    bonusInfo.put(id, -2.0);
    facet.update(id);
    assertEquals(1, facet.sizeInt(id));
    assertEquals(3, facet.racialSizeInt(id));
    PCTemplate t1 = new PCTemplate();
    t1.setName("PCT");
    t1.put(FormulaKey.SIZE, FormulaFactory.getFormulaFor(1));
    tfacet.add(id, t1, this);
    facet.update(id);
    assertEquals(0, facet.sizeInt(id));
    assertEquals(1, facet.racialSizeInt(id));
    PCTemplate t2 = new PCTemplate();
    t2.setName("Other");
    t2.put(FormulaKey.SIZE, FormulaFactory.getFormulaFor(4));
    tfacet.add(id, t2, this);
    facet.update(id);
    assertEquals(2, facet.sizeInt(id));
    assertEquals(4, facet.racialSizeInt(id));
    tfacet.remove(id, t2, this);
    facet.update(id);
    assertEquals(0, facet.sizeInt(id));
    assertEquals(1, facet.racialSizeInt(id));
    bonusInfo.clear();
    facet.update(id);
    assertEquals(1, facet.sizeInt(id));
    assertEquals(1, facet.racialSizeInt(id));
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Example 68 with Race

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

the class SizeFacetTest method testAvoidPollution.

@Test
public void testAvoidPollution() {
    Race r = new Race();
    r.put(FormulaKey.SIZE, FormulaFactory.getFormulaFor(3));
    rfacet.set(id, r);
    facet.update(id);
    assertEquals(2, facet.sizeInt(altid));
    assertEquals(2, facet.racialSizeInt(altid));
}
Also used : Race(pcgen.core.Race) Test(org.junit.Test)

Example 69 with Race

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

the class StatIntegrationTest method testWithNothingInRace.

@Test
public void testWithNothingInRace() {
    Race r = new Race();
    rfacet.set(id, r);
    testNonAbilityUnset();
    testLockUnset();
}
Also used : Race(pcgen.core.Race) Test(org.junit.Test)

Example 70 with Race

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

the class StatIntegrationTest method testNonStatToStatOverrideNonAbilityLockComplex.

@Test
public void testNonStatToStatOverrideNonAbilityLockComplex() {
    testNonAbilityUnset();
    Race r = new Race();
    causeLockNonAbility(r, stat1);
    rfacet.set(id, r);
    PCTemplate t1 = new PCTemplate();
    causeUnLockNonAbility(t1, stat1);
    tfacet.add(id, t1, tsource);
    testNonAbilityUnset();
    testLockUnsetConditional();
}
Also used : Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) Test(org.junit.Test)

Aggregations

Race (pcgen.core.Race)167 Test (org.junit.Test)78 PCTemplate (pcgen.core.PCTemplate)66 PlayerCharacter (pcgen.core.PlayerCharacter)28 CDOMObject (pcgen.cdom.base.CDOMObject)16 LoadContext (pcgen.rules.context.LoadContext)16 PCClass (pcgen.core.PCClass)15 ArrayList (java.util.ArrayList)10 SizeAdjustment (pcgen.core.SizeAdjustment)10 ParseResult (pcgen.rules.persistence.token.ParseResult)10 AbstractTokenModelTest (tokenmodel.testsupport.AbstractTokenModelTest)10 PCStat (pcgen.core.PCStat)9 FixedSizeFormula (pcgen.cdom.formula.FixedSizeFormula)8 Equipment (pcgen.core.Equipment)8 BonusObj (pcgen.core.bonus.BonusObj)7 Formula (pcgen.base.formula.Formula)6 WieldCategory (pcgen.core.character.WieldCategory)6 GameMode (pcgen.core.GameMode)5 Skill (pcgen.core.Skill)5 CompanionList (pcgen.cdom.list.CompanionList)4