use of pcgen.core.WeaponProf in project pcgen by PCGen.
the class AutoListWeaponProfFacetTest method getObject.
@Override
protected WeaponProf getObject() {
WeaponProf wp = new WeaponProf();
wp.setName("WP" + n++);
return wp;
}
use of pcgen.core.WeaponProf 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");
wp2 = new WeaponProf();
wp2.setName("Wp2");
primaryContext.getReferenceContext().importObject(wp2);
eq4 = new Equipment();
eq4.setName("Eq4");
primaryContext.getReferenceContext().importObject(eq4);
primaryContext.unconditionallyProcess(eq4, "TYPE", "WEAPON.Masterful");
primaryContext.unconditionallyProcess(eq4, "PROFICIENCY", "WEAPON|Wp2");
}
use of pcgen.core.WeaponProf in project pcgen by PCGen.
the class SpellcasterQualifierTokenTest method initializeObjects.
private void initializeObjects() {
wp1 = new WeaponProf();
wp1.setName("Wp1");
primaryContext.getReferenceContext().importObject(wp1);
wp2 = new WeaponProf();
wp2.setName("Wp2");
primaryContext.getReferenceContext().importObject(wp2);
primaryContext.unconditionallyProcess(wp2, "TYPE", "WEAPON.Masterful");
wp3 = new WeaponProf();
wp3.setName("Wp3");
primaryContext.getReferenceContext().importObject(wp3);
primaryContext.unconditionallyProcess(wp3, "TYPE", "WEAPON.Masterful");
}
use of pcgen.core.WeaponProf in project pcgen by PCGen.
the class PCSizeIntEQTermEvaluator method resolve.
@Override
public Float resolve(PlayerCharacter pc) {
int modSize = 0;
final Equipment eq = pc.getEquipmentNamed(source);
if (eq != null) {
CDOMSingleRef<WeaponProf> ref = eq.get(ObjectKey.WEAPON_PROF);
if (ref != null) {
String profName = ref.get().getKeyName();
modSize = (int) pc.getTotalBonusTo("WEAPONPROF=" + profName, "PCSIZE");
}
// loops for each equipment type
for (String eqType : eq.typeList()) {
// get the type bonus (ex TYPE.MARTIAL)
final int i = (int) pc.getTotalBonusTo("WEAPONPROF=TYPE." + eqType, "PCSIZE");
// get the highest bonus
if (modSize < i) {
modSize = i;
}
}
}
return (float) pc.getDisplay().sizeInt() + modSize;
}
use of pcgen.core.WeaponProf in project pcgen by PCGen.
the class PrerequisiteUtilities method subKeyWeaponProf.
/**
* Count the number of weaponprofs associated with the ability being tested of types cType.
*
* @param countMults Should multiple occurrences be counted?
* @param cType The type to check for.
* @param selectedList The list of weaponprofs associated with the ability being tested.
* @return int
*/
private static int subKeyWeaponProf(final boolean countMults, final String cType, final List<String> selectedList) {
int returnTotal = 0;
for (String weaponprof : selectedList) {
final WeaponProf wp = Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(WeaponProf.class, weaponprof);
if (wp == null) {
continue;
}
if (wp.isType(cType)) {
returnTotal++;
if (!countMults) {
break;
}
continue;
}
final Equipment eq = Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(Equipment.class, wp.getKeyName());
if (eq == null) {
continue;
}
if (eq.isType(cType)) {
returnTotal++;
if (!countMults) {
break;
}
}
}
return returnTotal;
}
Aggregations