Search in sources :

Example 11 with Deity

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);
}
Also used : Deity(pcgen.core.Deity) PCAlignment(pcgen.core.PCAlignment)

Example 12 with Deity

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));
}
Also used : Deity(pcgen.core.Deity)

Example 13 with Deity

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;
}
Also used : Deity(pcgen.core.Deity)

Example 14 with Deity

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);
}
Also used : Deity(pcgen.core.Deity) Test(org.junit.Test) AbstractSaveRestoreTest(pcgen.io.testsupport.AbstractSaveRestoreTest)

Example 15 with Deity

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);
}
Also used : Deity(pcgen.core.Deity) StringManager(pcgen.base.format.StringManager)

Aggregations

Deity (pcgen.core.Deity)39 CDOMReference (pcgen.cdom.base.CDOMReference)8 Domain (pcgen.core.Domain)8 Test (org.junit.Test)5 WeaponProf (pcgen.core.WeaponProf)5 HashSet (java.util.HashSet)3 TreeSet (java.util.TreeSet)3 StringManager (pcgen.base.format.StringManager)3 PCAlignment (pcgen.core.PCAlignment)3 BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2 StringTokenizer (java.util.StringTokenizer)2 AssociatedPrereqObject (pcgen.cdom.base.AssociatedPrereqObject)2 SimpleAssociatedObject (pcgen.cdom.base.SimpleAssociatedObject)2 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 NumberManager (pcgen.base.format.NumberManager)1 Indirect (pcgen.base.util.Indirect)1 WeightedCollection (pcgen.base.util.WeightedCollection)1 WrappedMapSet (pcgen.base.util.WrappedMapSet)1