From c300f57b06446aaefcf55048165e73c3d99e23a4 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sat, 31 May 2025 18:45:27 -0700 Subject: [PATCH 1/2] [Test] `MoveHelper#changeMoveset` disables moveset overrides --- test/testUtils/helpers/moveHelper.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/testUtils/helpers/moveHelper.ts b/test/testUtils/helpers/moveHelper.ts index b3cdffeb636..4dec3224414 100644 --- a/test/testUtils/helpers/moveHelper.ts +++ b/test/testUtils/helpers/moveHelper.ts @@ -146,10 +146,23 @@ export class MoveHelper extends GameManagerHelper { /** * Changes a pokemon's moveset to the given move(s). * Used when the normal moveset override can't be used (such as when it's necessary to check or update properties of the moveset). + * + * **Note**: Will disable the moveset override matching the pokemon's party. * @param pokemon - The {@linkcode Pokemon} being modified * @param moveset - The {@linkcode Moves} (single or array) to change the Pokemon's moveset to */ public changeMoveset(pokemon: Pokemon, moveset: Moves | Moves[]): void { + if (pokemon.isPlayer()) { + if ([Overrides.MOVESET_OVERRIDE].flat().length > 0) { + vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([]); + console.warn("Player moveset override disabled due to use of `game.move.changeMoveset`!"); + } + } else { + if ([Overrides.OPP_MOVESET_OVERRIDE].flat().length > 0) { + vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([]); + console.warn("Enemy moveset override disabled due to use of `game.move.changeMoveset`!"); + } + } if (!Array.isArray(moveset)) { moveset = [moveset]; } From 673e33fdaa3484c43e2a3f37f026b4c9d7cd524e Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sat, 31 May 2025 18:56:49 -0700 Subject: [PATCH 2/2] Fix Assist test --- test/moves/assist.test.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/moves/assist.test.ts b/test/moves/assist.test.ts index d0385399811..d2c3af22e67 100644 --- a/test/moves/assist.test.ts +++ b/test/moves/assist.test.ts @@ -1,7 +1,6 @@ import { BattlerIndex } from "#app/battle"; import { Stat } from "#app/enums/stat"; import { MoveResult } from "#app/field/pokemon"; -import { CommandPhase } from "#app/phases/command-phase"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; @@ -80,7 +79,6 @@ describe("Moves - Assist", () => { // Player uses Sketch to copy Swords Dance, Player_2 stalls a turn. Player will attempt Assist and should have no usable moves await game.toNextTurn(); game.move.select(Moves.ASSIST, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(Moves.PROTECT, 1); await game.toNextTurn(); @@ -88,15 +86,13 @@ describe("Moves - Assist", () => { }); it("should apply secondary effects of a move", async () => { - game.override.moveset([Moves.ASSIST, Moves.WOOD_HAMMER, Moves.WOOD_HAMMER, Moves.WOOD_HAMMER]); await game.classicMode.startBattle([Species.FEEBAS, Species.SHUCKLE]); const [feebas, shuckle] = game.scene.getPlayerField(); - game.move.changeMoveset(feebas, [Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL]); - game.move.changeMoveset(shuckle, [Moves.ASSIST, Moves.SKETCH, Moves.PROTECT, Moves.DRAGON_TAIL]); + game.move.changeMoveset(feebas, [Moves.ASSIST, Moves.WOOD_HAMMER]); + game.move.changeMoveset(shuckle, [Moves.ASSIST, Moves.WOOD_HAMMER]); game.move.select(Moves.ASSIST, 0); - await game.phaseInterceptor.to(CommandPhase); game.move.select(Moves.ASSIST, 1); await game.toNextTurn();