MCPcopy Index your code
hub / github.com/PCGen/pcgen / FollowerOption

Class FollowerOption

code/src/java/pcgen/core/FollowerOption.java:38–150  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

36 * when selecting a follower of this type. Prereqs can also be specified
37 */
38public 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected