Search in sources :

Example 36 with WeaponProf

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

Example 37 with WeaponProf

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");
}
Also used : ShieldProf(pcgen.core.ShieldProf) Equipment(pcgen.core.Equipment) WeaponProf(pcgen.core.WeaponProf) ArmorProf(pcgen.core.ArmorProf)

Example 38 with WeaponProf

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

Example 39 with WeaponProf

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

Example 40 with WeaponProf

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

Aggregations

WeaponProf (pcgen.core.WeaponProf)56 StringTokenizer (java.util.StringTokenizer)10 Test (org.junit.Test)10 Equipment (pcgen.core.Equipment)10 CDOMReference (pcgen.cdom.base.CDOMReference)6 ArrayList (java.util.ArrayList)5 CDOMObject (pcgen.cdom.base.CDOMObject)5 Deity (pcgen.core.Deity)5 ArmorProf (pcgen.core.ArmorProf)4 PCTemplate (pcgen.core.PCTemplate)4 ShieldProf (pcgen.core.ShieldProf)4 HashSet (java.util.HashSet)3 ChangeProf (pcgen.cdom.content.ChangeProf)3 WeaponProfProvider (pcgen.cdom.helper.WeaponProfProvider)3 CDOMSingleRef (pcgen.cdom.reference.CDOMSingleRef)3 PCClass (pcgen.core.PCClass)3 Race (pcgen.core.Race)3 Type (pcgen.cdom.enumeration.Type)2 EquipmentHead (pcgen.cdom.inst.EquipmentHead)2 CDOMGroupRef (pcgen.cdom.reference.CDOMGroupRef)2