use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class PreSkillTest method testServesAsTotalsMatch.
public void testServesAsTotalsMatch() throws Exception {
final PlayerCharacter character = getCharacter();
final PreParserFactory factory = PreParserFactory.getInstance();
Prerequisite prereq = factory.parse("PRESKILLTOT:Tumble,Target=18");
assertEquals(false, PrereqHandler.passes(prereq, character, null));
prereq = factory.parse("PRESKILLTOT:Tumble,Target2=14");
assertEquals(true, PrereqHandler.passes(prereq, character, null));
prereq = factory.parse("PRESKILLTOT:Foo,Target=40");
assertEquals(false, PrereqHandler.passes(prereq, character, null));
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class WeaponTokenTest method testBastardSword.
/**
* Test the processing of a bastard sword on a medium creature without the
* exotic weapon proficiency. It should not be able to be wielded one handed.<br/>
* This is based on the text from the DnD FAQ v20060621 on p32 which states
* "Treat ... these weapons as two-handed weapons when determining who can
* use them and how." when talking about bastard swords for weilders without
* the exotic weapon proficiency.
*/
public void testBastardSword() {
PlayerCharacter character = getCharacter();
assertEquals("2-handed prof should be martial", "KEY_Sword (Bastard)", bastardSword.get(ObjectKey.WEAPON_PROF).get().getKeyName());
EquipSet es = new EquipSet("0.1.2", "Sword (Bastard)", bastardSword.getName(), bastardSword);
character.addEquipSet(es);
character.setCalcEquipmentList();
// Now test the output to ensure it is correct
WeaponToken token = new WeaponToken();
assertEquals("Name", "Sword, Bastard", token.getToken("WEAPON.3.NAME", character, null));
assertEquals("Not possible to weild the bastard sword one handed.", null, token.getToken("WEAPON.3.BASEHIT", character, null));
assertEquals("No penalty to weild the bastard sword two handed.", "+18/+13/+8/+3", token.getToken("WEAPON.3.THHIT", character, null));
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class WeaponTokenTest method testTemplateBonus.
/**
* Check the TEMPLATEHIT and TEMPLATEDAMAGE weapon subtokens.
*/
public void testTemplateBonus() {
PlayerCharacter character = getCharacter();
WeaponToken token = new WeaponToken();
assertEquals("weapon name", dblWpn.getName(), token.getToken("WEAPON.0.NAME.NOSTAR", character, null));
assertEquals("feat tohit bonus, before adding", "+0", token.getToken("WEAPON.0.TEMPLATEHIT", character, null));
assertEquals("feat damage bonus, before adding", "+0", token.getToken("WEAPON.0.TEMPLATEDAMAGE", character, null));
character.addTemplate(wpnBonusPct);
character.calcActiveBonuses();
assertEquals("feat tohit bonus, after adding", "+4", token.getToken("WEAPON.0.TEMPLATEHIT", character, null));
assertEquals("feat damage bonus, after adding", "+3", token.getToken("WEAPON.0.TEMPLATEDAMAGE", character, null));
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class WeaponTokenTest method testEnhancedDoubleWeapon.
/**
* Test the processing of double weapons with enhancements on a medium
* creature.
*/
public void testEnhancedDoubleWeapon() {
PlayerCharacter character = getCharacter();
WeaponToken token = new WeaponToken();
// Test magical enhancements to the double weapon H1:+1, H2:+2
dblWpn.addEqModifiers("MWORKW.PLUS1W", true);
dblWpn.addEqModifiers("MWORKW.PLUS2W", false);
assertEquals("2H - THHIT-H1 [+1]", "+15/+10/+5/+0", token.getToken("WEAPON.1.THHIT", character, null));
assertEquals("2H - THHIT-H2 [+2]", "+16/+11/+6/+1", token.getToken("WEAPON.2.THHIT", character, null));
assertEquals("2H - THDAMAGE-H1 [+1]", "1d10+4", token.getToken("WEAPON.1.THDAMAGE", character, null));
assertEquals("2H - THDAMAGE-H2 [+2]", "1d6+5", token.getToken("WEAPON.2.THDAMAGE", character, null));
}
use of pcgen.core.PlayerCharacter in project pcgen by PCGen.
the class WeaponTokenTest method testLargeLongSword.
/**
* Test the processing of a large sword on a medium creature. It
* should be forced to be wielded two handed. Note: Size penalties are not
* included in the data prepared, so are not included in the calculations.
*/
public void testLargeLongSword() {
PlayerCharacter character = getCharacter();
assertEquals("Prof should be longsword", "KEY_LONGSWORD", largeSword.get(ObjectKey.WEAPON_PROF).get().getKeyName());
EquipSet es = new EquipSet("0.1.3", "Longsword (Large)", largeSword.getName(), largeSword);
character.addEquipSet(es);
character.setCalcEquipmentList();
// Now test the output to ensure it is correct
WeaponToken token = new WeaponToken();
assertEquals("Large sword - name", "Longsword (Large)", token.getToken("WEAPON.3.NAME", character, null));
assertEquals("Large sword - Two handed should be fine", "+18/+13/+8/+3", token.getToken("WEAPON.3.THHIT", character, null));
assertEquals("Large sword - can't be wielded one handed", null, token.getToken("WEAPON.3.BASEHIT", character, null));
}
Aggregations