Fix summary next level EXP showing incorrectly

pull/1/head
Flashfyre 2023-04-28 19:56:11 -04:00
parent 2b95d4ce51
commit 16fbe971f6
2 changed files with 5 additions and 2 deletions

View File

@ -17,7 +17,7 @@ const expLevels = [
]; ];
export function getLevelTotalExp(level: integer, growthRate: integer) { export function getLevelTotalExp(level: integer, growthRate: integer) {
return expLevels[growthRate][level - 1]; return expLevels[growthRate][Math.min(level, 100) - 1];
}; };
export function getLevelRelExp(level: integer, growthRate: integer) { export function getLevelRelExp(level: integer, growthRate: integer) {

View File

@ -496,7 +496,10 @@ export default class SummaryUiHandler extends UiHandler {
expText.setOrigin(1, 0); expText.setOrigin(1, 0);
statsContainer.add(expText); statsContainer.add(expText);
const nextLvExpText = addTextObject(this.scene, 208, 128, (totalLvExp - this.pokemon.levelExp).toString(), TextStyle.WINDOW); const nextLvExp = this.pokemon.level < 100
? getLevelTotalExp(this.pokemon.level + 1, this.pokemon.species.growthRate) - this.pokemon.levelExp
: 0;
const nextLvExpText = addTextObject(this.scene, 208, 128, nextLvExp.toString(), TextStyle.WINDOW);
nextLvExpText.setOrigin(1, 0); nextLvExpText.setOrigin(1, 0);
statsContainer.add(nextLvExpText); statsContainer.add(nextLvExpText);