Search in sources :

Example 66 with EquipSet

use of pcgen.core.character.EquipSet in project pcgen by PCGen.

the class EquipSetMigrationTest method equipItem.

/**
	 * Add the equipment item to the equipset.
	 * 
	 * @param pc The character owning the set
	 * @param es The set to add the item to
	 * @param item The item of equipment
	 * @param qty The number to be placed in the location.
	 * @return The new EquipSet object for the item.
	 */
private EquipSet equipItem(PlayerCharacter pc, Equipment item, float qty, String locName, String id) {
    EquipSet newSet = new EquipSet(id, locName, item.getName(), item);
    item.setQty(qty);
    newSet.setQty(1.0f);
    pc.addEquipSet(newSet);
    return newSet;
}
Also used : EquipSet(pcgen.core.character.EquipSet)

Example 67 with EquipSet

use of pcgen.core.character.EquipSet in project pcgen by PCGen.

the class StatTokenTest method testLevelStat.

/**
	 * Test out the output of stats as at a particular level, including 
	 * stacking issues.  
	 */
public void testLevelStat() {
    StatToken statTok = new StatToken();
    PlayerCharacter pc = getCharacter();
    setPCStat(pc, dex, 10);
    PCClass myClass = new PCClass();
    myClass.setName("My Class");
    myClass.put(FormulaKey.START_SKILL_POINTS, FormulaFactory.getFormulaFor(3));
    pc.incrementClassLevel(1, myClass, true);
    pc.incrementClassLevel(1, myClass, true);
    pc.saveStatIncrease(dex, 1, true);
    pc.saveStatIncrease(dex, 1, false);
    setPCStat(pc, dex, 12);
    pc.incrementClassLevel(1, myClass, true);
    pc.saveStatIncrease(dex, 1, true);
    pc.saveStatIncrease(dex, 1, false);
    setPCStat(pc, dex, 14);
    assertEquals("Total stat.", "14", statTok.getToken("STAT.1", pc, null));
    assertEquals("Level 1 stat.", "10", statTok.getToken("STAT.1.LEVEL.1", pc, null));
    assertEquals("Level 2 stat.", "11", statTok.getToken("STAT.1.LEVEL.2.NOPOST", pc, null));
    pc.addEquipment(boots);
    EquipSet es = new EquipSet("0.1", "Equipped");
    pc.addEquipSet(es);
    es = new EquipSet("0.1.2", "Feet", boots.getName(), boots);
    pc.addEquipSet(es);
    pc.setCalcEquipmentList();
    pc.calcActiveBonuses();
    pc.setUseTempMods(true);
    BonusObj bonus = spell.getRawBonusList(pc).get(0);
    pc.addTempBonus(bonus, spell, pc);
    pc.calcActiveBonuses();
    assertEquals("Total stat.", "18", statTok.getToken("STAT.1", pc, null));
    assertEquals("Level 1 stat.", "14", statTok.getToken("STAT.1.LEVEL.1", pc, null));
    assertEquals("Level 1 stat.", "14", statTok.getToken("STAT.1.LEVEL.1.NOEQUIP", pc, null));
    assertEquals("Level 1 stat.", "12", statTok.getToken("STAT.1.LEVEL.1.NOTEMP", pc, null));
    assertEquals("Level 1 stat.", "10", statTok.getToken("STAT.1.LEVEL.1.NOEQUIP.NOTEMP", pc, null));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) BonusObj(pcgen.core.bonus.BonusObj) EquipSet(pcgen.core.character.EquipSet) PCClass(pcgen.core.PCClass)

Example 68 with EquipSet

use of pcgen.core.character.EquipSet in project pcgen by PCGen.

the class WeaponTokenTest method testWpnReach.

public void testWpnReach() {
    LoadContext context = Globals.getContext();
    PlayerCharacter character = getCharacter();
    character.addEquipment(largeSword);
    EquipSet es = new EquipSet("0.1.3", "Large Sword", largeSword.getName(), largeSword);
    character.addEquipSet(es);
    character.setCalcEquipmentList();
    WeaponToken token = new WeaponToken();
    assertEquals("Reach for a non-reach weapon on a character with normal reach", "5", token.getToken("WEAPON.3.REACH", character, null));
    character.addEquipment(longSpear);
    es = new EquipSet("0.1.4", "Longspear", longSpear.getName(), longSpear);
    character.addEquipSet(es);
    character.setCalcEquipmentList();
    // note: longspear ends up inserted before the large sword above, hence we use weapon.3
    assertEquals("Reach for a reach weapon (10') on a character with normal reach", "10", token.getToken("WEAPON.3.REACH", character, null));
    // set reach multiplier on the large sword to 2 and retest
    largeSword.put(IntegerKey.REACH_MULT, 2);
    assertEquals("Reach for a reach multiple weapon on a character with normal reach", "10", token.getToken("WEAPON.4.REACH", character, null));
    // Check we can bonus the reach
    PCTemplate lsReachTemplate = new PCTemplate();
    lsReachTemplate.setName("LongSpear Long Arm");
    BonusObj aBonus = Bonus.newBonus(context, "WEAPONPROF=KEY_SPEAR|REACH|5");
    if (aBonus != null) {
        lsReachTemplate.addToListFor(ListKey.BONUS, aBonus);
    }
    character.addTemplate(lsReachTemplate);
    assertEquals("Reach for a reach weapon (10') on a character with bonus for the proficiency", "15", token.getToken("WEAPON.3.REACH", character, null));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) BonusObj(pcgen.core.bonus.BonusObj) EquipSet(pcgen.core.character.EquipSet) LoadContext(pcgen.rules.context.LoadContext) PCTemplate(pcgen.core.PCTemplate)

Example 69 with EquipSet

use of pcgen.core.character.EquipSet in project pcgen by PCGen.

the class WeaponTokenTest method testNaturalWeapon.

/**
	 * Test natural weapons
	 */
public void testNaturalWeapon() {
    PlayerCharacter character = getCharacter();
    assertEquals("Prof should be SillyBite", "SillyBite", bite.get(ObjectKey.WEAPON_PROF).get().getKeyName());
    EquipSet es = new EquipSet("0.1.3", "Bite Attack", bite.getName(), bite);
    character.addEquipSet(es);
    character.setCalcEquipmentList();
    // Now test the output to ensure it is correct
    WeaponToken token = new WeaponToken();
    assertEquals("Silly Bite - Basic To Hit", "+18/+18/+18/+18/+18/+18/+18/+18", token.getToken("WEAPON.3.BASEHIT", character, null));
    assertEquals("Silly Bite - Total To Hit", "+18/+18/+18/+18/+18/+18/+18/+18", token.getToken("WEAPON.3.TOTALHIT", character, null));
    assertEquals("Silly Bite - Total To Hit first attack", "+18", token.getToken("WEAPON.3.TOTALHIT.0", character, null));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) EquipSet(pcgen.core.character.EquipSet)

Example 70 with EquipSet

use of pcgen.core.character.EquipSet in project pcgen by PCGen.

the class WeaponTokenTest method testTwohandedEquipped.

/**
	 * Test a two handed weapon that is equipped.
	 */
public void testTwohandedEquipped() {
    PlayerCharacter character = getCharacter();
    character.addEquipment(longSpear);
    EquipSet es = new EquipSet("0.1.3", "Longspear", longSpear.getName(), longSpear);
    character.addEquipSet(es);
    character.setCalcEquipmentList();
    WeaponToken token = new WeaponToken();
    assertEquals("weapon name", longSpear.getName(), token.getToken("WEAPON.3.NAME", character, null));
    assertEquals("weapon name", "+14/+9/+4/-1", token.getToken("WEAPON.3.THHIT", character, null));
    assertEquals("weapon name", "+14/+9/+4/-1", token.getToken("WEAPON.3.TOTALHIT", character, null));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) EquipSet(pcgen.core.character.EquipSet)

Aggregations

EquipSet (pcgen.core.character.EquipSet)79 PlayerCharacter (pcgen.core.PlayerCharacter)32 Equipment (pcgen.core.Equipment)22 ArrayList (java.util.ArrayList)12 BonusObj (pcgen.core.bonus.BonusObj)11 HashMap (java.util.HashMap)9 LoadContext (pcgen.rules.context.LoadContext)8 EquipNode (pcgen.facade.core.EquipmentSetFacade.EquipNode)7 DecimalFormat (java.text.DecimalFormat)4 NumberFormat (java.text.NumberFormat)4 List (java.util.List)4 Map (java.util.Map)4 EquipmentList (pcgen.core.EquipmentList)4 PCTemplate (pcgen.core.PCTemplate)4 EquipSlot (pcgen.core.character.EquipSlot)4 LinkedHashMap (java.util.LinkedHashMap)3 Ability (pcgen.core.Ability)3 EquipmentModifier (pcgen.core.EquipmentModifier)3 StringTokenizer (java.util.StringTokenizer)2 CNAbility (pcgen.cdom.content.CNAbility)2