| 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. |