(final PlayerCharacter aPC)
| 1085 | } |
| 1086 | |
| 1087 | void subLevel(final PlayerCharacter aPC) |
| 1088 | { |
| 1089 | |
| 1090 | if (aPC != null) |
| 1091 | { |
| 1092 | int total = aPC.getTotalLevels(); |
| 1093 | |
| 1094 | int oldLevel = aPC.getLevel(this); |
| 1095 | int spMod = 0; |
| 1096 | final PCLevelInfo pcl = aPC.getLevelInfoFor(getKeyName(), oldLevel); |
| 1097 | |
| 1098 | if (pcl != null) |
| 1099 | { |
| 1100 | spMod = pcl.getSkillPointsGained(aPC); |
| 1101 | } |
| 1102 | else |
| 1103 | { |
| 1104 | Logging.errorPrint("ERROR: could not find class/level info for " + getDisplayName() + "/" + oldLevel); |
| 1105 | } |
| 1106 | |
| 1107 | final int newLevel = oldLevel - 1; |
| 1108 | |
| 1109 | if (oldLevel > 0) |
| 1110 | { |
| 1111 | PCClassLevel classLevel = aPC.getActiveClassLevel(this, oldLevel - 1); |
| 1112 | aPC.removeHP(classLevel); |
| 1113 | } |
| 1114 | |
| 1115 | // aPC.adjustFeats(-aPC.getBonusFeatsForNewLevel(this)); |
| 1116 | setLevel(newLevel, aPC); |
| 1117 | aPC.removeKnownSpellsForClassLevel(this); |
| 1118 | |
| 1119 | doMinusLevelMods(aPC, newLevel + 1); |
| 1120 | |
| 1121 | DomainApplication.removeDomainsForLevel(this, newLevel + 1, aPC); |
| 1122 | |
| 1123 | if (newLevel == 0) |
| 1124 | { |
| 1125 | SubClassApplication.setSubClassKey(aPC, this, Constants.NONE); |
| 1126 | |
| 1127 | // |
| 1128 | // Remove all skills associated with this class |
| 1129 | // |
| 1130 | for (Skill skill : aPC.getSkillSet()) |
| 1131 | { |
| 1132 | SkillRankControl.setZeroRanks(this, aPC, skill); |
| 1133 | } |
| 1134 | |
| 1135 | Integer currentPool = aPC.getSkillPool(this); |
| 1136 | spMod = currentPool == null ? 0 : currentPool; |
| 1137 | } |
| 1138 | |
| 1139 | if (!isMonster() && (total > aPC.getTotalLevels())) |
| 1140 | { |
| 1141 | total = aPC.getTotalLevels(); |
| 1142 | |
| 1143 | // Roll back any stat changes that were made as part of the |
| 1144 | // level |
no test coverage detected