Esempio n. 1
0
  /** Test the SPELLLISTDC sub-tag of the SPELLLIST token. */
  public void testSpellListDcToken() {
    PlayerCharacter character = new PlayerCharacter();

    character.setRace(human);
    setPCStat(character, cha, 14);
    character.calcActiveBonuses();
    character.incrementClassLevel(1, arcaneClass, true);
    character.calcActiveBonuses();

    SpellListDcToken token = new SpellListDcToken();
    assertEquals(
        "SpellListDcToken(1lv TA)", "12", token.getToken("SPELLLISTDC.0.0", character, null));
    assertEquals(
        "SpellListDcToken(1lv TA)", "15", token.getToken("SPELLLISTDC.0.3", character, null));
  }
Esempio n. 2
0
  /** Test the SPELLLISTCAST sub-tag of the SPELLLIST token. */
  public void testSpellListCastToken() {
    PlayerCharacter character = new PlayerCharacter();

    character.setRace(human);
    character.setStat(cha, 12);
    character.calcActiveBonuses();
    character.incrementClassLevel(1, arcaneClass, true);

    SpellListCastToken token = new SpellListCastToken();
    assertEquals(
        "testSpellListCastToken(1lv TA)",
        "2",
        token.getToken("SPELLLISTCAST.0.1", character, null));
  }
  /**
   * 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");
    character.addSkill(extraKnow);
    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);

    character.removeSkill(knowledge);
    character.calcActiveBonuses();
  }