use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class RegionFacetTest method testRegionSubRegionSet.
@Test
public void testRegionSubRegionSet() {
PCTemplate pct = new PCTemplate();
pct.put(ObjectKey.REGION, Region.getConstant(TEST_REGION_NAME));
pct.put(ObjectKey.SUBREGION, SubRegion.getConstant(TEST_SUB_REGION_NAME));
tfacet.add(id, pct, this);
assertEquals(TEST_REGION_NAME, facet.getRegion(id));
assertEquals(Constants.NONE, facet.getCharacterRegion(id));
assertEquals(TEST_SUB_REGION_NAME, facet.getSubRegion(id));
assertEquals(Constants.NONE, facet.getCharacterSubRegion(id));
assertEquals(TEST_FULL_REGION_NAME, facet.getFullRegion(id));
tfacet.remove(id, pct, this);
assertEquals(Constants.NONE, facet.getRegion(id));
assertEquals(Constants.NONE, facet.getCharacterRegion(id));
assertEquals(Constants.NONE, facet.getSubRegion(id));
assertEquals(Constants.NONE, facet.getCharacterSubRegion(id));
assertEquals(Constants.NONE, facet.getFullRegion(id));
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class PreVisionTest method testVisionNotPresentZero.
/**
* @throws Exception
*/
public void testVisionNotPresentZero() throws Exception {
final PlayerCharacter character = getCharacter();
final PCTemplate template = new PCTemplate();
final Prerequisite prereq = new Prerequisite();
prereq.setKind("vision");
prereq.setKey("darkvision");
prereq.setOperator(PrerequisiteOperator.LT);
prereq.setOperand("ANY");
boolean passes = PrereqHandler.passes(prereq, character, null);
assertTrue(passes);
template.putToList(Vision.VISIONLIST, CDOMDirectSingleRef.getRef(new Vision(VisionType.getVisionType("Darkvision"), FormulaFactory.ZERO)), new SimpleAssociatedObject());
character.addTemplate(template);
passes = PrereqHandler.passes(prereq, character, null);
assertFalse(passes);
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class PreVisionTest method testVisionNotZeroZero.
/**
* @throws Exception
*/
public void testVisionNotZeroZero() throws Exception {
final PlayerCharacter character = getCharacter();
final PCTemplate template = new PCTemplate();
final Prerequisite prereq = new Prerequisite();
prereq.setKind("vision");
prereq.setKey("darkvision");
prereq.setOperator(PrerequisiteOperator.LT);
prereq.setOperand("0");
boolean passes = PrereqHandler.passes(prereq, character, null);
assertFalse(passes);
template.putToList(Vision.VISIONLIST, CDOMDirectSingleRef.getRef(new Vision(VisionType.getVisionType("Darkvision"), FormulaFactory.ZERO)), new SimpleAssociatedObject());
character.addTemplate(template);
passes = PrereqHandler.passes(prereq, character, null);
assertFalse(passes);
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class PreVisionTest method testVisionZeroTen.
/**
* @throws Exception
*/
public void testVisionZeroTen() throws Exception {
final PlayerCharacter character = getCharacter();
final PCTemplate template = new PCTemplate();
final Prerequisite prereq = new Prerequisite();
prereq.setKind("vision");
prereq.setKey("darkvision");
prereq.setOperator(PrerequisiteOperator.GTEQ);
prereq.setOperand("0");
boolean passes = PrereqHandler.passes(prereq, character, null);
assertTrue(passes);
template.putToList(Vision.VISIONLIST, CDOMDirectSingleRef.getRef(new Vision(VisionType.getVisionType("Darkvision"), FormulaFactory.getFormulaFor(10))), new SimpleAssociatedObject());
character.addTemplate(template);
passes = PrereqHandler.passes(prereq, character, null);
assertTrue(passes);
}
use of pcgen.core.PCTemplate in project pcgen by PCGen.
the class PreVisionTest method testVisionPass.
/**
* @throws Exception
*/
public void testVisionPass() throws Exception {
final PlayerCharacter character = getCharacter();
final PCTemplate template = new PCTemplate();
template.putToList(Vision.VISIONLIST, CDOMDirectSingleRef.getRef(new Vision(VisionType.getVisionType("Darkvision"), FormulaFactory.getFormulaFor(60))), new SimpleAssociatedObject());
character.addTemplate(template);
final Prerequisite prereq = new Prerequisite();
prereq.setKind("vision");
prereq.setKey("darkvision");
prereq.setOperator(PrerequisiteOperator.GTEQ);
prereq.setOperand("30");
final boolean passes = PrereqHandler.passes(prereq, character, null);
assertTrue(passes);
}
Aggregations