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

Method addLevel

code/src/java/pcgen/core/PCClass.java:832–1059  ·  view source on GitHub ↗
(final boolean argLevelMax, final boolean bSilent, final PlayerCharacter aPC,
		final boolean ignorePrereqs)

Source from the content-addressed store, hash-verified

830 * information into PCLevelInfo and PlayerCharacter.
831 */
832 public boolean addLevel(final boolean argLevelMax, final boolean bSilent, final PlayerCharacter aPC,
833 final boolean ignorePrereqs)
834 {
835
836 // Check to see if we can add a level of this class to the
837 // current character
838 final int newLevel = aPC.getLevel(this) + 1;
839 boolean levelMax = argLevelMax;
840
841 aPC.setAllowInteraction(false);
842 aPC.setLevelWithoutConsequence(this, newLevel);
843 if (!ignorePrereqs)
844 {
845 // When loading a character, classes are added before feats, so
846 // this test would always fail on loading if feats are required
847 boolean doReturn = false;
848 if (!qualifies(aPC, this))
849 {
850 doReturn = true;
851 if (!bSilent)
852 {
853 ShowMessageDelegate.showMessageDialog("This character does not qualify for level " + newLevel,
854 Constants.APPLICATION_NAME, MessageType.ERROR);
855 }
856 }
857 aPC.setLevelWithoutConsequence(this, newLevel - 1);
858 if (doReturn)
859 {
860 return false;
861 }
862 }
863 aPC.setAllowInteraction(true);
864
865 if (isMonster())
866 {
867 levelMax = false;
868 }
869
870 if (hasMaxLevel() && (newLevel > getSafe(IntegerKey.LEVEL_LIMIT)) && levelMax)
871 {
872 if (!bSilent)
873 {
874 ShowMessageDelegate.showMessageDialog(
875 "This class cannot be raised above level " + Integer.toString(getSafe(IntegerKey.LEVEL_LIMIT)),
876 Constants.APPLICATION_NAME, MessageType.ERROR);
877 }
878
879 return false;
880 }
881
882 // Add the level to the current character
883 int total = aPC.getTotalLevels();
884
885 // No longer need this since the race now sets a bonus itself and Templates
886 // are not able to reassign their feats. There was nothing else returned in
887 // this number
888 // if (total == 0) {
889 // aPC.setFeats(aPC.getInitialFeats());

Callers 2

incrementClassLevelMethod · 0.95
parseClassLineMethod · 0.95

Calls 15

qualifiesMethod · 0.95
showMessageDialogMethod · 0.95
isMonsterMethod · 0.95
hasMaxLevelMethod · 0.95
setLevelMethod · 0.95
getUseGUIMethod · 0.95
addDomainsUpToLevelMethod · 0.95
getLevelCountMethod · 0.95
getBonusStatsForLevelMethod · 0.95
askForStatIncreaseMethod · 0.95

Tested by

no test coverage detected