This class represents a possible choice for a follower. This is basically a Race with a "FOLLOWERADJUSTMENT" that modifies the owner's effective level when selecting a follower of this type. Prereqs can also be specified
| 36 | * when selecting a follower of this type. Prereqs can also be specified |
| 37 | */ |
| 38 | public class FollowerOption extends ConcretePrereqObject implements Comparable<FollowerOption>, QualifyingObject |
| 39 | { |
| 40 | private int theAdjustment = 0; |
| 41 | private final CDOMReference<Race> ref; |
| 42 | private final CDOMSingleRef<CompanionList> list; |
| 43 | |
| 44 | public FollowerOption(CDOMReference<Race> race, CDOMSingleRef<CompanionList> listref) |
| 45 | { |
| 46 | Objects.requireNonNull(race, "Cannot have FollowerOption with null race"); |
| 47 | Objects.requireNonNull(listref, "Cannot have FollowerOption with null list reference"); |
| 48 | ref = race; |
| 49 | list = listref; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Returns the race associated with this option. If this option represents a |
| 54 | * group of races this method will return null. |
| 55 | * |
| 56 | * @return The Race associated or null |
| 57 | */ |
| 58 | public Race getRace() |
| 59 | { |
| 60 | Collection<Race> races = ref.getContainedObjects(); |
| 61 | return races.size() == 1 ? races.iterator().next() : null; |
| 62 | } |
| 63 | |
| 64 | public CDOMReference<Race> getRaceRef() |
| 65 | { |
| 66 | return ref; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Sets the variable adjustment for a master selecting this option. For |
| 71 | * example an adjustment of -3 would mean the master's level would be 3 |
| 72 | * lower for purposes of applying companion mods. |
| 73 | * |
| 74 | * @param anAdjustment |
| 75 | * Amount to modify the master's level by |
| 76 | */ |
| 77 | public void setAdjustment(final int anAdjustment) |
| 78 | { |
| 79 | theAdjustment = anAdjustment; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Returns the adjustment to the master's level for this option. |
| 84 | * |
| 85 | * @return The adjustment to the master's level |
| 86 | */ |
| 87 | public int getAdjustment() |
| 88 | { |
| 89 | return theAdjustment; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * This method is overridden to also check that a master has enough |
| 94 | * effective levels to have a positive level after applying any adjustment |
| 95 | * for this follower. For example, if a follower has an adjustment of -3 |
nothing calls this directly
no outgoing calls
no test coverage detected