Search in sources :

Example 11 with PreClassParser

use of plugin.pretokens.parser.PreClassParser in project pcgen by PCGen.

the class PreMultTest method testCharWithMultipleSpellClasses.

/**
	 * Test to ensure that a character will fail a test
	 * if it does not have the correct number of levels
	 * in the class.
	 * @throws Exception
	 */
public void testCharWithMultipleSpellClasses() throws Exception {
    LoadContext context = Globals.getContext();
    final PCClass pcClass = context.getReferenceContext().constructCDOMObject(PCClass.class, "MyClass");
    context.unconditionallyProcess(pcClass, "SPELLSTAT", "CHA");
    BuildUtilities.setFact(pcClass, "SpellType", "Arcane");
    context.unconditionallyProcess(pcClass.getOriginalClassLevel(1), "CAST", "5,4");
    final PCClass pcClass2 = context.getReferenceContext().constructCDOMObject(PCClass.class, "Other Class");
    context.unconditionallyProcess(pcClass2, "SPELLSTAT", "INT");
    BuildUtilities.setFact(pcClass2, "SpellType", "Arcane");
    context.unconditionallyProcess(pcClass2.getOriginalClassLevel(1), "CAST", "5,4");
    context.getReferenceContext().buildDerivedObjects();
    context.getReferenceContext().resolveReferences(null);
    context.loadCampaignFacets();
    final PlayerCharacter character = getCharacter();
    setPCStat(character, cha, 12);
    setPCStat(character, intel, 12);
    character.incrementClassLevel(1, pcClass);
    character.incrementClassLevel(2, pcClass2);
    final PreClassParser producer = new PreClassParser();
    final Prerequisite prereq = producer.parse("CLASS", "1,SPELLCASTER.Arcane,SPELLCASTER.Arcane=2", false, false);
    final PreMult test = new PreMult();
    final int passes = test.passes(prereq, character, null);
    assertEquals(1, passes);
}
Also used : PreClassParser(plugin.pretokens.parser.PreClassParser) PlayerCharacter(pcgen.core.PlayerCharacter) LoadContext(pcgen.rules.context.LoadContext) PCClass(pcgen.core.PCClass)

Example 12 with PreClassParser

use of plugin.pretokens.parser.PreClassParser in project pcgen by PCGen.

the class DomainsTokenTest method setUp.

@Override
@Before
public void setUp() throws PersistenceLayerException, URISyntaxException {
    super.setUp();
    TokenRegistration.register(new PreLevelParser());
    TokenRegistration.register(new PreClassParser());
    TokenRegistration.register(new PreLevelWriter());
    TokenRegistration.register(new PreClassWriter());
}
Also used : PreClassParser(plugin.pretokens.parser.PreClassParser) PreLevelWriter(plugin.pretokens.writer.PreLevelWriter) PreClassWriter(plugin.pretokens.writer.PreClassWriter) PreLevelParser(plugin.pretokens.parser.PreLevelParser) Before(org.junit.Before)

Example 13 with PreClassParser

use of plugin.pretokens.parser.PreClassParser in project pcgen by PCGen.

the class ClassesTokenTest method ltClassSetUp.

@BeforeClass
public static void ltClassSetUp() throws PersistenceLayerException {
    TokenRegistration.register(new PreClassParser());
    classSetUpFired = true;
}
Also used : PreClassParser(plugin.pretokens.parser.PreClassParser) BeforeClass(org.junit.BeforeClass)

Aggregations

PreClassParser (plugin.pretokens.parser.PreClassParser)13 PreClassWriter (plugin.pretokens.writer.PreClassWriter)6 Test (org.junit.Test)4 Prerequisite (pcgen.core.prereq.Prerequisite)4 PreLevelParser (plugin.pretokens.parser.PreLevelParser)4 PreLevelWriter (plugin.pretokens.writer.PreLevelWriter)4 PersistenceLayerException (pcgen.persistence.PersistenceLayerException)3 Before (org.junit.Before)2 BeforeClass (org.junit.BeforeClass)2 PCClass (pcgen.core.PCClass)1 PlayerCharacter (pcgen.core.PlayerCharacter)1 LoadContext (pcgen.rules.context.LoadContext)1 PreClassLevelMaxParser (plugin.pretokens.parser.PreClassLevelMaxParser)1 PreRaceParser (plugin.pretokens.parser.PreRaceParser)1 PreRaceWriter (plugin.pretokens.writer.PreRaceWriter)1