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

Method addFeatPoolBonus

code/src/java/pcgen/core/PCClass.java:446–475  ·  view source on GitHub ↗

Add the bonus to the character's feat pool that is granted by the class. NB: LEVELSPERFEAT is now handled via PLayerCHaracter.getNumFeatsFromLevels() rather than bonuses. Only the standard feat progression for the gamemode is handled here. @param aPC The character to bonus.

(final PlayerCharacter aPC)

Source from the content-addressed store, hash-verified

444 * @param aPC The character to bonus.
445 */
446 void addFeatPoolBonus(final PlayerCharacter aPC)
447 {
448 Integer mLevPerFeat = get(IntegerKey.LEVELS_PER_FEAT);
449 int startLevel;
450 int rangeLevel;
451 int divisor;
452 if (mLevPerFeat == null)
453 {
454 String aString = Globals.getBonusFeatString();
455 StringTokenizer aTok = new StringTokenizer(aString, "|", false);
456 startLevel = Integer.parseInt(aTok.nextToken());
457 rangeLevel = Integer.parseInt(aTok.nextToken());
458 divisor = rangeLevel;
459 if (divisor > 0)
460 {
461 StringBuilder aBuf = new StringBuilder("FEAT|PCPOOL|").append("max(CL");
462 // Make sure we only take off the startlevel value once
463 if (this == aPC.getClassKeyed(aPC.getLevelInfoClassKeyName(0)))
464 {
465 aBuf.append("-").append(startLevel);
466 aBuf.append("+").append(rangeLevel);
467 }
468 aBuf.append(",0)/").append(divisor);
469 // Logging.debugPrint("Feat bonus for " + this + " is "
470 // + aBuf.toString());
471 BonusObj bon = Bonus.newBonus(Globals.getContext(), aBuf.toString());
472 aPC.addBonus(bon, this);
473 }
474 }
475 }
476
477 /*
478 * FINALPCCLASSANDLEVEL This is required in PCClassLevel and should be present in

Callers 2

setLevelMethod · 0.95
cloneMethod · 0.80

Calls 11

getBonusFeatStringMethod · 0.95
newBonusMethod · 0.95
getContextMethod · 0.95
parseIntMethod · 0.80
nextTokenMethod · 0.80
getMethod · 0.65
toStringMethod · 0.65
appendMethod · 0.45
getClassKeyedMethod · 0.45
addBonusMethod · 0.45

Tested by

no test coverage detected