From fa87c43f6d833de8aae348d5c65efb7be4974522 Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Tue, 3 Jun 2025 17:11:32 -0400 Subject: [PATCH] Cleaned up safeguard test to not use outdated code; fixed rest of errors --- test/moves/baton_pass.test.ts | 4 ++-- test/moves/glaive_rush.test.ts | 6 +++--- test/moves/safeguard.test.ts | 21 ++++++++------------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/test/moves/baton_pass.test.ts b/test/moves/baton_pass.test.ts index 72e487e0661..77c70eef665 100644 --- a/test/moves/baton_pass.test.ts +++ b/test/moves/baton_pass.test.ts @@ -64,12 +64,12 @@ describe("Moves - Baton Pass", () => { // round 1 - ai buffs game.move.select(Moves.SPLASH); - await game.forceEnemyMove(Moves.NASTY_PLOT); + await game.move.forceEnemyMove(Moves.NASTY_PLOT); await game.toNextTurn(); // round 2 - baton pass game.move.select(Moves.SPLASH); - await game.forceEnemyMove(Moves.BATON_PASS); + await game.move.forceEnemyMove(Moves.BATON_PASS); await game.phaseInterceptor.to("PostSummonPhase", false); // check buffs are still there diff --git a/test/moves/glaive_rush.test.ts b/test/moves/glaive_rush.test.ts index 49817f7197b..376f7b982eb 100644 --- a/test/moves/glaive_rush.test.ts +++ b/test/moves/glaive_rush.test.ts @@ -138,17 +138,17 @@ describe("Moves - Glaive Rush", () => { player.hp = 1000; game.move.select(Moves.PROTECT); - await game.forceEnemyMove(Moves.GLAIVE_RUSH); + await game.move.forceEnemyMove(Moves.GLAIVE_RUSH); await game.phaseInterceptor.to("TurnEndPhase"); game.move.select(Moves.SHADOW_SNEAK); - await game.forceEnemyMove(Moves.GLAIVE_RUSH); + await game.move.forceEnemyMove(Moves.GLAIVE_RUSH); await game.phaseInterceptor.to("TurnEndPhase"); const damagedHP1 = 1000 - enemy.hp; enemy.hp = 1000; game.move.select(Moves.SHADOW_SNEAK); - await game.forceEnemyMove(Moves.SPLASH); + await game.move.forceEnemyMove(Moves.SPLASH); await game.phaseInterceptor.to("TurnEndPhase"); const damagedHP2 = 1000 - enemy.hp; diff --git a/test/moves/safeguard.test.ts b/test/moves/safeguard.test.ts index cf01ac3e28d..8f8276aa603 100644 --- a/test/moves/safeguard.test.ts +++ b/test/moves/safeguard.test.ts @@ -1,6 +1,5 @@ import { BattlerIndex } from "#app/battle"; import { PostDefendContactApplyStatusEffectAbAttr } from "#app/data/abilities/ability"; -import { allAbilities } from "#app/data/data-lists"; import { Abilities } from "#app/enums/abilities"; import { StatusEffect } from "#app/enums/status-effect"; import GameManager from "#test/testUtils/gameManager"; @@ -113,14 +112,14 @@ describe("Moves - Safeguard", () => { expect(enemyPokemon.status?.effect).toBe(StatusEffect.SLEEP); }); - it("doesn't protect from self-inflicted via Rest or Flame Orb", async () => { - game.override.enemyHeldItems([{ name: "FLAME_ORB" }]).enemyMoveset([Moves.SAFEGUARD, Moves.REST]); + it("doesn't protect from self-inflicted status from Rest or Flame Orb", async () => { + game.override.enemyHeldItems([{ name: "FLAME_ORB" }]); await game.classicMode.startBattle(); const enemyPokemon = game.scene.getEnemyPokemon()!; enemyPokemon.hp = 1; game.move.select(Moves.SPLASH); - await game.forceEnemyMove(Moves.SAFEGUARD); + await game.move.forceEnemyMove(Moves.SAFEGUARD); await game.toNextTurn(); expect(enemyPokemon.status?.effect).toBe(StatusEffect.BURN); @@ -128,28 +127,24 @@ describe("Moves - Safeguard", () => { enemyPokemon.resetStatus(); game.move.select(Moves.SPLASH); - await game.forceEnemyMove(Moves.REST); + await game.move.forceEnemyMove(Moves.REST); await game.toNextTurn(); expect(enemyPokemon.status?.effect).toBe(StatusEffect.SLEEP); }); it("protects from ability-inflicted status", async () => { - game.override.ability(Abilities.STATIC).enemyMoveset([Moves.SAFEGUARD, Moves.TACKLE]); - vi.spyOn( - allAbilities[Abilities.STATIC].getAttrs(PostDefendContactApplyStatusEffectAbAttr)[0], - "chance", - "get", - ).mockReturnValue(100); + game.override.ability(Abilities.STATIC); + vi.spyOn(PostDefendContactApplyStatusEffectAbAttr.prototype, "chance", "get").mockReturnValue(100); await game.classicMode.startBattle(); const enemyPokemon = game.scene.getEnemyPokemon()!; game.move.select(Moves.SPLASH); - await game.forceEnemyMove(Moves.SAFEGUARD); + await game.move.forceEnemyMove(Moves.SAFEGUARD); await game.toNextTurn(); game.move.select(Moves.SPLASH); - await game.forceEnemyMove(Moves.TACKLE); + await game.move.forceEnemyMove(Moves.TACKLE); await game.toNextTurn(); expect(enemyPokemon.status).toBeUndefined();