Exemplo n.º 1
0
  @Override
  public void removeChoice(
      PlayerCharacter pc, CDOMObject owner, CategorizedAbilitySelection choice) {
    if (!pc.isImporting()) {
      pc.getSpellList();
    }

    // See if our choice is not auto or virtual
    Ability anAbility =
        pc.getMatchingAbility(AbilityCategory.FEAT, choice.getAbility(), Nature.NORMAL);

    if (anAbility != null) {
      pc.removeRealAbility(AbilityCategory.FEAT, anAbility);
      CDOMObjectUtilities.removeAdds(anAbility, pc);
      CDOMObjectUtilities.restoreRemovals(anAbility, pc);
      pc.adjustMoveRates();
    }
  }
Exemplo n.º 2
0
  @Override
  public void applyChoice(
      CDOMObject owner, CategorizedAbilitySelection choice, PlayerCharacter pc) {
    if (!pc.isImporting()) {
      pc.getSpellList();
    }

    // See if our choice is not auto or virtual
    Ability anAbility =
        pc.getMatchingAbility(AbilityCategory.FEAT, choice.getAbility(), Nature.NORMAL);

    if (anAbility != null) {
      // how many sub-choices to make
      double abilityCount =
          (pc.getSelectCorrectedAssociationCount(anAbility)
              * anAbility.getSafe(ObjectKey.SELECTION_COST).doubleValue());

      boolean result = false;
      // adjust the associated List
      if (anAbility.getSafe(ObjectKey.MULTIPLE_ALLOWED)) {
        pc.removeAssociation(anAbility, choice.getSelection());
        result = pc.hasAssociations(anAbility);
      }

      boolean removed = false;

      // if no sub choices made (i.e. all of them removed in Chooser box),
      // then remove the Feat
      if (!result) {
        removed = pc.removeRealAbility(AbilityCategory.FEAT, anAbility);
        CDOMObjectUtilities.removeAdds(anAbility, pc);
        CDOMObjectUtilities.restoreRemovals(anAbility, pc);
      }

      AbilityUtilities.adjustPool(anAbility, pc, false, abilityCount, removed);
      pc.adjustMoveRates();
    }
    double cost = choice.getAbility().getSafe(ObjectKey.SELECTION_COST).doubleValue();
    pc.adjustAbilities(AbilityCategory.FEAT, BigDecimal.valueOf(-cost));
  }