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