From 1c16060ae743e0db6836108207c11bfbc091e1af Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Mon, 4 Aug 2025 16:27:16 -0700 Subject: [PATCH] Remove protect chance reset on wave change --- src/data/moves/move.ts | 2 +- src/data/pokemon/pokemon-data.ts | 6 ------ src/field/pokemon.ts | 2 -- test/moves/protect.test.ts | 2 +- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/data/moves/move.ts b/src/data/moves/move.ts index 7117c9d1314..fba58e3752c 100644 --- a/src/data/moves/move.ts +++ b/src/data/moves/move.ts @@ -5913,7 +5913,7 @@ export class ProtectAttr extends AddBattlerTagAttr { return ((user, target, move): boolean => { let timesUsed = 0; - for (const turnMove of user.tempSummonData.waveMoveHistory.slice().reverse()) { + for (const turnMove of user.getLastXMoves(-1).slice()) { if ( // Quick & Wide guard increment the Protect counter without using it for fail chance !(allMoves[turnMove.move].hasAttr("ProtectAttr") || diff --git a/src/data/pokemon/pokemon-data.ts b/src/data/pokemon/pokemon-data.ts index 9aab7262b06..0bd6af0bb04 100644 --- a/src/data/pokemon/pokemon-data.ts +++ b/src/data/pokemon/pokemon-data.ts @@ -262,12 +262,6 @@ export class PokemonTempSummonData { * {@linkcode MoveId.FAKE_OUT | Fake Out} and {@linkcode MoveId.FIRST_IMPRESSION | First Impression}). */ waveTurnCount = 1; - /** - * An array containing all moves this Pokemon has used since the start of the wave without switching out. - * Reset on switch and new wave. - * Used to calculate {@link https://bulbapedia.bulbagarden.net/wiki/Protection | Protecting moves}' fail chances. - */ - waveMoveHistory: TurnMove[] = []; } /** diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 6ebd524280f..ca1dd1d3c79 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -4443,7 +4443,6 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { } turnMove.turn = globalScene.currentBattle?.turn; this.getMoveHistory().push(turnMove); - this.tempSummonData.waveMoveHistory.push(turnMove); } /** @@ -5096,7 +5095,6 @@ export abstract class Pokemon extends Phaser.GameObjects.Container { resetWaveData(): void { this.waveData = new PokemonWaveData(); this.tempSummonData.waveTurnCount = 1; - this.tempSummonData.waveMoveHistory = []; } resetTera(): void { diff --git a/test/moves/protect.test.ts b/test/moves/protect.test.ts index b1426aeff3d..64e77367738 100644 --- a/test/moves/protect.test.ts +++ b/test/moves/protect.test.ts @@ -85,7 +85,7 @@ describe("Moves - Protect", () => { await game.classicMode.startBattle([SpeciesId.CHARIZARD]); const charizard = game.scene.getPlayerPokemon()!; - charizard.tempSummonData.waveMoveHistory = [ + charizard.summonData.moveHistory = [ { move: MoveId.ENDURE, result: MoveResult.SUCCESS, targets: [BattlerIndex.PLAYER], useMode: MoveUseMode.NORMAL }, { move: MoveId.SPIKY_SHIELD,