Search in sources :

Example 11 with SimpleAssociatedObject

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

the class PreDomainTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    Domain goodDomain = new Domain();
    goodDomain.setName("Good");
    Globals.getContext().getReferenceContext().importObject(goodDomain);
    Domain animalDomain = new Domain();
    animalDomain.setName("Animal");
    Globals.getContext().getReferenceContext().importObject(animalDomain);
    deity = new Deity();
    deity.setName("Test Deity");
    deity.put(ObjectKey.ALIGNMENT, CDOMDirectSingleRef.getRef(ng));
    deity.putToList(Deity.DOMAINLIST, CDOMDirectSingleRef.getRef(goodDomain), new SimpleAssociatedObject());
    deity.putToList(Deity.DOMAINLIST, CDOMDirectSingleRef.getRef(animalDomain), new SimpleAssociatedObject());
}
Also used : Deity(pcgen.core.Deity) Domain(pcgen.core.Domain) SimpleAssociatedObject(pcgen.cdom.base.SimpleAssociatedObject)

Example 12 with SimpleAssociatedObject

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

the class PreDeityDomainTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    Domain goodDomain = new Domain();
    goodDomain.setName("Good");
    Globals.getContext().getReferenceContext().importObject(goodDomain);
    Domain animalDomain = new Domain();
    animalDomain.setName("Animal");
    Globals.getContext().getReferenceContext().importObject(animalDomain);
    deity = new Deity();
    deity.setName("Test Deity");
    deity.put(ObjectKey.ALIGNMENT, CDOMDirectSingleRef.getRef(ng));
    deity.putToList(Deity.DOMAINLIST, CDOMDirectSingleRef.getRef(goodDomain), new SimpleAssociatedObject());
    deity.putToList(Deity.DOMAINLIST, CDOMDirectSingleRef.getRef(animalDomain), new SimpleAssociatedObject());
}
Also used : Deity(pcgen.core.Deity) Domain(pcgen.core.Domain) SimpleAssociatedObject(pcgen.cdom.base.SimpleAssociatedObject)

Example 13 with SimpleAssociatedObject

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

the class AbstractListContextTokenTestCase method addToList.

/*
	 * TODO Need to figure out who owns this responsibility
	 */
// @Test
// public void testUnparseGenericsFail() throws PersistenceLayerException
// {
// ListKey listKey = getListKey();
// primaryProf.addToListFor(listKey, new Object());
// try
// {
// String[] unparsed = getToken().unparse(primaryContext, primaryProf);
// fail();
// }
// catch (ClassCastException e)
// {
// // Yep!
// }
// }
protected void addToList(CDOMReference<TC> val) {
    SimpleAssociatedObject sao = new SimpleAssociatedObject();
    sao.setAssociation(AssociationKey.TOKEN, getToken().getTokenName());
    primaryProf.putToList(getListReference(), val, sao);
    doCustomAssociations(sao);
}
Also used : SimpleAssociatedObject(pcgen.cdom.base.SimpleAssociatedObject)

Example 14 with SimpleAssociatedObject

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

the class PreVisionTest method testVisionNotZeroTen.

/**
	 * @throws Exception
	 */
public void testVisionNotZeroTen() 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.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 15 with SimpleAssociatedObject

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

the class PreVisionTest method testVision2Pass.

/**
	 * @throws Exception
	 */
public void testVision2Pass() 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 PCTemplate template2 = new PCTemplate();
    template2.putToList(Vision.VISIONLIST, CDOMDirectSingleRef.getRef(new Vision(VisionType.getVisionType("Low-Light"), FormulaFactory.getFormulaFor(30))), new SimpleAssociatedObject());
    character.addTemplate(template2);
    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);
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) Vision(pcgen.core.Vision) 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