From c5eb86b0b15305d9defde420c8d57259b0f480ea Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sun, 21 Jan 2024 16:30:06 -0500 Subject: [PATCH] Fix crash with stat change after Pokemon is recalled --- src/battle-phases.ts | 2 +- src/data/move.ts | 2 +- src/data/pokemon-species.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 515320e69..54e82b2a6 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -2151,7 +2151,7 @@ export class StatChangePhase extends PokemonPhase { start() { const pokemon = this.getPokemon(); - if (pokemon.isFainted()) + if (!pokemon.isActive(true)) return this.end(); const allStats = Utils.getEnumValues(BattleStat); diff --git a/src/data/move.ts b/src/data/move.ts index def9f6344..902c84d84 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1601,7 +1601,7 @@ export class ProtectAttr extends AddBattlerTagAttr { let timesUsed = 0; const moveHistory = user.getLastXMoves(); let turnMove: TurnMove; - while (moveHistory.length && allMoves[(turnMove = moveHistory.shift()).move].getAttrs(ProtectAttr).find(pa => (pa as ProtectAttr).tagType === this.tagType) && turnMove.result === MoveResult.SUCCESS) + while (moveHistory.length && allMoves[(turnMove = moveHistory.shift()).move].getAttrs(ProtectAttr).find(pa => (pa as ProtectAttr).tagType === this.tagType)) timesUsed++; if (timesUsed) return !user.randSeedInt(Math.pow(2, timesUsed)); diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index 534ba555c..0f89bb765 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -2413,7 +2413,7 @@ export const speciesStarters = { [Species.SPIRITOMB]: 5, [Species.GIBLE]: 4, [Species.MUNCHLAX]: 4, - [Species.RIOLU]: 5, + [Species.RIOLU]: 4, [Species.HIPPOPOTAS]: 3, [Species.SKORUPI]: 3, [Species.CROAGUNK]: 3,