From 59767c76071e70a04076a44cb746494c1c1a0faa Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 19 Oct 2023 22:54:19 -0400 Subject: [PATCH] Attempt fixing crash when getting EXP value --- src/battle-phases.ts | 4 +++- src/pokemon.ts | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 914c6de2d..c7f04ee70 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -2007,9 +2007,11 @@ export class VictoryPhase extends PokemonPhase { const expShareModifier = this.scene.findModifier(m => m instanceof ExpShareModifier) as ExpShareModifier; const expBalanceModifier = this.scene.findModifier(m => m instanceof ExpBalanceModifier) as ExpBalanceModifier; const multipleParticipantExpBonusModifier = this.scene.findModifier(m => m instanceof MultipleParticipantExpBonusModifier) as MultipleParticipantExpBonusModifier; - const expValue = this.getPokemon().getExpValue(); const expPartyMembers = party.filter(p => p.hp && p.level < this.scene.getMaxExpLevel()); const partyMemberExp = []; + let expValue = this.getPokemon().getExpValue(); + if (this.scene.currentBattle.battleType === BattleType.TRAINER) + expValue = Math.floor(expValue * 1.5); for (let partyMember of expPartyMembers) { const pId = partyMember.id; const participated = participantIds.has(pId); diff --git a/src/pokemon.ts b/src/pokemon.ts index 102cd5189..c749e4bff 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -990,10 +990,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { getExpValue(): integer { // Logic to factor in victor level has been removed for balancing purposes, so the player doesn't have to focus on EXP maxxing - let ret = ((this.getSpeciesForm().baseExp * this.level) / 5 + 1); - if (this.scene.currentBattle.battleType === BattleType.TRAINER) - ret = Math.floor(ret * 1.5); - return ret; + return ((this.getSpeciesForm().baseExp * this.level) / 5 + 1); } setFrameRate(frameRate: integer) {