Example #1
0
  /* (non-Javadoc)
   * @see pcgen.core.prereq.PrerequisiteTest#passes(pcgen.core.prereq.Prerequisite, pcgen.core.Equipment)
   */
  @Override
  public int passes(final Prerequisite prereq, final Equipment equipment, PlayerCharacter aPC)
      throws PrerequisiteException {
    int runningTotal = 0;
    final int targetNumber = Integer.parseInt(prereq.getOperand());

    for (Prerequisite element : prereq.getPrerequisites()) {
      final PrerequisiteTestFactory factory = PrerequisiteTestFactory.getInstance();
      final PrerequisiteTest test = factory.getTest(element.getKind());
      runningTotal += test.passes(element, equipment, aPC);
    }

    runningTotal = prereq.getOperator().compare(runningTotal, targetNumber);
    return countedTotal(prereq, runningTotal);
  }
Example #2
0
  /* (non-Javadoc)
   * @see pcgen.core.prereq.PrerequisiteTest#passes(pcgen.core.PlayerCharacter)
   */
  @Override
  public int passes(final Prerequisite prereq, final PlayerCharacter character, CDOMObject source)
      throws PrerequisiteException {
    int runningTotal = 0;
    final int targetNumber = Integer.parseInt(prereq.getOperand());

    for (Prerequisite element : prereq.getPrerequisites()) {
      final PrerequisiteTestFactory factory = PrerequisiteTestFactory.getInstance();
      final PrerequisiteTest test = factory.getTest(element.getKind());
      if (test != null) {
        runningTotal += test.passes(element, character, source);
      } else {
        Logging.errorPrintLocalised(
            "PreMult.cannot_find_subtest", element.getKind()); // $NON-NLS-1$
      }
    }

    runningTotal = prereq.getOperator().compare(runningTotal, targetNumber);

    return countedTotal(prereq, runningTotal);
  }