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

Method getPrevious

code/src/java/pcgen/cdom/content/HitDie.java:122–145  ·  view source on GitHub ↗

Returns the previous (i.e. next smaller) HitDie in the globally defined sequence of Hit Dice. The behavior of this method is not defined if the HitDie on which this method is called is not in the globally defined sequence of Hit Dice. If this is the smallest HitDie in the globally defined sequence

()

Source from the content-addressed store, hash-verified

120 * @return the previous HitDie in the globally defined sequence of Hit Dice.
121 */
122 public HitDie getPrevious()
123 {
124 int[] dieSizes = SettingsHandler.getGameAsProperty().get().getDieSizes();
125 int length = dieSizes.length;
126 for (int i = 0; i < length; ++i)
127 {
128 if (die == dieSizes[i])
129 {
130 if (i == 0)
131 {
132 if (Logging.isDebugMode())
133 {
134 Logging.debugPrint("Hit Die: " + die + " is Lowest Hit Die in Die Sizes");
135 }
136 }
137 else
138 {
139 return new HitDie(dieSizes[i - 1]);
140 }
141 }
142 }
143 Logging.errorPrint("Cannot find Hit Die: " + die + " in Global Die Sizes");
144 return this;
145 }
146
147 @Override
148 public int hashCode()

Callers 1

applyProcessorMethod · 0.95

Calls 6

getGameAsPropertyMethod · 0.95
isDebugModeMethod · 0.95
debugPrintMethod · 0.95
errorPrintMethod · 0.95
getDieSizesMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected