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

Method getBonusFeatPool

code/src/java/pcgen/core/PlayerCharacter.java:1161–1206  ·  view source on GitHub ↗

Get a number that represents the number of feats added to this character by BONUS statements. @return the number of feats added by bonus statements

()

Source from the content-addressed store, hash-verified

1159 * @return the number of feats added by bonus statements
1160 */
1161 private double getBonusFeatPool()
1162 {
1163 String aString = Globals.getBonusFeatString();
1164
1165 final StringTokenizer aTok = new StringTokenizer(aString, Constants.PIPE, false);
1166 final int startLevel = Integer.parseInt(aTok.nextToken());
1167 final int rangeLevel = Integer.parseInt(aTok.nextToken());
1168
1169 double pool = getTotalBonusTo("FEAT", "POOL");
1170 double pcpool = getTotalBonusTo("FEAT", "PCPOOL");
1171 double mpool = getTotalBonusTo("FEAT", "MONSTERPOOL");
1172 double bonus = getTotalBonusTo("ABILITYPOOL", "FEAT");
1173 double classLvlBonus = getNumFeatsFromLevels();
1174
1175 if (Logging.isDebugMode())
1176 {
1177 Logging.debugPrint(""); //$NON-NLS-1$
1178 Logging.debugPrint("=============="); //$NON-NLS-1$
1179 Logging.debugPrint("level " + this.totalNonMonsterLevels()); //$NON-NLS-1$
1180
1181 Logging.debugPrint("POOL: " + pool); //$NON-NLS-1$
1182 Logging.debugPrint("PCPOOL: " + pcpool); //$NON-NLS-1$
1183 Logging.debugPrint("MPOOL: " + mpool); //$NON-NLS-1$
1184 Logging.debugPrint("APOOL: " + bonus); //$NON-NLS-1$
1185 Logging.debugPrint("LVLBONUS: " + classLvlBonus); //$NON-NLS-1$
1186 }
1187
1188 double startAdjust = rangeLevel == 0 ? 0 : startLevel / rangeLevel;
1189
1190 double nonMonsterAdjustment = this.totalNonMonsterLevels() >= startLevel ? 1.0d + pcpool - startAdjust : pcpool;
1191
1192 pool += CoreUtility.epsilonFloor(nonMonsterAdjustment);
1193 pool += CoreUtility.epsilonFloor(mpool);
1194 pool += CoreUtility.epsilonFloor(bonus);
1195 pool += CoreUtility.epsilonFloor(classLvlBonus);
1196
1197 if (Logging.isDebugMode())
1198 {
1199 Logging.debugPrint(""); //$NON-NLS-1$
1200 Logging.debugPrint("Total Bonus: " + pool); //$NON-NLS-1$
1201 Logging.debugPrint("=============="); //$NON-NLS-1$
1202 Logging.debugPrint(""); //$NON-NLS-1$
1203 }
1204
1205 return pool;
1206 }
1207
1208 /**
1209 * Calculates the number of feats that should be granted as a result of LEVELPERFEAT

Callers 1

getTotalAbilityPoolMethod · 0.95

Calls 9

getBonusFeatStringMethod · 0.95
getTotalBonusToMethod · 0.95
getNumFeatsFromLevelsMethod · 0.95
isDebugModeMethod · 0.95
debugPrintMethod · 0.95
totalNonMonsterLevelsMethod · 0.95
epsilonFloorMethod · 0.95
parseIntMethod · 0.80
nextTokenMethod · 0.80

Tested by

no test coverage detected