@Override public void removeChoice(PlayerCharacter pc, CDOMObject owner, T choice) { pc.removeAssoc(owner, getListKey(), choice); pc.removeAssociation(owner, encodeChoice(choice)); List<ChooseSelectionActor<?>> actors = owner.getListFor(ListKey.NEW_CHOOSE_ACTOR); if (actors != null) { for (ChooseSelectionActor ca : actors) { ca.removeChoice(owner, choice, pc); } } }
@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)); }