An AbilitySelector represents an Ability to be applied from an AbilitySelection. This is for use in a case like AUTO:FEAT|%LIST where the Category and Nature are known by the token, and the Ability and Selection are known by CHOOSE
| 38 | * are known by the token, and the Ability and Selection are known by CHOOSE |
| 39 | */ |
| 40 | public class AbilitySelector extends ConcretePrereqObject |
| 41 | implements QualifyingObject, ChooseSelectionActor<AbilitySelection> |
| 42 | { |
| 43 | |
| 44 | private final String source; |
| 45 | |
| 46 | private final CDOMSingleRef<AbilityCategory> category; |
| 47 | |
| 48 | /** |
| 49 | * The Nature of the Ability as it should be applied to a PlayerCharacter |
| 50 | */ |
| 51 | private final Nature nature; |
| 52 | |
| 53 | /** |
| 54 | * Creates a new AbilitySelection for the given Ability. The given Ability |
| 55 | * must be a MULT:NO Ability or this constructor will throw an exception. |
| 56 | * |
| 57 | * @param token |
| 58 | * The Ability which this AbilitySelection will contain |
| 59 | * @param cat |
| 60 | * The Ability category which this AbilitySelection will contain |
| 61 | * @param nat |
| 62 | * The Nature of the given Ability as it should be applied to a |
| 63 | * PlayerCharacter |
| 64 | */ |
| 65 | public AbilitySelector(String token, CDOMSingleRef<AbilityCategory> cat, Nature nat) |
| 66 | { |
| 67 | category = cat; |
| 68 | nature = nat; |
| 69 | source = token; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Returns the Category for the Ability in this AbilitySelection. |
| 74 | * |
| 75 | * @return The Category for the Ability in this AbilitySelection. |
| 76 | */ |
| 77 | public CDOMSingleRef<AbilityCategory> getAbilityCategory() |
| 78 | { |
| 79 | return category; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Returns the Nature of the Ability as it should be applied to a |
| 84 | * PlayerCharacter |
| 85 | * |
| 86 | * @return The Nature of the Ability as it should be applied to a |
| 87 | * PlayerCharacter |
| 88 | */ |
| 89 | public Nature getNature() |
| 90 | { |
| 91 | return nature; |
| 92 | } |
| 93 | |
| 94 | @Override |
| 95 | public void applyChoice(ChooseDriver obj, AbilitySelection as, PlayerCharacter pc) |
| 96 | { |
| 97 | CNAbility cna = CNAbilityFactory.getCNAbility(category.get(), nature, as.getObject()); |
nothing calls this directly
no outgoing calls
no test coverage detected