use of plugin.pretokens.test.PreClassTester in project pcgen by PCGen.
the class PreClassTest method testSpellcasterTypePass.
/**
* Test to ensure that a character with a spellcasting class
* will pass a prerequisute that requires a level of that
* classes spell type.
* @throws Exception
*/
public void testSpellcasterTypePass() throws Exception {
LoadContext context = Globals.getContext();
final PCClass pcClass = context.getReferenceContext().constructCDOMObject(PCClass.class, "MyClass");
BuildUtilities.setFact(pcClass, "SpellType", "Arcane");
context.unconditionallyProcess(pcClass.getOriginalClassLevel(1), "CAST", "5,4");
context.unconditionallyProcess(pcClass, "SPELLSTAT", "CHA");
context.getReferenceContext().resolveReferences(null);
context.getReferenceContext().buildDerivedObjects();
context.loadCampaignFacets();
final PlayerCharacter character = getCharacter();
setPCStat(character, cha, 12);
character.incrementClassLevel(1, pcClass);
final Prerequisite prereq = new Prerequisite();
prereq.setKind("class");
prereq.setKey("Spellcaster.ARCANE");
prereq.setOperand("1");
prereq.setOperator(PrerequisiteOperator.GTEQ);
final PreClassTester test = new PreClassTester();
final int passes = test.passes(prereq, character, null);
assertEquals(1, passes);
}
Aggregations