Search in sources :

Example 1 with ArmorProf

use of pcgen.core.ArmorProf in project pcgen by PCGen.

the class AbstractGlobalTargetedSaveRestoreTest method testAutoArmorProf.

@Test
public void testAutoArmorProf() {
    T target = create(getObjectClass(), "Target");
    ArmorProf granted = create(ArmorProf.class, "Granted");
    create(ArmorProf.class, "Ignored");
    new plugin.lsttokens.auto.ArmorProfToken().parseToken(context, target, "Granted");
    Object o = prepare(target);
    finishLoad();
    Equipment e = new Equipment();
    e.addToListFor(ListKey.TYPE, Type.ARMOR);
    e.put(ObjectKey.ARMOR_PROF, CDOMDirectSingleRef.getRef(granted));
    assertFalse(pc.isProficientWith(e));
    applyObject(target);
    assertTrue(pc.isProficientWith(e));
    runRoundRobin(getPreEqualityCleanup());
    assertTrue(pc.isProficientWith(e));
    assertTrue(reloadedPC.isProficientWith(e));
    remove(o);
    reloadedPC.setDirty(true);
    assertFalse(reloadedPC.isProficientWith(e));
}
Also used : Equipment(pcgen.core.Equipment) CDOMObject(pcgen.cdom.base.CDOMObject) ArmorProf(pcgen.core.ArmorProf) Test(org.junit.Test)

Example 2 with ArmorProf

use of pcgen.core.ArmorProf in project pcgen by PCGen.

the class AbstractGlobalTargetedSaveRestoreTest method testAutoArmorProfList.

@Test
public void testAutoArmorProfList() {
    T target = create(getObjectClass(), "Target");
    ArmorProf granted = create(ArmorProf.class, "Granted");
    create(ArmorProf.class, "Ignored");
    new plugin.lsttokens.auto.ArmorProfToken().parseToken(context, target, "%LIST");
    new plugin.lsttokens.choose.ArmorProficiencyToken().parseToken(context, target, "Granted|Ignored");
    additionalChooseSet(target);
    Object o = prepare(target);
    finishLoad();
    Equipment e = new Equipment();
    e.addToListFor(ListKey.TYPE, Type.ARMOR);
    e.put(ObjectKey.ARMOR_PROF, CDOMDirectSingleRef.getRef(granted));
    assertFalse(pc.isProficientWith(e));
    applyObject(target);
    assertTrue(pc.isProficientWith(e));
    runRoundRobin(getPreEqualityCleanup());
    assertTrue(pc.isProficientWith(e));
    assertTrue(reloadedPC.isProficientWith(e));
    remove(o);
    reloadedPC.setDirty(true);
    if (isSymmetric()) {
        assertFalse(reloadedPC.isProficientWith(e));
    }
}
Also used : Equipment(pcgen.core.Equipment) CDOMObject(pcgen.cdom.base.CDOMObject) ArmorProf(pcgen.core.ArmorProf) Test(org.junit.Test)

Example 3 with ArmorProf

use of pcgen.core.ArmorProf in project pcgen by PCGen.

the class EquipmentQualifierTokenTest method initializeObjects.

private void initializeObjects() {
    wp1 = new WeaponProf();
    wp1.setName("Eq1");
    primaryContext.getReferenceContext().importObject(wp1);
    eq1 = new Equipment();
    eq1.setName("Eq1");
    primaryContext.getReferenceContext().importObject(eq1);
    primaryContext.unconditionallyProcess(eq1, "TYPE", "WEAPON");
    primaryContext.unconditionallyProcess(eq1, "PROFICIENCY", "WEAPON|Eq1");
    sp1 = new ShieldProf();
    sp1.setName("Eq2");
    primaryContext.getReferenceContext().importObject(sp1);
    eq2 = new Equipment();
    eq2.setName("Eq2");
    primaryContext.getReferenceContext().importObject(eq2);
    primaryContext.unconditionallyProcess(eq2, "TYPE", "SHIELD");
    primaryContext.unconditionallyProcess(eq2, "PROFICIENCY", "SHIELD|Eq2");
    ap1 = new ArmorProf();
    ap1.setName("Eq3");
    primaryContext.getReferenceContext().importObject(ap1);
    eq3 = new Equipment();
    eq3.setName("Eq3");
    primaryContext.getReferenceContext().importObject(eq3);
    primaryContext.unconditionallyProcess(eq3, "TYPE", "ARMOR.Masterful");
    primaryContext.unconditionallyProcess(eq3, "PROFICIENCY", "ARMOR|Eq3");
    sp2 = new ShieldProf();
    sp2.setName("Wp2");
    primaryContext.getReferenceContext().importObject(sp2);
    eq4 = new Equipment();
    eq4.setName("Eq4");
    primaryContext.getReferenceContext().importObject(eq4);
    primaryContext.unconditionallyProcess(eq4, "TYPE", "SHIELD.Masterful");
    primaryContext.unconditionallyProcess(eq4, "PROFICIENCY", "SHIELD|Wp2");
}
Also used : ShieldProf(pcgen.core.ShieldProf) Equipment(pcgen.core.Equipment) WeaponProf(pcgen.core.WeaponProf) ArmorProf(pcgen.core.ArmorProf)

Example 4 with ArmorProf

use of pcgen.core.ArmorProf in project pcgen by PCGen.

the class EquipmentQualifierTokenTest method initializeObjects.

private void initializeObjects() {
    wp1 = new WeaponProf();
    wp1.setName("Eq1");
    primaryContext.getReferenceContext().importObject(wp1);
    eq1 = new Equipment();
    eq1.setName("Eq1");
    primaryContext.getReferenceContext().importObject(eq1);
    primaryContext.unconditionallyProcess(eq1, "TYPE", "WEAPON");
    primaryContext.unconditionallyProcess(eq1, "PROFICIENCY", "WEAPON|Eq1");
    sp1 = new ShieldProf();
    sp1.setName("Eq2");
    primaryContext.getReferenceContext().importObject(sp1);
    eq2 = new Equipment();
    eq2.setName("Eq2");
    primaryContext.getReferenceContext().importObject(eq2);
    primaryContext.unconditionallyProcess(eq2, "TYPE", "SHIELD.Masterful");
    primaryContext.unconditionallyProcess(eq2, "PROFICIENCY", "SHIELD|Eq2");
    ap1 = new ArmorProf();
    ap1.setName("Eq3");
    primaryContext.getReferenceContext().importObject(ap1);
    eq3 = new Equipment();
    eq3.setName("Eq3");
    primaryContext.getReferenceContext().importObject(eq3);
    primaryContext.unconditionallyProcess(eq3, "TYPE", "ARMOR");
    primaryContext.unconditionallyProcess(eq3, "PROFICIENCY", "ARMOR|Eq3");
    ap2 = new ArmorProf();
    ap2.setName("Ap2");
    primaryContext.getReferenceContext().importObject(ap2);
    eq4 = new Equipment();
    eq4.setName("Eq4");
    primaryContext.getReferenceContext().importObject(eq4);
    primaryContext.unconditionallyProcess(eq4, "TYPE", "ARMOR.Masterful");
    primaryContext.unconditionallyProcess(eq4, "PROFICIENCY", "ARMOR|Ap2");
}
Also used : ShieldProf(pcgen.core.ShieldProf) Equipment(pcgen.core.Equipment) WeaponProf(pcgen.core.WeaponProf) ArmorProf(pcgen.core.ArmorProf)

Example 5 with ArmorProf

use of pcgen.core.ArmorProf in project pcgen by PCGen.

the class ArmorProfTokenTest method loadAllReference.

@Override
protected void loadAllReference() {
    List<CDOMReference<ArmorProf>> armorProfs = new ArrayList<>();
    List<CDOMReference<Equipment>> equipTypes = new ArrayList<>();
    armorProfs.add(primaryContext.getReferenceContext().getCDOMAllReference(ArmorProf.class));
    ArmorProfProvider pp = new ArmorProfProvider(armorProfs, equipTypes);
    primaryProf.addToListFor(ListKey.AUTO_ARMORPROF, pp);
}
Also used : ArmorProfProvider(pcgen.cdom.helper.ArmorProfProvider) ArrayList(java.util.ArrayList) ArmorProf(pcgen.core.ArmorProf) CDOMReference(pcgen.cdom.base.CDOMReference)

Aggregations

ArmorProf (pcgen.core.ArmorProf)10 Equipment (pcgen.core.Equipment)8 ShieldProf (pcgen.core.ShieldProf)4 WeaponProf (pcgen.core.WeaponProf)4 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 CDOMObject (pcgen.cdom.base.CDOMObject)2 CDOMReference (pcgen.cdom.base.CDOMReference)2 ArmorProfProvider (pcgen.cdom.helper.ArmorProfProvider)2 StringTokenizer (java.util.StringTokenizer)1 ConditionalSelectionActor (pcgen.cdom.content.ConditionalSelectionActor)1 CDOMSingleRef (pcgen.cdom.reference.CDOMSingleRef)1 Prerequisite (pcgen.core.prereq.Prerequisite)1 PrerequisiteException (pcgen.core.prereq.PrerequisiteException)1 ComplexParseResult (pcgen.rules.persistence.token.ComplexParseResult)1 ParseResult (pcgen.rules.persistence.token.ParseResult)1