Fix negative EXP level cap bug
This commit is contained in:
parent
f831f3ab75
commit
989e4b37f4
|
@ -791,7 +791,9 @@ export default class BattleScene extends Phaser.Scene {
|
|||
this.partyExpBar.setY(this.moneyText.y + 15);
|
||||
}
|
||||
|
||||
getMaxExpLevel(): integer {
|
||||
getMaxExpLevel(ignoreLevelCap?: boolean): integer {
|
||||
if (ignoreLevelCap)
|
||||
return 10000;
|
||||
const lastWaveIndex = Math.ceil((this.currentBattle?.waveIndex || 1) / 10) * 10;
|
||||
const baseLevel = (1 + lastWaveIndex / 2 + Math.pow(lastWaveIndex / 25, 2)) * 1.2;
|
||||
return Math.min(Math.ceil(baseLevel / 2) * 2 + 2, 10000);
|
||||
|
|
|
@ -832,7 +832,7 @@ export class PokemonLevelIncrementModifier extends ConsumablePokemonModifier {
|
|||
pokemon.scene.applyModifiers(LevelIncrementBoosterModifier, true, levelCount);
|
||||
|
||||
pokemon.level += levelCount.value;
|
||||
if (pokemon.level <= pokemon.scene.getMaxExpLevel()) {
|
||||
if (pokemon.level <= pokemon.scene.getMaxExpLevel(true)) {
|
||||
pokemon.exp = getLevelTotalExp(pokemon.level, pokemon.species.growthRate);
|
||||
pokemon.levelExp = 0;
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
|
|||
const relLevelExp = getLevelRelExp(this.lastLevel + 1, battler.species.growthRate);
|
||||
const levelExp = levelUp ? relLevelExp : battler.levelExp;
|
||||
let ratio = relLevelExp ? levelExp / relLevelExp : 0;
|
||||
if (this.lastLevel >= (this.scene as BattleScene).getMaxExpLevel()) {
|
||||
if (this.lastLevel >= (this.scene as BattleScene).getMaxExpLevel(true)) {
|
||||
if (levelUp)
|
||||
ratio = 1;
|
||||
else
|
||||
|
|
|
@ -538,7 +538,7 @@ export default class SummaryUiHandler extends UiHandler {
|
|||
statsContainer.add(expText);
|
||||
|
||||
const nextLvExp = this.pokemon.level < this.scene.getMaxExpLevel()
|
||||
? getLevelTotalExp(this.pokemon.level + 1, this.pokemon.species.growthRate) - this.pokemon.levelExp
|
||||
? getLevelTotalExp(this.pokemon.level + 1, this.pokemon.species.growthRate) - this.pokemon.exp
|
||||
: 0;
|
||||
const nextLvExpText = addTextObject(this.scene, 208, 128, nextLvExp.toString(), TextStyle.WINDOW);
|
||||
nextLvExpText.setOrigin(1, 0);
|
||||
|
|
Loading…
Reference in New Issue