From 01b71395d564fee2fb2b04378ebf8eb59c4cff69 Mon Sep 17 00:00:00 2001 From: geeil-han Date: Thu, 17 Oct 2024 21:19:30 +0200 Subject: [PATCH] [P2 BUG] Implemented correct frenzy Tag and Movequeue reset should frenzy move fail (#4277) --- src/phases/move-phase.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/phases/move-phase.ts b/src/phases/move-phase.ts index d9564813c2d..09a440f3caf 100644 --- a/src/phases/move-phase.ts +++ b/src/phases/move-phase.ts @@ -412,7 +412,6 @@ export class MovePhase extends BattlePhase { * - Lapses `AFTER_MOVE` tags: * - This handles the effects of {@link Moves.SUBSTITUTE Substitute} * - Removes the second turn of charge moves - * - Calls frenzyMissFunc {@link frenzyMissFunc} should the move be cancelled * * TODO: handle charge moves more gracefully */ @@ -428,6 +427,21 @@ export class MovePhase extends BattlePhase { this.scene.eventTarget.dispatchEvent(new MoveUsedEvent(this.pokemon?.id, this.move.getMove(), ppUsed)); } + if (this.cancelled) { + const moves = this.pokemon.getMoveQueue()[0]; + const tags = this.pokemon.summonData.tags; + const tag = tags.find(t => t.tagType === BattlerTagType.FRENZY); + if (tag) { + //remove BattlerTags + tag.onRemove(this.pokemon); + tags.splice(tags.indexOf(tag), 1); + //remove moves in moveQueue + while (this.pokemon.getMoveQueue().length && this.pokemon.getMoveQueue()[0].move === moves.move) { + this.pokemon.getMoveQueue().shift(); + } + } + } + this.pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL }); this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT);