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());
}
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());
}
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);
}
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);
}
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);
}
Aggregations