Search in sources :

Example 1 with PreSkillParser

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());
}
Also used : PreSkillWriter(plugin.pretokens.writer.PreSkillWriter) PreSkillParser(plugin.pretokens.parser.PreSkillParser)

Example 2 with PreSkillParser

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());
}
Also used : PreSkillParser(plugin.pretokens.parser.PreSkillParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 3 with PreSkillParser

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());
}
Also used : PreSkillParser(plugin.pretokens.parser.PreSkillParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 4 with PreSkillParser

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());
}
Also used : PreSkillParser(plugin.pretokens.parser.PreSkillParser) Prerequisite(pcgen.core.prereq.Prerequisite) Test(org.junit.Test)

Example 5 with PreSkillParser

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);
}
Also used : Skill(pcgen.core.Skill) PlayerCharacter(pcgen.core.PlayerCharacter) PreSkillParser(plugin.pretokens.parser.PreSkillParser)

Aggregations

PreSkillParser (plugin.pretokens.parser.PreSkillParser)8 Test (org.junit.Test)5 Prerequisite (pcgen.core.prereq.Prerequisite)5 PlayerCharacter (pcgen.core.PlayerCharacter)1 Skill (pcgen.core.Skill)1 PreSkillMultWriter (plugin.pretokens.writer.PreSkillMultWriter)1 PreSkillWriter (plugin.pretokens.writer.PreSkillWriter)1