Search in sources :

Example 1 with ShieldProf

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

the class AbstractGlobalTargetedSaveRestoreTest method testAutoShieldProfList.

@Test
public void testAutoShieldProfList() {
    ShieldProf granted = create(ShieldProf.class, "Granted");
    create(ShieldProf.class, "Ignored");
    T target = create(getObjectClass(), "Target");
    new plugin.lsttokens.auto.ShieldProfToken().parseToken(context, target, "%LIST");
    new plugin.lsttokens.choose.ShieldProficiencyToken().parseToken(context, target, "Granted|Ignored");
    additionalChooseSet(target);
    Object o = prepare(target);
    finishLoad();
    Equipment e = new Equipment();
    e.addToListFor(ListKey.TYPE, Type.SHIELD);
    e.put(ObjectKey.SHIELD_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 : ShieldProf(pcgen.core.ShieldProf) Equipment(pcgen.core.Equipment) CDOMObject(pcgen.cdom.base.CDOMObject) Test(org.junit.Test)

Example 2 with ShieldProf

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

the class AbstractGlobalTargetedSaveRestoreTest method testAutoShieldProf.

@Test
public void testAutoShieldProf() {
    ShieldProf granted = create(ShieldProf.class, "Granted");
    create(ShieldProf.class, "Ignored");
    T target = create(getObjectClass(), "Target");
    new plugin.lsttokens.auto.ShieldProfToken().parseToken(context, target, "Granted");
    Object o = prepare(target);
    finishLoad();
    Equipment e = new Equipment();
    e.addToListFor(ListKey.TYPE, Type.SHIELD);
    e.put(ObjectKey.SHIELD_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 : ShieldProf(pcgen.core.ShieldProf) Equipment(pcgen.core.Equipment) CDOMObject(pcgen.cdom.base.CDOMObject) Test(org.junit.Test)

Example 3 with ShieldProf

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

the class PreShieldProfTest method setUp.

/**
	 * @see pcgen.AbstractCharacterTestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    Equipment heavySteelShield = new Equipment();
    heavySteelShield.setName("Heavy Steel Shield");
    heavySteelShield.addToListFor(ListKey.TYPE, Type.getConstant("Shield"));
    heavySteelShield.addToListFor(ListKey.TYPE, Type.getConstant("Heavy"));
    Globals.getContext().getReferenceContext().importObject(heavySteelShield);
    Equipment heavyWoodenShield = new Equipment();
    heavyWoodenShield.setName("Heavy Wooden Shield");
    heavyWoodenShield.addToListFor(ListKey.TYPE, Type.getConstant("Shield"));
    heavyWoodenShield.addToListFor(ListKey.TYPE, Type.getConstant("Heavy"));
    Globals.getContext().getReferenceContext().importObject(heavyWoodenShield);
    Equipment lightWoodenShield = new Equipment();
    lightWoodenShield.setName("Light Steel Shield");
    lightWoodenShield.addToListFor(ListKey.TYPE, Type.getConstant("Shield"));
    lightWoodenShield.addToListFor(ListKey.TYPE, Type.getConstant("Light"));
    Globals.getContext().getReferenceContext().importObject(lightWoodenShield);
    Equipment fullPlateEq = new Equipment();
    fullPlateEq.setName("Full Plate");
    fullPlateEq.addToListFor(ListKey.TYPE, Type.getConstant("Shield"));
    fullPlateEq.addToListFor(ListKey.TYPE, Type.getConstant("Heavy"));
    Globals.getContext().getReferenceContext().importObject(fullPlateEq);
    ShieldProf fullPlate = new ShieldProf();
    fullPlate.setName("Full Plate");
    fullPlate.addToListFor(ListKey.TYPE, Type.getConstant("Heavy"));
    Globals.getContext().getReferenceContext().importObject(fullPlate);
    ShieldProf lightWood = new ShieldProf();
    lightWood.setName("Light Wooden Shield");
    lightWood.addToListFor(ListKey.TYPE, Type.getConstant("Light"));
    Globals.getContext().getReferenceContext().importObject(lightWood);
    ShieldProf heavyWood = new ShieldProf();
    heavyWood.setName("Heavy Wooden Shield");
    heavyWood.addToListFor(ListKey.TYPE, Type.getConstant("Heavy"));
    Globals.getContext().getReferenceContext().importObject(heavyWood);
    ShieldProf heavySteel = new ShieldProf();
    heavySteel.setName("Heavy Steel Shield");
    heavySteel.addToListFor(ListKey.TYPE, Type.getConstant("Heavy"));
    Globals.getContext().getReferenceContext().importObject(heavySteel);
}
Also used : ShieldProf(pcgen.core.ShieldProf) Equipment(pcgen.core.Equipment)

Example 4 with ShieldProf

use of pcgen.core.ShieldProf 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 5 with ShieldProf

use of pcgen.core.ShieldProf 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)

Aggregations

ShieldProf (pcgen.core.ShieldProf)10 Equipment (pcgen.core.Equipment)8 ArmorProf (pcgen.core.ArmorProf)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 ShieldProfProvider (pcgen.cdom.helper.ShieldProfProvider)2 StringTokenizer (java.util.StringTokenizer)1 ConditionalSelectionActor (pcgen.cdom.content.ConditionalSelectionActor)1 CDOMSingleRef (pcgen.cdom.reference.CDOMSingleRef)1 Prerequisite (pcgen.core.prereq.Prerequisite)1 ComplexParseResult (pcgen.rules.persistence.token.ComplexParseResult)1 ParseResult (pcgen.rules.persistence.token.ParseResult)1