use of plugin.pretokens.parser.PreSkillParser in project pcgen by PCGen.
the class PreSkillRoundRobin method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
TokenRegistration.register(new PreSkillParser());
TokenRegistration.register(new PreSkillWriter());
}
use of plugin.pretokens.parser.PreSkillParser in project pcgen by PCGen.
the class PreSkillParserTest method test1.
/**
* @throws Exception
*/
@Test
public void test1() throws Exception {
PreSkillParser producer = new PreSkillParser();
Prerequisite prereq = producer.parse("SKILL", "3,Decipher Script=7,Disable Device=7,Escape Artist=7", false, false);
assertEquals("<prereq operator=\"GTEQ\" operand=\"3\" >\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"Decipher Script\" operator=\"GTEQ\" operand=\"7\" >\n" + "</prereq>\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"Disable Device\" operator=\"GTEQ\" operand=\"7\" >\n" + "</prereq>\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"Escape Artist\" operator=\"GTEQ\" operand=\"7\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
use of plugin.pretokens.parser.PreSkillParser in project pcgen by PCGen.
the class PreSkillParserTest method test3.
@Test
public void test3() throws Exception {
PreSkillParser producer = new PreSkillParser();
Prerequisite prereq = producer.parse("SKILL", "3,TYPE.Knowledge=10", false, false);
assertEquals("<prereq operator=\"GTEQ\" operand=\"3\" >\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"TYPE.Knowledge\" operator=\"GTEQ\" operand=\"10\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
use of plugin.pretokens.parser.PreSkillParser in project pcgen by PCGen.
the class PreSkillParserTest method testTypeEquals.
@Test
public void testTypeEquals() throws Exception {
PreSkillParser producer = new PreSkillParser();
Prerequisite prereq = producer.parse("SKILL", "3,TYPE=Knowledge=10", false, false);
assertEquals("<prereq operator=\"GTEQ\" operand=\"3\" >\n" + "<prereq kind=\"skill\" count-multiples=\"true\" key=\"TYPE=Knowledge\" operator=\"GTEQ\" operand=\"10\" >\n" + "</prereq>\n" + "</prereq>\n", prereq.toString());
}
use of plugin.pretokens.parser.PreSkillParser in project pcgen by PCGen.
the class PreMultTest method testMultiSkills.
/**
* Test to ensure that a number of skills test will
* correctly require a number of separate skills at
* the required level.
* @throws Exception
*/
public void testMultiSkills() throws Exception {
final PreSkillParser producer = new PreSkillParser();
final Prerequisite prereq = producer.parse("SKILL", "2,TYPE.Knowledge=4", false, false);
final PlayerCharacter character = getCharacter();
boolean passes = PrereqHandler.passes(prereq, character, null);
assertFalse("Should not pass 2 knowledge skill test with 1 skill", passes);
final Skill extraKnow = new Skill();
Globals.getContext().unconditionallyProcess(extraKnow, "CLASSES", "MyClass");
extraKnow.setName("KNOWLEDGE (RELIGION)");
TestHelper.addType(extraKnow, "KNOWLEDGE.INT");
SkillRankControl.modRanks(5.0, myClass, true, character, extraKnow);
passes = PrereqHandler.passes(prereq, character, null);
assertTrue("Should pass 2 knowledge skill test with 2 skills", passes);
}
Aggregations