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

Method setLevel

code/src/java/pcgen/core/PCClass.java:400–437  ·  view source on GitHub ↗
(final int newLevel, final PlayerCharacter aPC)

Source from the content-addressed store, hash-verified

398 }
399
400 public void setLevel(final int newLevel, final PlayerCharacter aPC)
401 {
402 final int curLevel = aPC.getLevel(this);
403
404 if (newLevel >= 0)
405 {
406 aPC.setLevelWithoutConsequence(this, newLevel);
407 }
408
409 if (newLevel == 1)
410 {
411 if (newLevel > curLevel || aPC.isImporting())
412 {
413 addFeatPoolBonus(aPC);
414 }
415 }
416
417 if (!aPC.isImporting())
418 {
419 aPC.calcActiveBonuses();
420 //Need to do this again if caching is re-integrated
421 //aPC.getSpellTracker().buildSpellLevelMap(newLevel);
422 }
423
424 if ((newLevel == 1) && !aPC.isImporting() && (curLevel == 0))
425 {
426 SubClassApplication.checkForSubClass(aPC, this);
427 aPC.setSpellLists(this);
428 }
429
430 if (!aPC.isImporting() && (curLevel < newLevel))
431 {
432 SubstitutionClassApplication.checkForSubstitutionClass(this, newLevel, aPC);
433 }
434
435 aPC.getClassSet()
436 .forEach(aPC::calculateKnownSpellsForClassLevel);
437 }
438
439 /**
440 * Add the bonus to the character's feat pool that is granted by the class.

Callers 15

makeIntoExClassMethod · 0.95
addLevelMethod · 0.95
subLevelMethod · 0.95
testPCClassSetEventMethod · 0.45
testPCClassAddMultGetMethod · 0.45
testPCClassRemoveAllMethod · 0.45

Calls 10

addFeatPoolBonusMethod · 0.95
checkForSubClassMethod · 0.95
isImportingMethod · 0.80
calcActiveBonusesMethod · 0.80
setSpellListsMethod · 0.80
forEachMethod · 0.80
getLevelMethod · 0.45
getClassSetMethod · 0.45