Returns the HitDie for the given PCClass and level in the Player Character identified by the given CharID. @param id The CharID identifying the Player Character for which the HitDie of the given PCClass and level will be returned @param pcClass The PCClass for which
(CharID id, PCClass pcClass, int classLevel)
| 174 | * Character identified by the given CharID |
| 175 | */ |
| 176 | public HitDie getLevelHitDie(CharID id, PCClass pcClass, int classLevel) |
| 177 | { |
| 178 | // Class Base Hit Die |
| 179 | HitDie currDie = pcClass.getSafe(ObjectKey.LEVEL_HITDIE); |
| 180 | Processor<HitDie> dieLock = raceFacet.get(id).get(ObjectKey.HITDIE); |
| 181 | if (dieLock != null) |
| 182 | { |
| 183 | currDie = dieLock.applyProcessor(currDie, pcClass); |
| 184 | } |
| 185 | |
| 186 | // Templates |
| 187 | for (PCTemplate template : templateFacet.getSet(id)) |
| 188 | { |
| 189 | if (template != null) |
| 190 | { |
| 191 | Processor<HitDie> lock = template.get(ObjectKey.HITDIE); |
| 192 | if (lock != null) |
| 193 | { |
| 194 | currDie = lock.applyProcessor(currDie, pcClass); |
| 195 | } |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | // Levels |
| 200 | PCClassLevel cl = classFacet.getClassLevel(id, pcClass, classLevel); |
| 201 | if (cl != null) |
| 202 | { |
| 203 | if (cl.get(ObjectKey.DONTADD_HITDIE) != null) |
| 204 | { |
| 205 | currDie = HitDie.ZERO; //null; |
| 206 | } |
| 207 | else |
| 208 | { |
| 209 | Processor<HitDie> lock = cl.get(ObjectKey.HITDIE); |
| 210 | if (lock != null) |
| 211 | { |
| 212 | currDie = lock.applyProcessor(currDie, pcClass); |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | return currDie; |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * Rolls the hit points for a given PCClass and level. |
no test coverage detected