Remove protect chance reset on wave change

This commit is contained in:
NightKev 2025-08-04 16:27:16 -07:00
parent 8d66eeb701
commit 1c16060ae7
4 changed files with 2 additions and 10 deletions

View File

@ -5913,7 +5913,7 @@ export class ProtectAttr extends AddBattlerTagAttr {
return ((user, target, move): boolean => { return ((user, target, move): boolean => {
let timesUsed = 0; let timesUsed = 0;
for (const turnMove of user.tempSummonData.waveMoveHistory.slice().reverse()) { for (const turnMove of user.getLastXMoves(-1).slice()) {
if ( if (
// Quick & Wide guard increment the Protect counter without using it for fail chance // Quick & Wide guard increment the Protect counter without using it for fail chance
!(allMoves[turnMove.move].hasAttr("ProtectAttr") || !(allMoves[turnMove.move].hasAttr("ProtectAttr") ||

View File

@ -262,12 +262,6 @@ export class PokemonTempSummonData {
* {@linkcode MoveId.FAKE_OUT | Fake Out} and {@linkcode MoveId.FIRST_IMPRESSION | First Impression}). * {@linkcode MoveId.FAKE_OUT | Fake Out} and {@linkcode MoveId.FIRST_IMPRESSION | First Impression}).
*/ */
waveTurnCount = 1; 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[] = [];
} }
/** /**

View File

@ -4443,7 +4443,6 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
} }
turnMove.turn = globalScene.currentBattle?.turn; turnMove.turn = globalScene.currentBattle?.turn;
this.getMoveHistory().push(turnMove); this.getMoveHistory().push(turnMove);
this.tempSummonData.waveMoveHistory.push(turnMove);
} }
/** /**
@ -5096,7 +5095,6 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
resetWaveData(): void { resetWaveData(): void {
this.waveData = new PokemonWaveData(); this.waveData = new PokemonWaveData();
this.tempSummonData.waveTurnCount = 1; this.tempSummonData.waveTurnCount = 1;
this.tempSummonData.waveMoveHistory = [];
} }
resetTera(): void { resetTera(): void {

View File

@ -85,7 +85,7 @@ describe("Moves - Protect", () => {
await game.classicMode.startBattle([SpeciesId.CHARIZARD]); await game.classicMode.startBattle([SpeciesId.CHARIZARD]);
const charizard = game.scene.getPlayerPokemon()!; 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.ENDURE, result: MoveResult.SUCCESS, targets: [BattlerIndex.PLAYER], useMode: MoveUseMode.NORMAL },
{ {
move: MoveId.SPIKY_SHIELD, move: MoveId.SPIKY_SHIELD,