From 4261ab37ab17b105beb1e4556fb4dd9c0424ad87 Mon Sep 17 00:00:00 2001 From: schmidtc1 <62030095+schmidtc1@users.noreply.github.com> Date: Mon, 15 Jul 2024 13:13:04 -0400 Subject: [PATCH] [BUG] Fixes bug with Metronome freezing the game (#2819) * Tests MovePhase with new PokemonMove instead of moveset search * Accounts for metronome call on charging moves * Update comment in ChargeAttr to be clearer --- src/data/move.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/data/move.ts b/src/data/move.ts index ee346e44167..d977d60499e 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -2280,7 +2280,11 @@ export class ChargeAttr extends OverrideMoveEffectAttr { user.pushMoveHistory({ move: move.id, targets: [ target.getBattlerIndex() ], result: MoveResult.OTHER }); user.getMoveQueue().push({ move: move.id, targets: [ target.getBattlerIndex() ], ignorePP: true }); if (this.sameTurn) { - user.scene.pushMovePhase(new MovePhase(user.scene, user, [ target.getBattlerIndex() ], user.moveset.find(m => m.moveId === move.id), true), this.followUpPriority); + let movesetMove = user.moveset.find(m => m.moveId === move.id); + if (!movesetMove) { // account for any move that calls a ChargeAttr move when the ChargeAttr move does not exist in moveset + movesetMove = new PokemonMove(move.id, 0, 0, true); + } + user.scene.pushMovePhase(new MovePhase(user.scene, user, [ target.getBattlerIndex() ], movesetMove, true), this.followUpPriority); } user.addTag(BattlerTagType.CHARGING, 1, move.id, user.id); resolve(true);