Search in sources :

Example 16 with SimpleAssociatedObject

use of pcgen.cdom.base.SimpleAssociatedObject in project pcgen by PCGen.

the class PreVisionTest method testVisionNotPresentTen.

/**
	 * @throws Exception
	 */
public void testVisionNotPresentTen() 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.getFormulaFor(10))), new SimpleAssociatedObject());
    character.addTemplate(template);
    passes = PrereqHandler.passes(prereq, character, null);
    assertFalse(passes);
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) Vision(pcgen.core.Vision) PCTemplate(pcgen.core.PCTemplate) SimpleAssociatedObject(pcgen.cdom.base.SimpleAssociatedObject)

Example 17 with SimpleAssociatedObject

use of pcgen.cdom.base.SimpleAssociatedObject in project pcgen by PCGen.

the class PreVisionTest method testVisionZeroZero.

/**
	 * @throws Exception
	 */
public void testVisionZeroZero() 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.ZERO)), new SimpleAssociatedObject());
    character.addTemplate(template);
    passes = PrereqHandler.passes(prereq, character, null);
    assertTrue(passes);
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) Vision(pcgen.core.Vision) PCTemplate(pcgen.core.PCTemplate) SimpleAssociatedObject(pcgen.cdom.base.SimpleAssociatedObject)

Example 18 with SimpleAssociatedObject

use of pcgen.cdom.base.SimpleAssociatedObject in project pcgen by PCGen.

the class PreVisionTest method testVisionFail.

/**
	 * @throws Exception
	 */
public void testVisionFail() throws Exception {
    final PlayerCharacter character = getCharacter();
    final PCTemplate template = new PCTemplate();
    template.putToList(Vision.VISIONLIST, CDOMDirectSingleRef.getRef(new Vision(VisionType.getVisionType("Normal"), 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);
    assertFalse(passes);
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) Vision(pcgen.core.Vision) PCTemplate(pcgen.core.PCTemplate) SimpleAssociatedObject(pcgen.cdom.base.SimpleAssociatedObject)

Example 19 with SimpleAssociatedObject

use of pcgen.cdom.base.SimpleAssociatedObject in project pcgen by PCGen.

the class StartingLanguageFacetTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    CDOMObject cdo1 = new PCTemplate();
    cdo1.setName("Template1");
    CDOMObject cdo2 = new Race();
    cdo2.setName("Race1");
    Language l1 = new Language();
    l1.setName("Language1");
    Language l2 = new Language();
    l2.setName("Language2");
    CDOMDirectSingleRef<Language> ref1 = new CDOMDirectSingleRef<>(l1);
    SimpleAssociatedObject apo1 = new SimpleAssociatedObject();
    cdo1.putToList(Language.STARTING_LIST, ref1, apo1);
    CDOMDirectSingleRef<Language> ref2 = new CDOMDirectSingleRef<>(l2);
    SimpleAssociatedObject apo2 = new SimpleAssociatedObject();
    cdo2.putToList(Language.STARTING_LIST, ref2, apo2);
    source = new CDOMObject[] { cdo1, cdo2 };
    target = new Language[] { l1, l2 };
}
Also used : Language(pcgen.core.Language) CDOMDirectSingleRef(pcgen.cdom.reference.CDOMDirectSingleRef) CDOMObject(pcgen.cdom.base.CDOMObject) Race(pcgen.core.Race) PCTemplate(pcgen.core.PCTemplate) SimpleAssociatedObject(pcgen.cdom.base.SimpleAssociatedObject)

Aggregations

SimpleAssociatedObject (pcgen.cdom.base.SimpleAssociatedObject)19 PCTemplate (pcgen.core.PCTemplate)13 Vision (pcgen.core.Vision)12 PlayerCharacter (pcgen.core.PlayerCharacter)11 CDOMObject (pcgen.cdom.base.CDOMObject)2 CDOMDirectSingleRef (pcgen.cdom.reference.CDOMDirectSingleRef)2 Deity (pcgen.core.Deity)2 Domain (pcgen.core.Domain)2 Race (pcgen.core.Race)2 Test (org.junit.Test)1 AssociatedPrereqObject (pcgen.cdom.base.AssociatedPrereqObject)1 Language (pcgen.core.Language)1 QualifiedObject (pcgen.core.QualifiedObject)1