[P2 BUG] Implemented correct frenzy Tag and Movequeue reset should frenzy move fail (#4277)

This commit is contained in:
geeil-han 2024-10-17 21:19:30 +02:00 committed by NightKev
parent cd8c9bcfd5
commit 01b71395d5

View File

@ -412,7 +412,6 @@ export class MovePhase extends BattlePhase {
* - Lapses `AFTER_MOVE` tags: * - Lapses `AFTER_MOVE` tags:
* - This handles the effects of {@link Moves.SUBSTITUTE Substitute} * - This handles the effects of {@link Moves.SUBSTITUTE Substitute}
* - Removes the second turn of charge moves * - Removes the second turn of charge moves
* - Calls frenzyMissFunc {@link frenzyMissFunc} should the move be cancelled
* *
* TODO: handle charge moves more gracefully * 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)); 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.pushMoveHistory({ move: Moves.NONE, result: MoveResult.FAIL });
this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT); this.pokemon.lapseTags(BattlerTagLapseType.MOVE_EFFECT);