MCPcopy Create free account
hub / github.com/PCGen/pcgen / BaseSizeToken

Class BaseSizeToken

code/src/java/plugin/primitive/race/BaseSizeToken.java:38–112  ·  view source on GitHub ↗

BaseSizeToken is a Primitive that filters based on the base SizeAdjustment of a Race.

Source from the content-addressed store, hash-verified

36 * BaseSizeToken is a Primitive that filters based on the base SizeAdjustment of a Race.
37 */
38public class BaseSizeToken implements PrimitiveToken<Race>, PrimitiveFilter<Race>
39{
40 private static final Class<Race> RACE_CLASS = Race.class;
41 private CDOMSingleRef<SizeAdjustment> size;
42 private CDOMReference<Race> allRaces;
43
44 @Override
45 public boolean initialize(LoadContext context, Class<Race> cl, String value, String args)
46 {
47 if (args != null)
48 {
49 return false;
50 }
51 size = context.getReferenceContext().getCDOMReference(SizeAdjustment.class, value);
52 allRaces = context.getReferenceContext().getCDOMAllReference(RACE_CLASS);
53 return true;
54 }
55
56 @Override
57 public String getTokenName()
58 {
59 return "BASESIZE";
60 }
61
62 @Override
63 public Class<Race> getReferenceClass()
64 {
65 return RACE_CLASS;
66 }
67
68 @Override
69 public String getLSTformat(boolean useAny)
70 {
71 return getTokenName() + '=' + size.getLSTformat(false);
72 }
73
74 @Override
75 public boolean allow(PlayerCharacter pc, Race race)
76 {
77 Formula raceSize = race.get(FormulaKey.SIZE);
78 return size.get().getKeyName().equals(raceSize.toString());
79 }
80
81 @Override
82 public GroupingState getGroupingState()
83 {
84 return GroupingState.ANY;
85 }
86
87 @Override
88 public boolean equals(Object obj)
89 {
90 if (obj == this)
91 {
92 return true;
93 }
94 if (obj instanceof BaseSizeToken other)
95 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected