use of pcgen.core.Deity in project pcgen by PCGen.
the class PreDeityAlignTester method passes.
/**
* @see pcgen.core.prereq.PrerequisiteTest#passes(pcgen.core.PlayerCharacter)
*/
@Override
public int passes(final Prerequisite prereq, final CharacterDisplay display, CDOMObject source) {
//
// If game mode doesn't support alignment, then pass the prereq
//
int runningTotal = 0;
if (Globals.getGameModeAlignmentText().isEmpty()) {
runningTotal = 1;
} else {
//$NON-NLS-1$
CDOMSingleRef<PCAlignment> deityAlign = null;
Deity deity = display.getDeity();
if (deity != null) {
deityAlign = deity.get(ObjectKey.ALIGNMENT);
}
if (deityAlign != null) {
String desiredAlignIdentifier = prereq.getOperand();
PCAlignment desiredAlign = getPCAlignment(desiredAlignIdentifier);
if (desiredAlign.equals(deityAlign.get())) {
runningTotal = 1;
}
}
}
return countedTotal(prereq, runningTotal);
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class PreAlignTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
deity = new Deity();
deity.setName("TestDeity");
deity.put(ObjectKey.ALIGNMENT, CDOMDirectSingleRef.getRef(ng));
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class DeityFacetTest method getItem.
@Override
protected Deity getItem() {
Deity d = new Deity();
d.setName("Deity" + n++);
return d;
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class BasicSaveRestoreTest method testDeity.
@Test
public void testDeity() {
Deity deity = create(Deity.class, "MyDeity");
finishLoad();
pc.setDeity(deity);
runRoundRobin(null);
}
use of pcgen.core.Deity in project pcgen by PCGen.
the class FactSetKeyActorTest method testListKeyActor.
public void testListKeyActor() {
Deity d = new Deity();
d.setName("Bob");
String expectedResult1 = "Magical";
String expectedResult2 = "Long";
df.set(id, d);
d.addToListFor(ListKey.BOOK_TYPE, expectedResult1);
d.addToListFor(ListKey.BOOK_TYPE, expectedResult2);
StringManager mgr = new StringManager();
FactSetKey<String> fsk = FactSetKey.getConstant("booktype", mgr);
d.addToSetFor(fsk, new BasicIndirect<>(mgr, expectedResult1));
d.addToSetFor(fsk, new BasicIndirect<>(mgr, expectedResult2));
FactSetKeyActor<?> lka = new FactSetKeyActor<>(fsk);
CDOMObjectWrapper.load(dsid, d.getClass(), "booktype", lka);
processThroughFreeMarker("${deity.booktype[0]}", expectedResult1);
processThroughFreeMarker("${deity.booktype[1]}", expectedResult2);
}
Aggregations