Search in sources :

Example 91 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class AbilityTokenTest method testAssociatedCount.

/**
	 * Tests the ASSOCIATEDCOUNT subtoken of ABILITY.
	 */
public void testAssociatedCount() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("0", tok.getToken("ABILITY.FEAT.0.ASSOCIATEDCOUNT", character, eh));
    assertEquals("2", tok.getToken("ABILITY.FEAT.1.ASSOCIATEDCOUNT", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 92 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class AbilityTokenTest method testHasAspect.

/**
	 * Tests the HASASPECT subtoken of ABILITY.
	 */
public void testHasAspect() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("N", tok.getToken("ABILITY.FEAT.0.HASASPECT.3", character, eh));
    assertEquals("N", tok.getToken("ABILITY.FEAT.0.HASASPECT.5", character, eh));
    assertEquals("N", tok.getToken("ABILITY.FEAT.0.HASASPECT.Attack Type", character, eh));
    assertEquals("Y", tok.getToken("ABILITY.FEAT.0.HASASPECT.Colour", character, eh));
    assertEquals("Y", tok.getToken("ABILITY.FEAT.0.HASASPECT.Age In Years", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 93 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class AbilityTokenTest method testAspectCount.

/**
	 * Tests the ASPECTCOUNT subtoken of ABILITY.
	 */
public void testAspectCount() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("5", tok.getToken("ABILITY.FEAT.0.ASPECTCOUNT", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 94 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class AbilityTokenTest method testName.

/**
	 * Tests the name subtoken of ABILITY.
	 */
public void testName() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("Perform (Dance)", tok.getToken("ABILITY.FEAT.0.NAME", character, eh));
    assertEquals("Skill Focus", tok.getToken("ABILITY.FEAT.1.NAME", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 95 with PlayerCharacter

use of pcgen.core.PlayerCharacter in project pcgen by PCGen.

the class PreBaseSizeTest method testBaseSizePlusMod.

/**
	 * Tests to make sure the base size does not includ SIZEMOD adjustments
	 * @throws Exception
	 */
public void testBaseSizePlusMod() throws Exception {
    final PlayerCharacter character = getCharacter();
    LoadContext context = Globals.getContext();
    character.setRace(race);
    final BonusObj sizeBonus = Bonus.newBonus(context, "SIZEMOD|NUMBER|1");
    race.addToListFor(ListKey.BONUS, sizeBonus);
    character.calcActiveBonuses();
    Prerequisite prereq;
    final PreParserFactory factory = PreParserFactory.getInstance();
    prereq = factory.parse("PREBASESIZEEQ:Medium");
    assertTrue("Character's base size should be equal to Medium", PrereqHandler.passes(prereq, character, null));
    prereq = factory.parse("PREBASESIZELTEQ:Medium");
    assertTrue("Character's base size should be <= to Medium", PrereqHandler.passes(prereq, character, null));
    prereq = factory.parse("PREBASESIZEGTEQ:Medium");
    assertTrue("Character's base size should be >= to Medium", PrereqHandler.passes(prereq, character, null));
    prereq = factory.parse("PREBASESIZEGT:Small");
    assertTrue("Character's base size should be > to Small", PrereqHandler.passes(prereq, character, null));
    prereq = factory.parse("PREBASESIZELT:Large");
    assertTrue("Character's base size should be < to Large", PrereqHandler.passes(prereq, character, null));
    prereq = factory.parse("PREBASESIZELT:Medium");
    assertFalse("Character's base size should not be < to Medium", PrereqHandler.passes(prereq, character, null));
    prereq = factory.parse("PREBASESIZEGT:Medium");
    assertFalse("Character's base size should not be > to Medium", PrereqHandler.passes(prereq, character, null));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) PreParserFactory(pcgen.persistence.lst.prereq.PreParserFactory) BonusObj(pcgen.core.bonus.BonusObj) LoadContext(pcgen.rules.context.LoadContext)

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