Search in sources :

Example 61 with PlayerCharacter

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));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) PreParserFactory(pcgen.persistence.lst.prereq.PreParserFactory)

Example 62 with PlayerCharacter

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

Example 63 with PlayerCharacter

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

Example 64 with PlayerCharacter

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

Example 65 with PlayerCharacter

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

Aggregations

PlayerCharacter (pcgen.core.PlayerCharacter)438 PreParserFactory (pcgen.persistence.lst.prereq.PreParserFactory)89 PCClass (pcgen.core.PCClass)61 LoadContext (pcgen.rules.context.LoadContext)58 Ability (pcgen.core.Ability)54 Equipment (pcgen.core.Equipment)41 PCTemplate (pcgen.core.PCTemplate)38 EquipSet (pcgen.core.character.EquipSet)32 BonusObj (pcgen.core.bonus.BonusObj)29 Race (pcgen.core.Race)28 CharID (pcgen.cdom.enumeration.CharID)25 ExportHandler (pcgen.io.ExportHandler)24 Test (org.junit.Test)20 ArrayList (java.util.ArrayList)16 PreClassTester (plugin.pretokens.test.PreClassTester)16 CDOMObject (pcgen.cdom.base.CDOMObject)15 Skill (pcgen.core.Skill)14 CNAbility (pcgen.cdom.content.CNAbility)13 URI (java.net.URI)11 URISyntaxException (java.net.URISyntaxException)11