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
()
| 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() |
no test coverage detected