private boolean hasDBT(IGenericCharacter character) {
   for (IMagic magic : character.getAllLearnedMagic()) {
     if (magic instanceof ICharm && magic.getId().equals("Lunar.DeadlyBeastmanTransformation")) {
       return true;
     }
   }
   return false;
 }
Пример #2
0
  @Override
  public boolean isAllowedFor(final IGenericTraitCollection traitCollection, IMagic magic) {
    final boolean[] isAllowed = new boolean[1];
    magic.accept(
        new IMagicVisitor() {
          @Override
          public void visitSpell(ISpell spell) {
            CircleType type = spell.getCircleType();
            if (isSpellCircleGreaterThanMaximumCircle(type)
                || isBackgroundValueLessThanMinimumValueForCircle(traitCollection, type)) {
              isAllowed[0] = false;
              return;
            }
            if (exceptionIds.contains(spell.getId())) {
              isAllowed[0] = !defaultResponse;
            } else {
              isAllowed[0] = defaultResponse;
            }
          }

          @Override
          public void visitCharm(ICharm charm) {
            isAllowed[0] = false;
          }
        });
    return isAllowed[0];
  }
Пример #3
0
  public int getMagicCosts(IMagic magic, final ICostAnalyzer analyzer) {
    final int[] cost = new int[1];
    magic.accept(
        new IMagicVisitor() {
          public void visitCharm(ICharm charm) {
            cost[0] = getCharmCosts(charm, analyzer);
          }

          public void visitSpell(ISpell spell) {
            cost[0] = getSpellCosts(analyzer);
          }
        });
    return cost[0];
  }