From 934b47c535969f5faa723f190ea26dae7a96a362 Mon Sep 17 00:00:00 2001 From: Jimmybald1 <147992650+IBBCalc@users.noreply.github.com> Date: Mon, 26 May 2025 19:50:39 +0200 Subject: [PATCH] Wave move history has to be looped in reverse --- src/data/moves/move.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 23e10a248b7..b7aa17979d9 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -5782,11 +5782,12 @@ export class ProtectAttr extends AddBattlerTagAttr { return ((user, target, move): boolean => { let timesUsed = 0; - for (const turnMove of user.tempSummonData.waveMoveHistory) { + for (const turnMove of user.tempSummonData.waveMoveHistory.reverse()) { if ( // Quick & Wide guard increment the Protect counter without using it for fail chance - !(allMoves[turnMove.move].hasAttr(ProtectAttr) || [Moves.QUICK_GUARD, Moves.WIDE_GUARD].includes(turnMove.move)) - || turnMove?.result !== MoveResult.SUCCESS + !(allMoves[turnMove.move].hasAttr(ProtectAttr) || + [Moves.QUICK_GUARD, Moves.WIDE_GUARD].includes(turnMove.move)) || + turnMove?.result !== MoveResult.SUCCESS ) { break; } @@ -5794,7 +5795,7 @@ export class ProtectAttr extends AddBattlerTagAttr { timesUsed++ } - // console.log(`Wave Move History: ${user.tempSummonData.waveMoveHistory}\nTimes Used In Row: ${timesUsed}\nSuccess chance: 1 in ${Math.pow(3, timesUsed)}`) + // console.log(`Wave Move History: ${user.tempSummonData.waveMoveHistory.reverse().map(t => t.move)}\nTimes Used In Row: ${timesUsed}\nSuccess chance: 1 in ${Math.pow(3, timesUsed)}`) return timesUsed === 0 || user.randBattleSeedInt(Math.pow(3, timesUsed)) === 0; }); }