Fix issue with level cap by using max integer

pull/16/head
Flashfyre 2024-02-29 16:41:14 -05:00
parent ff802d162b
commit 8d314b199f
3 changed files with 5 additions and 3 deletions

View File

@ -1126,7 +1126,9 @@ export default class BattleScene extends Phaser.Scene {
this.ui?.achvBar.setY((this.game.canvas.height / 6 + this.moneyText.y + 15)); this.ui?.achvBar.setY((this.game.canvas.height / 6 + this.moneyText.y + 15));
} }
getMaxExpLevel(): integer { getMaxExpLevel(ignoreLevelCap?: boolean): integer {
if (ignoreLevelCap)
return Number.MAX_SAFE_INTEGER;
const lastWaveIndex = Math.ceil((this.currentBattle?.waveIndex || 1) / 10) * 10; const lastWaveIndex = Math.ceil((this.currentBattle?.waveIndex || 1) / 10) * 10;
const baseLevel = (1 + lastWaveIndex / 2 + Math.pow(lastWaveIndex / 25, 2)) * 1.2; const baseLevel = (1 + lastWaveIndex / 2 + Math.pow(lastWaveIndex / 25, 2)) * 1.2;
return Math.ceil(baseLevel / 2) * 2 + 2; return Math.ceil(baseLevel / 2) * 2 + 2;

View File

@ -1080,7 +1080,7 @@ export class PokemonLevelIncrementModifier extends ConsumablePokemonModifier {
pokemon.scene.applyModifiers(LevelIncrementBoosterModifier, true, levelCount); pokemon.scene.applyModifiers(LevelIncrementBoosterModifier, true, levelCount);
pokemon.level += levelCount.value; 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.exp = getLevelTotalExp(pokemon.level, pokemon.species.growthRate);
pokemon.levelExp = 0; pokemon.levelExp = 0;
} }

View File

@ -378,7 +378,7 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
const relLevelExp = getLevelRelExp(this.lastLevel + 1, pokemon.species.growthRate); const relLevelExp = getLevelRelExp(this.lastLevel + 1, pokemon.species.growthRate);
const levelExp = levelUp ? relLevelExp : pokemon.levelExp; const levelExp = levelUp ? relLevelExp : pokemon.levelExp;
let ratio = relLevelExp ? levelExp / relLevelExp : 0; 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) if (levelUp)
ratio = 1; ratio = 1;
else else