(PlayerCharacter currentPC, PCGParser parser)
| 274 | * ############################################################### |
| 275 | */ |
| 276 | private void sanityChecks(PlayerCharacter currentPC, PCGParser parser) |
| 277 | { |
| 278 | // Hit point sanity check |
| 279 | boolean fixMade = false; |
| 280 | |
| 281 | resolveDuplicateEquipmentSets(currentPC); |
| 282 | |
| 283 | // First make sure the "working" equipment list |
| 284 | // is in effect for all the bonuses it may add |
| 285 | currentPC.setCalcEquipmentList(); |
| 286 | |
| 287 | // make sure the bonuses from companions are applied |
| 288 | currentPC.setCalcFollowerBonus(); |
| 289 | |
| 290 | // pre-calculate all the bonuses |
| 291 | currentPC.calcActiveBonuses(); |
| 292 | |
| 293 | final int oldHp = currentPC.hitPoints(); |
| 294 | |
| 295 | // Recalc the feat pool if required |
| 296 | if (parser.isCalcFeatPoolAfterLoad()) |
| 297 | { |
| 298 | double baseFeatPool = parser.getBaseFeatPool(); |
| 299 | double featPoolBonus = currentPC.getRemainingFeatPoints(true); |
| 300 | baseFeatPool -= featPoolBonus; |
| 301 | currentPC.setUserPoolBonus(AbilityCategory.FEAT, new BigDecimal(String.valueOf(baseFeatPool))); |
| 302 | } |
| 303 | |
| 304 | for (CNAbility aFeat : currentPC.getPoolAbilities(AbilityCategory.FEAT, Nature.NORMAL)) |
| 305 | { |
| 306 | if (aFeat.getAbility().getSafe(ObjectKey.MULTIPLE_ALLOWED) && !currentPC.hasAssociations(aFeat)) |
| 307 | { |
| 308 | warnings.add("Multiple selection feat found with no selections (" + aFeat.getAbility().getDisplayName() |
| 309 | + "). Correct on Feat tab."); |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | // Get templates - give it the biggest HD |
| 314 | // sk4p 11 Dec 2002 |
| 315 | |
| 316 | //PCTemplate aTemplate = null; |
| 317 | if (currentPC.hasClass()) |
| 318 | { |
| 319 | for (PCClass pcClass : currentPC.getClassSet()) |
| 320 | { |
| 321 | // Ignore if no levels |
| 322 | if (currentPC.getLevel(pcClass) < 1) |
| 323 | { |
| 324 | continue; |
| 325 | } |
| 326 | |
| 327 | // Walk through the levels for this class |
| 328 | |
| 329 | for (int i = 1; i <= currentPC.getLevel(pcClass); i++) |
| 330 | { |
| 331 | int baseSides = currentPC.getLevelHitDie(pcClass, i).getDie(); |
| 332 | //TODO i-1 is strange see CODE-1925 |
| 333 | PCClassLevel pcl = currentPC.getActiveClassLevel(pcClass, i - 1); |
no test coverage detected