From 16fbe971f62f5c05b780a7af5402d8407b7c8b43 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 28 Apr 2023 19:56:11 -0400 Subject: [PATCH] Fix summary next level EXP showing incorrectly --- src/data/exp.ts | 2 +- src/ui/summary-ui-handler.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/data/exp.ts b/src/data/exp.ts index ae11a2a0a..f558f19fe 100644 --- a/src/data/exp.ts +++ b/src/data/exp.ts @@ -17,7 +17,7 @@ const expLevels = [ ]; 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) { diff --git a/src/ui/summary-ui-handler.ts b/src/ui/summary-ui-handler.ts index 949c7dbe5..462ee172d 100644 --- a/src/ui/summary-ui-handler.ts +++ b/src/ui/summary-ui-handler.ts @@ -496,7 +496,10 @@ export default class SummaryUiHandler extends UiHandler { expText.setOrigin(1, 0); 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); statsContainer.add(nextLvExpText);