From 6fb50593dcc4a4dc3f3e54ff7ac9a2531233c21b Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:19:56 -0700 Subject: [PATCH 01/42] add overridesHelper.ts --- src/test/utils/overridesHelper.ts | 87 +++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/test/utils/overridesHelper.ts diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts new file mode 100644 index 00000000000..c2255b705f0 --- /dev/null +++ b/src/test/utils/overridesHelper.ts @@ -0,0 +1,87 @@ +import { Weather, WeatherType } from "#app/data/weather"; +import { Biome } from "#app/enums/biome"; +import * as GameMode from "#app/game-mode"; +import { GameModes, getGameMode } from "#app/game-mode"; +import Overrides from "#app/overrides"; +import GameManager from "#test/utils/gameManager"; +import { vi } from "vitest"; + +/** + * Helper to handle overrides in tests + */ +export class OverridesHelper { + private readonly game: GameManager; + + constructor(game: GameManager) { + this.game = game; + } + + /** + * Override the starting biome + * @warning Any event listeners that are attached to [NewArenaEvent](events\battle-scene.ts) may need to be handled down the line + * @param biome the biome to set + */ + startingBiome(biome: Biome): this { + this.game.scene.newArena(biome); + this.log(`Starting biome set to ${Biome[biome]} (=${biome})!`); + return this; + } + + /** + * Override the starting wave (index) + * @param wave the wave (index) to set. Classic: `1`-`200` + * @returns spy instance + */ + startingWave(wave: number): this { + vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(wave); + this.log(`Starting wave set to ${wave}!`); + return this; + } + + /** + * Override each wave to have or not have standard trainer battles + * @returns spy instance + * @param disable - true + */ + disableTrainerWaves(disable: boolean): this { + const realFn = getGameMode; + vi.spyOn(GameMode, "getGameMode").mockImplementation((gameMode: GameModes) => { + const mode = realFn(gameMode); + mode.hasTrainers = !disable; + return mode; + }); + this.log(`Standard trainer waves are ${disable ? "disabled" : "enabled"}!`); + return this; + } + + /** + * Override the weather (type) + * @param type weather type to set + * @returns spy instance + */ + weather(type: WeatherType): this { + vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(type); + this.log(`Weather set to ${Weather[type]} (=${type})!`); + return this; + } + + /** + * Override the seed + * @param seed the seed to set + * @returns spy instance + */ + seed(seed: string): this { + vi.spyOn(this.game.scene, "resetSeed").mockImplementation(() => { + this.game.scene.waveSeed = seed; + Phaser.Math.RND.sow([seed]); + this.game.scene.rngCounter = 0; + }); + this.game.scene.resetSeed(); + this.log(`Seed set to "${seed}"!`); + return this; + } + + private log(...params: any[]) { + console.log("Overrides:", ...params); + } +} From c514aff854eccc071976e3b93d71f5fe6eefdb1e Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:20:53 -0700 Subject: [PATCH 02/42] attach overrides helper to gameManager --- src/test/utils/gameManager.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/utils/gameManager.ts b/src/test/utils/gameManager.ts index ac18daaaada..d491e007940 100644 --- a/src/test/utils/gameManager.ts +++ b/src/test/utils/gameManager.ts @@ -34,6 +34,7 @@ import { Species } from "#enums/species"; import { Button } from "#enums/buttons"; import { BattlerIndex } from "#app/battle.js"; import TargetSelectUiHandler from "#app/ui/target-select-ui-handler.js"; +import { OverridesHelper } from "./overridesHelper"; /** * Class to manage the game state and transitions between phases. @@ -44,6 +45,7 @@ export default class GameManager { public phaseInterceptor: PhaseInterceptor; public textInterceptor: TextInterceptor; public inputsHandler: InputsHandler; + public readonly override: OverridesHelper; /** * Creates an instance of GameManager. @@ -59,6 +61,7 @@ export default class GameManager { this.phaseInterceptor = new PhaseInterceptor(this.scene); this.textInterceptor = new TextInterceptor(this.scene); this.gameWrapper.setScene(this.scene); + this.override = new OverridesHelper(this); } /** From b2fbc4d6b64d2ec74b4b78703adde8798e615b3c Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:25:10 -0700 Subject: [PATCH 03/42] make pokemonSprite.test ignore hidden files (e.g. .DS_Store) --- src/test/sprites/pokemonSprite.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/sprites/pokemonSprite.test.ts b/src/test/sprites/pokemonSprite.test.ts index 5c1db85fa6f..52b20017715 100644 --- a/src/test/sprites/pokemonSprite.test.ts +++ b/src/test/sprites/pokemonSprite.test.ts @@ -38,7 +38,7 @@ describe("check if every variant's sprite are correctly set", () => { const errors = []; const trimmedDirpath = `variant${path.sep}${dirpath.split(rootDir)[1]}`; if (fs.existsSync(dirpath)) { - const files = fs.readdirSync(dirpath); + const files = fs.readdirSync(dirpath).filter(filename => !filename.startsWith(".")); for (const filename of files) { const filePath = `${dirpath}${filename}`; const trimmedFilePath = `${trimmedDirpath}${filename}`; From bc1c267071be1a430c46a75c9c2eae268ba4ca48 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:25:31 -0700 Subject: [PATCH 04/42] use game.override.startingWave --- src/test/abilities/battle_bond.test.ts | 2 +- src/test/abilities/disguise.test.ts | 2 +- src/test/abilities/ice_face.test.ts | 2 +- src/test/abilities/intimidate.test.ts | 24 +++++++++++----------- src/test/abilities/power_construct.test.ts | 2 +- src/test/abilities/schooling.test.ts | 2 +- src/test/abilities/shields_down.test.ts | 2 +- src/test/abilities/zen_mode.test.ts | 2 +- src/test/abilities/zero_to_hero.test.ts | 2 +- src/test/achievements/achievement.test.ts | 2 +- src/test/battle/battle.test.ts | 14 ++++++------- src/test/battle/error-handling.test.ts | 2 +- src/test/battle/special_battle.test.ts | 18 ++++++++-------- src/test/moves/ceaseless_edge.test.ts | 2 +- src/test/moves/dynamax_cannon.test.ts | 2 +- src/test/moves/spikes.test.ts | 6 +++--- src/test/moves/tackle.test.ts | 2 +- src/test/ui/transfer-item.test.ts | 2 +- 18 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/test/abilities/battle_bond.test.ts b/src/test/abilities/battle_bond.test.ts index 1ebefb99f32..8166f9bfe66 100644 --- a/src/test/abilities/battle_bond.test.ts +++ b/src/test/abilities/battle_bond.test.ts @@ -39,7 +39,7 @@ describe("Abilities - BATTLE BOND", () => { async () => { const baseForm = 1, ashForm = 2; - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); + game.override.startingWave(4); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.GRENINJA]: ashForm, }); diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index 0a542780ebc..f0d10e4691d 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -39,7 +39,7 @@ describe("Abilities - DISGUISE", () => { async () => { const baseForm = 0, bustedForm = 1; - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); + game.override.startingWave(4); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.MIMIKYU]: bustedForm, }); diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index 1b00ef748eb..ccf8ddef3c6 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -202,7 +202,7 @@ describe("Abilities - Ice Face", () => { }); it("reverts to Ice Face on arena reset", async () => { - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); + game.override.startingWave(4); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(4); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ diff --git a/src/test/abilities/intimidate.test.ts b/src/test/abilities/intimidate.test.ts index 2ff909def2e..944af180af1 100644 --- a/src/test/abilities/intimidate.test.ts +++ b/src/test/abilities/intimidate.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Intimidate", () => { vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); @@ -68,7 +68,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("single - boss should only trigger once then switch", async () => { - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(10); + game.override.startingWave(10); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( "CheckSwitchPhase", @@ -97,7 +97,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("single - trainer should only trigger once with switch", async () => { - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( "CheckSwitchPhase", @@ -127,7 +127,7 @@ describe("Abilities - Intimidate", () => { it("double - trainer should only trigger once per pokemon", async () => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( "CheckSwitchPhase", @@ -153,7 +153,7 @@ describe("Abilities - Intimidate", () => { it("double - wild: should only trigger once per pokemon", async () => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( "CheckSwitchPhase", @@ -179,7 +179,7 @@ describe("Abilities - Intimidate", () => { it("double - boss: should only trigger once per pokemon", async () => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(10); + game.override.startingWave(10); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( "CheckSwitchPhase", @@ -204,7 +204,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("single - wild next wave opp triger once, us: none", async () => { - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(2); + game.override.startingWave(2); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.AERIAL_ACE]); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; @@ -230,7 +230,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("single - wild next turn - no retrigger on next turn", async () => { - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(2); + game.override.startingWave(2); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; @@ -256,7 +256,7 @@ describe("Abilities - Intimidate", () => { it("single - trainer should only trigger once and each time he switch", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH]); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1); @@ -295,7 +295,7 @@ describe("Abilities - Intimidate", () => { it("single - trainer should only trigger once whatever turn we are", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1); @@ -333,7 +333,7 @@ describe("Abilities - Intimidate", () => { it("double - wild vs only 1 on player side", async () => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "COIN_CASE" }]); await game.runToSummon([Species.MIGHTYENA]); // Get rid of any modifiers that may alter power @@ -351,7 +351,7 @@ describe("Abilities - Intimidate", () => { it("double - wild vs only 1 alive on player side", async () => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); await game.runToTitle(); game.onNextPrompt("TitlePhase", Mode.TITLE, () => { diff --git a/src/test/abilities/power_construct.test.ts b/src/test/abilities/power_construct.test.ts index 48c92c0e2d1..ce40bb49613 100644 --- a/src/test/abilities/power_construct.test.ts +++ b/src/test/abilities/power_construct.test.ts @@ -39,7 +39,7 @@ describe("Abilities - POWER CONSTRUCT", () => { async () => { const baseForm = 2, completeForm = 4; - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); + game.override.startingWave(4); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.ZYGARDE]: completeForm, }); diff --git a/src/test/abilities/schooling.test.ts b/src/test/abilities/schooling.test.ts index aac8a3e793f..df9c4e6f065 100644 --- a/src/test/abilities/schooling.test.ts +++ b/src/test/abilities/schooling.test.ts @@ -39,7 +39,7 @@ describe("Abilities - SCHOOLING", () => { async () => { const soloForm = 0, schoolForm = 1; - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); + game.override.startingWave(4); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.WISHIWASHI]: schoolForm, }); diff --git a/src/test/abilities/shields_down.test.ts b/src/test/abilities/shields_down.test.ts index 881a3f4911f..a310148f041 100644 --- a/src/test/abilities/shields_down.test.ts +++ b/src/test/abilities/shields_down.test.ts @@ -39,7 +39,7 @@ describe("Abilities - SHIELDS DOWN", () => { async () => { const meteorForm = 0, coreForm = 7; - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); + game.override.startingWave(4); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.MINIOR]: coreForm, }); diff --git a/src/test/abilities/zen_mode.test.ts b/src/test/abilities/zen_mode.test.ts index dae01b7aa89..7b8474170e9 100644 --- a/src/test/abilities/zen_mode.test.ts +++ b/src/test/abilities/zen_mode.test.ts @@ -153,7 +153,7 @@ describe("Abilities - ZEN MODE", () => { async () => { const baseForm = 0, zenForm = 1; - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); + game.override.startingWave(4); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.DARMANITAN]: zenForm, }); diff --git a/src/test/abilities/zero_to_hero.test.ts b/src/test/abilities/zero_to_hero.test.ts index 6e82f151f15..24187626f3d 100644 --- a/src/test/abilities/zero_to_hero.test.ts +++ b/src/test/abilities/zero_to_hero.test.ts @@ -39,7 +39,7 @@ describe("Abilities - ZERO TO HERO", () => { async () => { const baseForm = 0, heroForm = 1; - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); + game.override.startingWave(4); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.PALAFIN]: heroForm, }); diff --git a/src/test/achievements/achievement.test.ts b/src/test/achievements/achievement.test.ts index f5a7416e809..207293d1973 100644 --- a/src/test/achievements/achievement.test.ts +++ b/src/test/achievements/achievement.test.ts @@ -106,10 +106,10 @@ describe("RibbonAchv", () => { vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(0); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(0); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(0); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(0); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([]); game = new GameManager(phaserGame); + game.override.startingWave(0); scene = game.scene; }); diff --git a/src/test/battle/battle.test.ts b/src/test/battle/battle.test.ts index 436b3227791..a185844e599 100644 --- a/src/test/battle/battle.test.ts +++ b/src/test/battle/battle.test.ts @@ -93,7 +93,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); @@ -113,7 +113,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP]); @@ -233,7 +233,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -247,7 +247,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -266,7 +266,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle([ @@ -295,7 +295,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle(); @@ -313,7 +313,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle(); diff --git a/src/test/battle/error-handling.test.ts b/src/test/battle/error-handling.test.ts index 063ac2b5210..e65a6867919 100644 --- a/src/test/battle/error-handling.test.ts +++ b/src/test/battle/error-handling.test.ts @@ -29,7 +29,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/battle/special_battle.test.ts b/src/test/battle/special_battle.test.ts index cc1d2057b9b..0a2b5d4106a 100644 --- a/src/test/battle/special_battle.test.ts +++ b/src/test/battle/special_battle.test.ts @@ -36,7 +36,7 @@ describe("Test Battle Phase", () => { it("startBattle 2vs1 boss", async() => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(10); + game.override.startingWave(10); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -47,7 +47,7 @@ describe("Test Battle Phase", () => { it("startBattle 2vs2 boss", async() => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(10); + game.override.startingWave(10); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -58,7 +58,7 @@ describe("Test Battle Phase", () => { it("startBattle 2vs2 trainer", async() => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -69,7 +69,7 @@ describe("Test Battle Phase", () => { it("startBattle 2vs1 trainer", async() => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -80,7 +80,7 @@ describe("Test Battle Phase", () => { it("startBattle 2vs1 rival", async() => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(8); + game.override.startingWave(8); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -91,7 +91,7 @@ describe("Test Battle Phase", () => { it("startBattle 2vs2 rival", async() => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(8); + game.override.startingWave(8); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -102,7 +102,7 @@ describe("Test Battle Phase", () => { it("startBattle 1vs1 trainer", async() => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.startBattle([ Species.BLASTOISE, ]); @@ -112,7 +112,7 @@ describe("Test Battle Phase", () => { it("startBattle 2vs2 trainer", async() => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -123,7 +123,7 @@ describe("Test Battle Phase", () => { it("startBattle 4vs2 trainer", async() => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index a59d6e8f535..b92979c56ed 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -105,7 +105,7 @@ describe("Moves - Ceaseless Edge", () => { "trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage", async () => { vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS"}]); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); await game.startBattle([ Species.ILLUMISE ]); diff --git a/src/test/moves/dynamax_cannon.test.ts b/src/test/moves/dynamax_cannon.test.ts index aab1b210f68..94e45b045ee 100644 --- a/src/test/moves/dynamax_cannon.test.ts +++ b/src/test/moves/dynamax_cannon.test.ts @@ -32,7 +32,7 @@ describe("Moves - Dynamax Cannon", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(200); // Note that, for Waves 1-10, the level cap is 10 - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(1); + game.override.startingWave(1); vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index 44f365ea689..a4fc1a4baeb 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -33,7 +33,7 @@ describe("Moves - Spikes", () => { vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); + game.override.startingWave(3); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPIKES,Moves.SPLASH, Moves.ROAR]); }); @@ -86,7 +86,7 @@ describe("Moves - Spikes", () => { }, 20000); it("trainer - wild - force switch opponent - should take damage", async() => { - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); // player set spikes on the field and do splash for 3 turns // opponent do splash for 4 turns // nobody should take damage @@ -104,7 +104,7 @@ describe("Moves - Spikes", () => { }, 20000); it("trainer - wild - force switch by himself opponent - should take damage", async() => { - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); + game.override.startingWave(5); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5000); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(0); // turn 1: player set spikes, opponent do splash diff --git a/src/test/moves/tackle.test.ts b/src/test/moves/tackle.test.ts index f4b335d9576..e36713fd086 100644 --- a/src/test/moves/tackle.test.ts +++ b/src/test/moves/tackle.test.ts @@ -34,7 +34,7 @@ describe("Moves - Tackle", () => { vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(97); + game.override.startingWave(97); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.GROWTH,Moves.GROWTH,Moves.GROWTH,Moves.GROWTH]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/ui/transfer-item.test.ts b/src/test/ui/transfer-item.test.ts index c20fa51aff9..ba0dce8d8b5 100644 --- a/src/test/ui/transfer-item.test.ts +++ b/src/test/ui/transfer-item.test.ts @@ -35,7 +35,7 @@ describe("UI - Transfer Items", () => { game = new GameManager(phaserGame); vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(1); + game.override.startingWave(1); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([ { name: "BERRY", count: 1, type: BerryType.SITRUS }, { name: "BERRY", count: 2, type: BerryType.APICOT }, From e33888e5f5843c78981df5bda611348fdb8ac742 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:32:04 -0700 Subject: [PATCH 05/42] use game.override.weather() --- src/test/abilities/sand_veil.test.ts | 2 +- src/test/arena/weather_fog.test.ts | 2 +- src/test/moves/aurora_veil.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/abilities/sand_veil.test.ts b/src/test/abilities/sand_veil.test.ts index ea75027101a..6adf8432914 100644 --- a/src/test/abilities/sand_veil.test.ts +++ b/src/test/abilities/sand_veil.test.ts @@ -36,7 +36,7 @@ describe("Abilities - Sand Veil", () => { vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(WeatherType.SANDSTORM); + game.override.weather(WeatherType.SANDSTORM); }); test( diff --git a/src/test/arena/weather_fog.test.ts b/src/test/arena/weather_fog.test.ts index 85a9e334c45..7c4536713a3 100644 --- a/src/test/arena/weather_fog.test.ts +++ b/src/test/arena/weather_fog.test.ts @@ -28,7 +28,7 @@ describe("Weather - Fog", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(WeatherType.FOG); + game.override.weather(WeatherType.FOG); vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/moves/aurora_veil.test.ts b/src/test/moves/aurora_veil.test.ts index dad8d277b7f..ead142c0792 100644 --- a/src/test/moves/aurora_veil.test.ts +++ b/src/test/moves/aurora_veil.test.ts @@ -42,7 +42,7 @@ describe("Moves - Aurora Veil", () => { vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(WeatherType.HAIL); + game.override.weather(WeatherType.HAIL); }); it("reduces damage of physical attacks by half in a single battle", async() => { From 3788631846813ee4b7204a04cd9094d2bdc2c15a Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:36:46 -0700 Subject: [PATCH 06/42] add game.override.battleType --- src/test/utils/overridesHelper.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index c2255b705f0..4fe605b4cac 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -30,7 +30,7 @@ export class OverridesHelper { /** * Override the starting wave (index) * @param wave the wave (index) to set. Classic: `1`-`200` - * @returns spy instance + * @returns this */ startingWave(wave: number): this { vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(wave); @@ -40,8 +40,8 @@ export class OverridesHelper { /** * Override each wave to have or not have standard trainer battles - * @returns spy instance - * @param disable - true + * @returns this + * @param disable true */ disableTrainerWaves(disable: boolean): this { const realFn = getGameMode; @@ -57,7 +57,7 @@ export class OverridesHelper { /** * Override the weather (type) * @param type weather type to set - * @returns spy instance + * @returns this */ weather(type: WeatherType): this { vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(type); @@ -68,7 +68,7 @@ export class OverridesHelper { /** * Override the seed * @param seed the seed to set - * @returns spy instance + * @returns this */ seed(seed: string): this { vi.spyOn(this.game.scene, "resetSeed").mockImplementation(() => { @@ -81,6 +81,17 @@ export class OverridesHelper { return this; } + /** + * Override the battle type (single or double) + * @param battleType battle type to set + * @returns this + */ + battleType(battleType: "single" | "double"): this { + vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue(battleType); + this.log(`Battle type set to ${battleType} only!`); + return this; + } + private log(...params: any[]) { console.log("Overrides:", ...params); } From e52d89ba40969365120d8a787f2a08c5a34f9948 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:48:48 -0700 Subject: [PATCH 07/42] apply game.override.battleType --- src/test/abilities/ability_timing.test.ts | 2 +- src/test/abilities/aura_break.test.ts | 2 +- src/test/abilities/battery.test.ts | 2 +- src/test/abilities/battle_bond.test.ts | 2 +- src/test/abilities/costar.test.ts | 2 +- src/test/abilities/disguise.test.ts | 2 +- src/test/abilities/dry_skin.test.ts | 2 +- src/test/abilities/ice_face.test.ts | 2 +- src/test/abilities/intimidate.test.ts | 12 +++--- src/test/abilities/intrepid_sword.test.ts | 2 +- src/test/abilities/libero.test.ts | 2 +- src/test/abilities/moxie.test.ts | 2 +- src/test/abilities/parental_bond.test.ts | 6 +-- src/test/abilities/power_construct.test.ts | 2 +- src/test/abilities/power_spot.test.ts | 2 +- src/test/abilities/protean.test.ts | 2 +- src/test/abilities/quick_draw.test.ts | 2 +- src/test/abilities/sand_veil.test.ts | 5 ++- src/test/abilities/sap_sipper.test.ts | 2 +- src/test/abilities/schooling.test.ts | 2 +- src/test/abilities/screen_cleaner.test.ts | 2 +- src/test/abilities/serene_grace.test.ts | 2 +- src/test/abilities/sheer_force.test.ts | 2 +- src/test/abilities/shield_dust.test.ts | 2 +- src/test/abilities/shields_down.test.ts | 2 +- src/test/abilities/steely_spirit.test.ts | 2 +- src/test/abilities/sturdy.test.ts | 2 +- src/test/abilities/unseen_fist.test.ts | 2 +- src/test/abilities/volt_absorb.test.ts | 2 +- src/test/abilities/wind_power.test.ts | 2 +- src/test/abilities/wind_rider.test.ts | 2 +- src/test/abilities/wonder_skin.test.ts | 2 +- src/test/abilities/zen_mode.test.ts | 2 +- src/test/abilities/zero_to_hero.test.ts | 2 +- src/test/arena/arena_gravity.test.ts | 2 +- src/test/arena/weather_fog.test.ts | 5 ++- src/test/arena/weather_strong_winds.test.ts | 2 +- src/test/battle/battle-order.test.ts | 8 ++-- src/test/battle/battle.test.ts | 21 +++++----- src/test/battle/error-handling.test.ts | 5 ++- src/test/battle/special_battle.test.ts | 45 ++++++++++++--------- src/test/evolution.test.ts | 2 +- src/test/items/eviolite.test.ts | 2 +- src/test/items/exp_booster.test.ts | 2 +- src/test/items/grip_claw.test.ts | 2 +- src/test/items/leek.test.ts | 2 +- src/test/items/leftovers.test.ts | 2 +- src/test/items/light_ball.test.ts | 2 +- src/test/items/metal_powder.test.ts | 2 +- src/test/items/quick_powder.test.ts | 2 +- src/test/items/scope_lens.test.ts | 2 +- src/test/items/thick_club.test.ts | 2 +- src/test/items/toxic_orb.test.ts | 2 +- src/test/localization/terrain.test.ts | 13 +++--- src/test/moves/astonish.test.ts | 2 +- src/test/moves/aurora_veil.test.ts | 6 +-- src/test/moves/ceaseless_edge.test.ts | 2 +- src/test/moves/double_team.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 2 +- src/test/moves/dynamax_cannon.test.ts | 2 +- src/test/moves/fissure.test.ts | 2 +- src/test/moves/flower_shield.test.ts | 4 +- src/test/moves/follow_me.test.ts | 2 +- src/test/moves/gastro_acid.test.ts | 4 +- src/test/moves/glaive_rush.test.ts | 2 +- src/test/moves/growth.test.ts | 2 +- src/test/moves/hard_press.test.ts | 2 +- src/test/moves/hyper_beam.test.ts | 2 +- src/test/moves/light_screen.test.ts | 4 +- src/test/moves/magnet_rise.test.ts | 2 +- src/test/moves/make_it_rain.test.ts | 4 +- src/test/moves/multi_target.test.ts | 2 +- src/test/moves/octolock.test.ts | 2 +- src/test/moves/purify.test.ts | 2 +- src/test/moves/rage_powder.test.ts | 2 +- src/test/moves/reflect.test.ts | 4 +- src/test/moves/rollout.test.ts | 2 +- src/test/moves/roost.test.ts | 2 +- src/test/moves/spikes.test.ts | 2 +- src/test/moves/spit_up.test.ts | 2 +- src/test/moves/spotlight.test.ts | 2 +- src/test/moves/stockpile.test.ts | 2 +- src/test/moves/swallow.test.ts | 2 +- src/test/moves/tackle.test.ts | 2 +- src/test/moves/tail_whip.test.ts | 2 +- src/test/moves/tailwind.test.ts | 6 +-- src/test/moves/thousand_arrows.test.ts | 2 +- src/test/moves/tidy_up.test.ts | 2 +- src/test/ui/transfer-item.test.ts | 2 +- 89 files changed, 155 insertions(+), 143 deletions(-) diff --git a/src/test/abilities/ability_timing.test.ts b/src/test/abilities/ability_timing.test.ts index 84d4390652e..61f419e5fe5 100644 --- a/src/test/abilities/ability_timing.test.ts +++ b/src/test/abilities/ability_timing.test.ts @@ -26,7 +26,7 @@ describe("Ability Timing", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.PIDGEY); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); diff --git a/src/test/abilities/aura_break.test.ts b/src/test/abilities/aura_break.test.ts index 28813b5206f..65b2b44448a 100644 --- a/src/test/abilities/aura_break.test.ts +++ b/src/test/abilities/aura_break.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Aura Break", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MOONBLAST, Moves.DARK_PULSE, Moves.MOONBLAST, Moves.DARK_PULSE]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.AURA_BREAK); diff --git a/src/test/abilities/battery.test.ts b/src/test/abilities/battery.test.ts index 06f388371e9..62926b8c7dc 100644 --- a/src/test/abilities/battery.test.ts +++ b/src/test/abilities/battery.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Battery", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); diff --git a/src/test/abilities/battle_bond.test.ts b/src/test/abilities/battle_bond.test.ts index 8166f9bfe66..88f15d78762 100644 --- a/src/test/abilities/battle_bond.test.ts +++ b/src/test/abilities/battle_bond.test.ts @@ -28,7 +28,7 @@ describe("Abilities - BATTLE BOND", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BATTLE_BOND); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/abilities/costar.test.ts b/src/test/abilities/costar.test.ts index f26c4f70758..7c791c3e140 100644 --- a/src/test/abilities/costar.test.ts +++ b/src/test/abilities/costar.test.ts @@ -27,7 +27,7 @@ describe("Abilities - COSTAR", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.COSTAR); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NASTY_PLOT]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index f0d10e4691d..87ac53963fb 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -28,7 +28,7 @@ describe("Abilities - DISGUISE", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DISGUISE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/abilities/dry_skin.test.ts b/src/test/abilities/dry_skin.test.ts index 3d97c414862..dbfe1fe761a 100644 --- a/src/test/abilities/dry_skin.test.ts +++ b/src/test/abilities/dry_skin.test.ts @@ -24,7 +24,7 @@ describe("Abilities - Dry Skin", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DRY_SKIN); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index ccf8ddef3c6..e50c5dfd3d6 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -33,7 +33,7 @@ describe("Abilities - Ice Face", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.EISCUE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ICE_FACE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.ICE_BEAM, Moves.TOXIC_THREAD, Moves.HAIL]); diff --git a/src/test/abilities/intimidate.test.ts b/src/test/abilities/intimidate.test.ts index 944af180af1..709e60ea250 100644 --- a/src/test/abilities/intimidate.test.ts +++ b/src/test/abilities/intimidate.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Intimidate", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); @@ -126,7 +126,7 @@ describe("Abilities - Intimidate", () => { }, 200000); it("double - trainer should only trigger once per pokemon", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); game.override.startingWave(5); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( @@ -152,7 +152,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("double - wild: should only trigger once per pokemon", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); game.override.startingWave(3); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( @@ -178,7 +178,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("double - boss: should only trigger once per pokemon", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); game.override.startingWave(10); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); game.onNextPrompt( @@ -332,7 +332,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("double - wild vs only 1 on player side", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); game.override.startingWave(3); vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "COIN_CASE" }]); await game.runToSummon([Species.MIGHTYENA]); @@ -350,7 +350,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("double - wild vs only 1 alive on player side", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); game.override.startingWave(3); await game.runToTitle(); diff --git a/src/test/abilities/intrepid_sword.test.ts b/src/test/abilities/intrepid_sword.test.ts index 1fae6555688..e803db2c049 100644 --- a/src/test/abilities/intrepid_sword.test.ts +++ b/src/test/abilities/intrepid_sword.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Intrepid Sword", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ZACIAN); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTREPID_SWORD); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTREPID_SWORD); diff --git a/src/test/abilities/libero.test.ts b/src/test/abilities/libero.test.ts index 015e6a44e24..3e8cbbfe387 100644 --- a/src/test/abilities/libero.test.ts +++ b/src/test/abilities/libero.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Protean", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LIBERO); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); diff --git a/src/test/abilities/moxie.test.ts b/src/test/abilities/moxie.test.ts index f7b7fe22027..d1be9b7acbf 100644 --- a/src/test/abilities/moxie.test.ts +++ b/src/test/abilities/moxie.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Moxie", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.AERIAL_ACE; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index f29eafc72f6..609228de30f 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Parental Bond", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PARENTAL_BOND); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); @@ -238,7 +238,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not apply to multi-target moves", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE]); await game.startBattle([Species.CHARIZARD, Species.PIDGEOT]); @@ -612,7 +612,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not apply to multi-target moves with Multi-Lens", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE, Moves.SPLASH]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]); diff --git a/src/test/abilities/power_construct.test.ts b/src/test/abilities/power_construct.test.ts index ce40bb49613..cf2c4769ad9 100644 --- a/src/test/abilities/power_construct.test.ts +++ b/src/test/abilities/power_construct.test.ts @@ -28,7 +28,7 @@ describe("Abilities - POWER CONSTRUCT", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.POWER_CONSTRUCT); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/abilities/power_spot.test.ts b/src/test/abilities/power_spot.test.ts index 1947cfc9c4f..ca4ae543871 100644 --- a/src/test/abilities/power_spot.test.ts +++ b/src/test/abilities/power_spot.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Power Spot", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); diff --git a/src/test/abilities/protean.test.ts b/src/test/abilities/protean.test.ts index 6255a2bc2b2..2f973197444 100644 --- a/src/test/abilities/protean.test.ts +++ b/src/test/abilities/protean.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Protean", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PROTEAN); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); diff --git a/src/test/abilities/quick_draw.test.ts b/src/test/abilities/quick_draw.test.ts index 9e6a39b86c9..3e9aab440fa 100644 --- a/src/test/abilities/quick_draw.test.ts +++ b/src/test/abilities/quick_draw.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Quick Draw", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.QUICK_DRAW); diff --git a/src/test/abilities/sand_veil.test.ts b/src/test/abilities/sand_veil.test.ts index 6adf8432914..82055732c8c 100644 --- a/src/test/abilities/sand_veil.test.ts +++ b/src/test/abilities/sand_veil.test.ts @@ -29,14 +29,15 @@ describe("Abilities - Sand Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEOWSCARADA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - game.override.weather(WeatherType.SANDSTORM); + game.override + .weather(WeatherType.SANDSTORM) + .battleType("double"); }); test( diff --git a/src/test/abilities/sap_sipper.test.ts b/src/test/abilities/sap_sipper.test.ts index 9fa2001a6ad..600239ef907 100644 --- a/src/test/abilities/sap_sipper.test.ts +++ b/src/test/abilities/sap_sipper.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Sap Sipper", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); }); diff --git a/src/test/abilities/schooling.test.ts b/src/test/abilities/schooling.test.ts index df9c4e6f065..c39c9d6ce80 100644 --- a/src/test/abilities/schooling.test.ts +++ b/src/test/abilities/schooling.test.ts @@ -28,7 +28,7 @@ describe("Abilities - SCHOOLING", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SCHOOLING); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/abilities/screen_cleaner.test.ts b/src/test/abilities/screen_cleaner.test.ts index 28253f9aaf6..efb14e8ef02 100644 --- a/src/test/abilities/screen_cleaner.test.ts +++ b/src/test/abilities/screen_cleaner.test.ts @@ -25,7 +25,7 @@ describe("Abilities - Screen Cleaner", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SCREEN_CLEANER); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); }); diff --git a/src/test/abilities/serene_grace.test.ts b/src/test/abilities/serene_grace.test.ts index 6530c3ebe15..d86c280eaab 100644 --- a/src/test/abilities/serene_grace.test.ts +++ b/src/test/abilities/serene_grace.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Serene Grace", () => { beforeEach(() => { game = new GameManager(phaserGame); const movesToUse = [Moves.AIR_SLASH, Moves.TACKLE]; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ONIX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); diff --git a/src/test/abilities/sheer_force.test.ts b/src/test/abilities/sheer_force.test.ts index 46bd92f0d56..0bd352aa142 100644 --- a/src/test/abilities/sheer_force.test.ts +++ b/src/test/abilities/sheer_force.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Sheer Force", () => { beforeEach(() => { game = new GameManager(phaserGame); const movesToUse = [Moves.AIR_SLASH, Moves.BIND, Moves.CRUSH_CLAW, Moves.TACKLE]; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ONIX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); diff --git a/src/test/abilities/shield_dust.test.ts b/src/test/abilities/shield_dust.test.ts index 472ba90caf9..4efb864a880 100644 --- a/src/test/abilities/shield_dust.test.ts +++ b/src/test/abilities/shield_dust.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Shield Dust", () => { beforeEach(() => { game = new GameManager(phaserGame); const movesToUse = [Moves.AIR_SLASH]; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ONIX); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHIELD_DUST); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/abilities/shields_down.test.ts b/src/test/abilities/shields_down.test.ts index a310148f041..ec13404b19c 100644 --- a/src/test/abilities/shields_down.test.ts +++ b/src/test/abilities/shields_down.test.ts @@ -28,7 +28,7 @@ describe("Abilities - SHIELDS DOWN", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHIELDS_DOWN); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/abilities/steely_spirit.test.ts b/src/test/abilities/steely_spirit.test.ts index 3e9993a7465..b0c0721a4e3 100644 --- a/src/test/abilities/steely_spirit.test.ts +++ b/src/test/abilities/steely_spirit.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Steely Spirit", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.IRON_HEAD, Moves.SPLASH]); diff --git a/src/test/abilities/sturdy.test.ts b/src/test/abilities/sturdy.test.ts index 0cfa45ef843..0459732ba87 100644 --- a/src/test/abilities/sturdy.test.ts +++ b/src/test/abilities/sturdy.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Sturdy", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.LUCARIO); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/abilities/unseen_fist.test.ts b/src/test/abilities/unseen_fist.test.ts index e6025cb0a6a..f2fcc6f0cce 100644 --- a/src/test/abilities/unseen_fist.test.ts +++ b/src/test/abilities/unseen_fist.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Unseen Fist", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.URSHIFU); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); diff --git a/src/test/abilities/volt_absorb.test.ts b/src/test/abilities/volt_absorb.test.ts index e8c47e1420e..2cbd3fd2533 100644 --- a/src/test/abilities/volt_absorb.test.ts +++ b/src/test/abilities/volt_absorb.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Volt Absorb", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); }); diff --git a/src/test/abilities/wind_power.test.ts b/src/test/abilities/wind_power.test.ts index 84869bd54a8..d57a5f76b38 100644 --- a/src/test/abilities/wind_power.test.ts +++ b/src/test/abilities/wind_power.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Wind Power", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHIFTRY); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_POWER); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); diff --git a/src/test/abilities/wind_rider.test.ts b/src/test/abilities/wind_rider.test.ts index d578c5a22dc..8b6fed67e97 100644 --- a/src/test/abilities/wind_rider.test.ts +++ b/src/test/abilities/wind_rider.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Wind Rider", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHIFTRY); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_RIDER); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); diff --git a/src/test/abilities/wonder_skin.test.ts b/src/test/abilities/wonder_skin.test.ts index cd23b2c359f..bdfde821382 100644 --- a/src/test/abilities/wonder_skin.test.ts +++ b/src/test/abilities/wonder_skin.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Wonder Skin", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.CHARM]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); diff --git a/src/test/abilities/zen_mode.test.ts b/src/test/abilities/zen_mode.test.ts index 7b8474170e9..9cd795d5d81 100644 --- a/src/test/abilities/zen_mode.test.ts +++ b/src/test/abilities/zen_mode.test.ts @@ -43,7 +43,7 @@ describe("Abilities - ZEN MODE", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); diff --git a/src/test/abilities/zero_to_hero.test.ts b/src/test/abilities/zero_to_hero.test.ts index 24187626f3d..78cc87ad592 100644 --- a/src/test/abilities/zero_to_hero.test.ts +++ b/src/test/abilities/zero_to_hero.test.ts @@ -28,7 +28,7 @@ describe("Abilities - ZERO TO HERO", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZERO_TO_HERO); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/arena/arena_gravity.test.ts b/src/test/arena/arena_gravity.test.ts index ae944758bc7..b26f846c5b5 100644 --- a/src/test/arena/arena_gravity.test.ts +++ b/src/test/arena/arena_gravity.test.ts @@ -29,7 +29,7 @@ describe("Arena - Gravity", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.GRAVITY, Moves.FISSURE]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/arena/weather_fog.test.ts b/src/test/arena/weather_fog.test.ts index 7c4536713a3..b2b277bcd79 100644 --- a/src/test/arena/weather_fog.test.ts +++ b/src/test/arena/weather_fog.test.ts @@ -28,8 +28,9 @@ describe("Weather - Fog", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.weather(WeatherType.FOG); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override + .weather(WeatherType.FOG) + .battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/arena/weather_strong_winds.test.ts b/src/test/arena/weather_strong_winds.test.ts index 906d6c71b0d..2225df80db5 100644 --- a/src/test/arena/weather_strong_winds.test.ts +++ b/src/test/arena/weather_strong_winds.test.ts @@ -27,7 +27,7 @@ describe("Weather - Strong Winds", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.TAILLOW); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DELTA_STREAM); diff --git a/src/test/battle/battle-order.test.ts b/src/test/battle/battle-order.test.ts index 0a6b9473ff1..130a71ff335 100644 --- a/src/test/battle/battle-order.test.ts +++ b/src/test/battle/battle-order.test.ts @@ -33,7 +33,7 @@ describe("Battle order", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); @@ -83,7 +83,7 @@ describe("Battle order", () => { }, 20000); it("double - both opponents faster than player 50/50 vs 150/150", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); await game.startBattle([ Species.BULBASAUR, Species.BLASTOISE, @@ -125,7 +125,7 @@ describe("Battle order", () => { }, 20000); it("double - speed tie except 1 - 100/100 vs 100/150", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); await game.startBattle([ Species.BULBASAUR, Species.BLASTOISE, @@ -166,7 +166,7 @@ describe("Battle order", () => { }, 20000); it("double - speed tie 100/150 vs 100/150", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); await game.startBattle([ Species.BULBASAUR, Species.BLASTOISE, diff --git a/src/test/battle/battle.test.ts b/src/test/battle/battle.test.ts index a185844e599..0e2a2a6275e 100644 --- a/src/test/battle/battle.test.ts +++ b/src/test/battle/battle.test.ts @@ -93,11 +93,12 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - game.override.startingWave(3); + game.override + .startingWave(3) + .battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); await game.startBattle(); game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex()); @@ -117,7 +118,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP]); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); await game.startBattle(); game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex()); @@ -204,7 +205,7 @@ describe("Test Battle Phase", () => { }, 20000); it("2vs1", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); @@ -217,7 +218,7 @@ describe("Test Battle Phase", () => { }, 20000); it("1vs1", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); @@ -229,7 +230,7 @@ describe("Test Battle Phase", () => { }, 20000); it("2vs2", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); @@ -243,7 +244,7 @@ describe("Test Battle Phase", () => { }, 20000); it("4vs2", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); @@ -260,7 +261,7 @@ describe("Test Battle Phase", () => { it("kill opponent pokemon", async() => { const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); @@ -289,7 +290,7 @@ describe("Test Battle Phase", () => { it("to next turn", async() => { const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); @@ -307,7 +308,7 @@ describe("Test Battle Phase", () => { it("to next wave with pokemon killed, single", async() => { const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); diff --git a/src/test/battle/error-handling.test.ts b/src/test/battle/error-handling.test.ts index e65a6867919..5ea0bd7fac0 100644 --- a/src/test/battle/error-handling.test.ts +++ b/src/test/battle/error-handling.test.ts @@ -23,13 +23,14 @@ describe("Test Battle Phase", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override + .battleType("single") + .startingWave(3); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/battle/special_battle.test.ts b/src/test/battle/special_battle.test.ts index 0a2b5d4106a..f958488c2db 100644 --- a/src/test/battle/special_battle.test.ts +++ b/src/test/battle/special_battle.test.ts @@ -35,8 +35,9 @@ describe("Test Battle Phase", () => { }); it("startBattle 2vs1 boss", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); - game.override.startingWave(10); + game.override + .battleType("single") + .startingWave(10); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -46,8 +47,9 @@ describe("Test Battle Phase", () => { }, 20000); it("startBattle 2vs2 boss", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - game.override.startingWave(10); + game.override + .battleType("double") + .startingWave(10); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -57,8 +59,9 @@ describe("Test Battle Phase", () => { }, 20000); it("startBattle 2vs2 trainer", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - game.override.startingWave(5); + game.override + .battleType("double") + .startingWave(5); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -68,8 +71,9 @@ describe("Test Battle Phase", () => { }, 20000); it("startBattle 2vs1 trainer", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); - game.override.startingWave(5); + game.override + .battleType("single") + .startingWave(5); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -79,8 +83,9 @@ describe("Test Battle Phase", () => { }, 20000); it("startBattle 2vs1 rival", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); - game.override.startingWave(8); + game.override + .battleType("single") + .startingWave(8); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -90,8 +95,9 @@ describe("Test Battle Phase", () => { }, 20000); it("startBattle 2vs2 rival", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - game.override.startingWave(8); + game.override + .battleType("double") + .startingWave(8); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -101,8 +107,9 @@ describe("Test Battle Phase", () => { }, 20000); it("startBattle 1vs1 trainer", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); - game.override.startingWave(5); + game.override + .battleType("single") + .startingWave(5); await game.startBattle([ Species.BLASTOISE, ]); @@ -111,8 +118,9 @@ describe("Test Battle Phase", () => { }, 20000); it("startBattle 2vs2 trainer", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - game.override.startingWave(5); + game.override + .battleType("double") + .startingWave(5); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -122,8 +130,9 @@ describe("Test Battle Phase", () => { }, 20000); it("startBattle 4vs2 trainer", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); - game.override.startingWave(5); + game.override + .battleType("double") + .startingWave(5); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, diff --git a/src/test/evolution.test.ts b/src/test/evolution.test.ts index 945e8363231..ad02c168fbc 100644 --- a/src/test/evolution.test.ts +++ b/src/test/evolution.test.ts @@ -24,7 +24,7 @@ describe("Evolution", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/items/eviolite.test.ts b/src/test/items/eviolite.test.ts index 5cdcf2256c3..2a0ee64a172 100644 --- a/src/test/items/eviolite.test.ts +++ b/src/test/items/eviolite.test.ts @@ -26,7 +26,7 @@ describe("Items - Eviolite", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); }); it("EVIOLITE activates in battle correctly", async() => { diff --git a/src/test/items/exp_booster.test.ts b/src/test/items/exp_booster.test.ts index 866bd6f08b6..75e0892efc6 100644 --- a/src/test/items/exp_booster.test.ts +++ b/src/test/items/exp_booster.test.ts @@ -25,7 +25,7 @@ describe("EXP Modifier Items", () => { vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); }); it("EXP booster items stack additively", async() => { diff --git a/src/test/items/grip_claw.test.ts b/src/test/items/grip_claw.test.ts index 2aeb98253ab..bfab8fbb5ea 100644 --- a/src/test/items/grip_claw.test.ts +++ b/src/test/items/grip_claw.test.ts @@ -30,7 +30,7 @@ describe("Items - Grip Claw", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POPULATION_BOMB, Moves.SPLASH ]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); diff --git a/src/test/items/leek.test.ts b/src/test/items/leek.test.ts index 2781de45c08..f120dede4a4 100644 --- a/src/test/items/leek.test.ts +++ b/src/test/items/leek.test.ts @@ -31,7 +31,7 @@ describe("Items - Leek", () => { vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); }); it("LEEK activates in battle correctly", async() => { diff --git a/src/test/items/leftovers.test.ts b/src/test/items/leftovers.test.ts index 1d564ae534c..b8b866a8a4d 100644 --- a/src/test/items/leftovers.test.ts +++ b/src/test/items/leftovers.test.ts @@ -25,7 +25,7 @@ describe("Items - Leftovers", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); diff --git a/src/test/items/light_ball.test.ts b/src/test/items/light_ball.test.ts index e693307e229..ed6ed8a4934 100644 --- a/src/test/items/light_ball.test.ts +++ b/src/test/items/light_ball.test.ts @@ -26,7 +26,7 @@ describe("Items - Light Ball", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); }); it("LIGHT_BALL activates in battle correctly", async() => { diff --git a/src/test/items/metal_powder.test.ts b/src/test/items/metal_powder.test.ts index 111bc6dfad1..f106b344f44 100644 --- a/src/test/items/metal_powder.test.ts +++ b/src/test/items/metal_powder.test.ts @@ -26,7 +26,7 @@ describe("Items - Metal Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); }); it("METAL_POWDER activates in battle correctly", async() => { diff --git a/src/test/items/quick_powder.test.ts b/src/test/items/quick_powder.test.ts index cddddb0eeea..0c71ec39ee4 100644 --- a/src/test/items/quick_powder.test.ts +++ b/src/test/items/quick_powder.test.ts @@ -26,7 +26,7 @@ describe("Items - Quick Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); }); it("QUICK_POWDER activates in battle correctly", async() => { diff --git a/src/test/items/scope_lens.test.ts b/src/test/items/scope_lens.test.ts index 8f54a880c41..6a7af5388e7 100644 --- a/src/test/items/scope_lens.test.ts +++ b/src/test/items/scope_lens.test.ts @@ -31,7 +31,7 @@ describe("Items - Scope Lens", () => { vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); }, 20000); it("SCOPE_LENS activates in battle correctly", async() => { diff --git a/src/test/items/thick_club.test.ts b/src/test/items/thick_club.test.ts index a0a229a5d13..9cb608b7e89 100644 --- a/src/test/items/thick_club.test.ts +++ b/src/test/items/thick_club.test.ts @@ -26,7 +26,7 @@ describe("Items - Thick Club", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); }); it("THICK_CLUB activates in battle correctly", async() => { diff --git a/src/test/items/toxic_orb.test.ts b/src/test/items/toxic_orb.test.ts index 45662ac29cf..80ca065940f 100644 --- a/src/test/items/toxic_orb.test.ts +++ b/src/test/items/toxic_orb.test.ts @@ -36,7 +36,7 @@ describe("Items - Toxic orb", () => { game = new GameManager(phaserGame); const moveToUse = Moves.GROWTH; const oppMoveToUse = Moves.TACKLE; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); diff --git a/src/test/localization/terrain.test.ts b/src/test/localization/terrain.test.ts index 08292bcdda7..6450d8574be 100644 --- a/src/test/localization/terrain.test.ts +++ b/src/test/localization/terrain.test.ts @@ -1,11 +1,10 @@ -import { beforeAll, describe, beforeEach, afterEach, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; import { TerrainType, getTerrainName } from "#app/data/terrain"; -import { getTerrainStartMessage, getTerrainClearMessage, getTerrainBlockMessage } from "#app/data/weather"; +import { getTerrainBlockMessage, getTerrainClearMessage, getTerrainStartMessage } from "#app/data/weather"; +import GameManager from "#app/test/utils/gameManager"; +import { Species } from "#enums/species"; import i18next from "i18next"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { mockI18next } from "../utils/testUtils"; describe("terrain", () => { @@ -21,7 +20,7 @@ describe("terrain", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); }); describe("NONE", () => { diff --git a/src/test/moves/astonish.test.ts b/src/test/moves/astonish.test.ts index 4ce2f16715b..01173f468b6 100644 --- a/src/test/moves/astonish.test.ts +++ b/src/test/moves/astonish.test.ts @@ -28,7 +28,7 @@ describe("Moves - Astonish", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ASTONISH, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.BLASTOISE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); diff --git a/src/test/moves/aurora_veil.test.ts b/src/test/moves/aurora_veil.test.ts index ead142c0792..c1052a1ef92 100644 --- a/src/test/moves/aurora_veil.test.ts +++ b/src/test/moves/aurora_veil.test.ts @@ -35,7 +35,7 @@ describe("Moves - Aurora Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); @@ -58,7 +58,7 @@ describe("Moves - Aurora Veil", () => { }); it("reduces damage of physical attacks by a third in a double battle", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); const moveToUse = Moves.ROCK_SLIDE; await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]); @@ -86,7 +86,7 @@ describe("Moves - Aurora Veil", () => { }); it("reduces damage of special attacks by a third in a double battle", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); const moveToUse = Moves.DAZZLING_GLEAM; await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]); diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index b92979c56ed..07a1a704940 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -32,7 +32,7 @@ describe("Moves - Ceaseless Edge", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); diff --git a/src/test/moves/double_team.test.ts b/src/test/moves/double_team.test.ts index de9bd01fd5b..f15ea0e04b2 100644 --- a/src/test/moves/double_team.test.ts +++ b/src/test/moves/double_team.test.ts @@ -27,7 +27,7 @@ describe("Moves - Double Team", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DOUBLE_TEAM]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index a6044044aa4..0151d1b0627 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -34,7 +34,7 @@ describe("Moves - Dragon Rage", () => { beforeEach(async () => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); diff --git a/src/test/moves/dynamax_cannon.test.ts b/src/test/moves/dynamax_cannon.test.ts index 94e45b045ee..b10131c318e 100644 --- a/src/test/moves/dynamax_cannon.test.ts +++ b/src/test/moves/dynamax_cannon.test.ts @@ -33,7 +33,7 @@ describe("Moves - Dynamax Cannon", () => { // Note that, for Waves 1-10, the level cap is 10 game.override.startingWave(1); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index f91c01ebbe2..f0fff8e0615 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -29,7 +29,7 @@ describe("Moves - Fissure", () => { beforeEach(async () => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); diff --git a/src/test/moves/flower_shield.test.ts b/src/test/moves/flower_shield.test.ts index c36a45790c7..923f6eff05d 100644 --- a/src/test/moves/flower_shield.test.ts +++ b/src/test/moves/flower_shield.test.ts @@ -32,7 +32,7 @@ describe("Moves - Flower Shield", () => { game = new GameManager(phaserGame); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLOWER_SHIELD, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); @@ -57,7 +57,7 @@ describe("Moves - Flower Shield", () => { it("increases defense of all Grass-type Pokemon on the field by one stage - double battle", async () => { vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); vi.spyOn(Overrides, "STARTING_BIOME_OVERRIDE", "get").mockReturnValue(Biome.GRASS); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); await game.startBattle([Species.CHERRIM, Species.MAGIKARP]); const field = game.scene.getField(true); diff --git a/src/test/moves/follow_me.test.ts b/src/test/moves/follow_me.test.ts index 738c9b6e837..bf427b6300a 100644 --- a/src/test/moves/follow_me.test.ts +++ b/src/test/moves/follow_me.test.ts @@ -32,7 +32,7 @@ describe("Moves - Follow Me", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/gastro_acid.test.ts b/src/test/moves/gastro_acid.test.ts index c8f6ab6cc6a..2c28b1b88b3 100644 --- a/src/test/moves/gastro_acid.test.ts +++ b/src/test/moves/gastro_acid.test.ts @@ -29,7 +29,7 @@ describe("Moves - Gastro Acid", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); @@ -72,7 +72,7 @@ describe("Moves - Gastro Acid", () => { }, TIMEOUT); it("fails if used on an enemy with an already-suppressed ability", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue(null); + game.override.battleType(null); await game.startBattle(); diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index 8cc2dc73b72..67991f07870 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -26,7 +26,7 @@ describe("Moves - Glaive Rush", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/moves/growth.test.ts b/src/test/moves/growth.test.ts index 6068c114fc3..b646da5445e 100644 --- a/src/test/moves/growth.test.ts +++ b/src/test/moves/growth.test.ts @@ -34,7 +34,7 @@ describe("Moves - Growth", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.GROWTH; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); diff --git a/src/test/moves/hard_press.test.ts b/src/test/moves/hard_press.test.ts index 8800d66bd9a..ba323685cb0 100644 --- a/src/test/moves/hard_press.test.ts +++ b/src/test/moves/hard_press.test.ts @@ -29,7 +29,7 @@ describe("Moves - Hard Press", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MUNCHLAX); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/moves/hyper_beam.test.ts b/src/test/moves/hyper_beam.test.ts index 2a6486c0de5..7df539fb5c0 100644 --- a/src/test/moves/hyper_beam.test.ts +++ b/src/test/moves/hyper_beam.test.ts @@ -29,7 +29,7 @@ describe("Moves - Hyper Beam", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/moves/light_screen.test.ts b/src/test/moves/light_screen.test.ts index 5269ec6d8ee..63ba9baa1f6 100644 --- a/src/test/moves/light_screen.test.ts +++ b/src/test/moves/light_screen.test.ts @@ -34,7 +34,7 @@ describe("Moves - Light Screen", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.DAZZLING_GLEAM, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); @@ -57,7 +57,7 @@ describe("Moves - Light Screen", () => { }); it("reduces damage of special attacks by a third in a double battle", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); const moveToUse = Moves.DAZZLING_GLEAM; await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]); diff --git a/src/test/moves/magnet_rise.test.ts b/src/test/moves/magnet_rise.test.ts index 2b06867f0a7..b57fe9448dc 100644 --- a/src/test/moves/magnet_rise.test.ts +++ b/src/test/moves/magnet_rise.test.ts @@ -23,7 +23,7 @@ describe("Moves - Magnet Rise", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.MAGNET_RISE; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGNEZONE); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]); diff --git a/src/test/moves/make_it_rain.test.ts b/src/test/moves/make_it_rain.test.ts index c578a70bb9c..7d273b1c51b 100644 --- a/src/test/moves/make_it_rain.test.ts +++ b/src/test/moves/make_it_rain.test.ts @@ -31,7 +31,7 @@ describe("Moves - Make It Rain", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MAKE_IT_RAIN, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); @@ -63,7 +63,7 @@ describe("Moves - Make It Rain", () => { it("should apply effects even if the target faints", async () => { vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); // ensures the enemy will faint - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); await game.startBattle([Species.CHARIZARD]); diff --git a/src/test/moves/multi_target.test.ts b/src/test/moves/multi_target.test.ts index 7548e9529d1..3d22872de69 100644 --- a/src/test/moves/multi_target.test.ts +++ b/src/test/moves/multi_target.test.ts @@ -164,7 +164,7 @@ function leaveOneEnemyPokemon(game: GameManager) { function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) { const game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE, Moves.HYPER_VOICE, Moves.SURF, Moves.SPLASH]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/moves/octolock.test.ts b/src/test/moves/octolock.test.ts index af96c2dc872..2c1b3e429ed 100644 --- a/src/test/moves/octolock.test.ts +++ b/src/test/moves/octolock.test.ts @@ -28,7 +28,7 @@ describe("Moves - Octolock", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/moves/purify.test.ts b/src/test/moves/purify.test.ts index 282d33f85f9..a8d28529d9f 100644 --- a/src/test/moves/purify.test.ts +++ b/src/test/moves/purify.test.ts @@ -29,7 +29,7 @@ describe("Moves - Purify", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.PYUKUMUKU); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10); diff --git a/src/test/moves/rage_powder.test.ts b/src/test/moves/rage_powder.test.ts index 3c315447b23..98a2572389e 100644 --- a/src/test/moves/rage_powder.test.ts +++ b/src/test/moves/rage_powder.test.ts @@ -31,7 +31,7 @@ describe("Moves - Rage Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/reflect.test.ts b/src/test/moves/reflect.test.ts index 9b57b3cdee3..dfc6d884ce3 100644 --- a/src/test/moves/reflect.test.ts +++ b/src/test/moves/reflect.test.ts @@ -34,7 +34,7 @@ describe("Moves - Reflect", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); @@ -56,7 +56,7 @@ describe("Moves - Reflect", () => { }); it("reduces damage of physical attacks by a third in a double battle", async() => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); const moveToUse = Moves.ROCK_SLIDE; await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]); diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index 6d8828455e4..9d7bf73f19a 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -27,7 +27,7 @@ describe("Moves - Rollout", () => { beforeEach(() => { game = new GameManager(phaserGame); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.BIDOOF); diff --git a/src/test/moves/roost.test.ts b/src/test/moves/roost.test.ts index 7f8495e1632..9411cf0ef35 100644 --- a/src/test/moves/roost.test.ts +++ b/src/test/moves/roost.test.ts @@ -27,7 +27,7 @@ describe("Moves - Roost", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.STARAPTOR); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index a4fc1a4baeb..fd52b6ae764 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -27,7 +27,7 @@ describe("Moves - Spikes", () => { beforeEach(() => { game = new GameManager(phaserGame); game.scene.battleStyle = 1; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); diff --git a/src/test/moves/spit_up.test.ts b/src/test/moves/spit_up.test.ts index f136d8f1e2b..f0ac0caa9d7 100644 --- a/src/test/moves/spit_up.test.ts +++ b/src/test/moves/spit_up.test.ts @@ -27,7 +27,7 @@ describe("Moves - Spit Up", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/moves/spotlight.test.ts b/src/test/moves/spotlight.test.ts index 88d276d3d61..b627b959336 100644 --- a/src/test/moves/spotlight.test.ts +++ b/src/test/moves/spotlight.test.ts @@ -31,7 +31,7 @@ describe("Moves - Spotlight", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/stockpile.test.ts b/src/test/moves/stockpile.test.ts index 1a23017c6b3..39730c812d4 100644 --- a/src/test/moves/stockpile.test.ts +++ b/src/test/moves/stockpile.test.ts @@ -27,7 +27,7 @@ describe("Moves - Stockpile", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/moves/swallow.test.ts b/src/test/moves/swallow.test.ts index 0dd4237c232..2b839ae2e86 100644 --- a/src/test/moves/swallow.test.ts +++ b/src/test/moves/swallow.test.ts @@ -26,7 +26,7 @@ describe("Moves - Swallow", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/moves/tackle.test.ts b/src/test/moves/tackle.test.ts index e36713fd086..147de6b0e33 100644 --- a/src/test/moves/tackle.test.ts +++ b/src/test/moves/tackle.test.ts @@ -31,7 +31,7 @@ describe("Moves - Tackle", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.TACKLE; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1); game.override.startingWave(97); diff --git a/src/test/moves/tail_whip.test.ts b/src/test/moves/tail_whip.test.ts index 662746db4eb..6fba92c6174 100644 --- a/src/test/moves/tail_whip.test.ts +++ b/src/test/moves/tail_whip.test.ts @@ -33,7 +33,7 @@ describe("Moves - Tail whip", () => { beforeEach(() => { game = new GameManager(phaserGame); const moveToUse = Moves.TAIL_WHIP; - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); diff --git a/src/test/moves/tailwind.test.ts b/src/test/moves/tailwind.test.ts index 535d0a1e525..a4c62f77275 100644 --- a/src/test/moves/tailwind.test.ts +++ b/src/test/moves/tailwind.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Wind Rider", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); + game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); @@ -55,7 +55,7 @@ describe("Abilities - Wind Rider", () => { }); it("lasts for 4 turns", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); await game.startBattle([Species.MAGIKARP]); @@ -78,7 +78,7 @@ describe("Abilities - Wind Rider", () => { }); it("does not affect the opposing side", async () => { - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/moves/thousand_arrows.test.ts b/src/test/moves/thousand_arrows.test.ts index 950e5228928..fdac2ade739 100644 --- a/src/test/moves/thousand_arrows.test.ts +++ b/src/test/moves/thousand_arrows.test.ts @@ -30,7 +30,7 @@ describe("Moves - Thousand Arrows", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.TOGETIC); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/tidy_up.test.ts b/src/test/moves/tidy_up.test.ts index 16312ce431a..6d436215db3 100644 --- a/src/test/moves/tidy_up.test.ts +++ b/src/test/moves/tidy_up.test.ts @@ -27,7 +27,7 @@ describe("Moves - Tidy Up", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/ui/transfer-item.test.ts b/src/test/ui/transfer-item.test.ts index ba0dce8d8b5..6f3f16deddb 100644 --- a/src/test/ui/transfer-item.test.ts +++ b/src/test/ui/transfer-item.test.ts @@ -33,7 +33,7 @@ describe("UI - Transfer Items", () => { beforeEach(async () => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); + game.override.battleType("single"); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.startingWave(1); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([ From 08e0531eae020f74ba42c7d57324a908759c3089 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:53:34 -0700 Subject: [PATCH 08/42] add OverridesHelper.enemySpecies() --- src/test/utils/overridesHelper.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index 4fe605b4cac..5d9472deb70 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -1,5 +1,6 @@ import { Weather, WeatherType } from "#app/data/weather"; import { Biome } from "#app/enums/biome"; +import { Species } from "#app/enums/species.js"; import * as GameMode from "#app/game-mode"; import { GameModes, getGameMode } from "#app/game-mode"; import Overrides from "#app/overrides"; @@ -92,6 +93,17 @@ export class OverridesHelper { return this; } + /** + * Override the enemy (pokemon) species + * @param species the (pokemon) species to set + * @returns this + */ + enemySpecies(species: Species): this { + vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(species); + this.log(`Enemy Pokemon species set to ${Species[species]} (=${species})!`); + return this; + } + private log(...params: any[]) { console.log("Overrides:", ...params); } From 6674fe4984a119752c35ee170eb263f820fcd0c4 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:57:37 -0700 Subject: [PATCH 09/42] allow `number` for OverridesHelper.enemySpecies() --- src/test/utils/overridesHelper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index 5d9472deb70..bdc92a47714 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -98,7 +98,7 @@ export class OverridesHelper { * @param species the (pokemon) species to set * @returns this */ - enemySpecies(species: Species): this { + enemySpecies(species: Species | number): this { vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(species); this.log(`Enemy Pokemon species set to ${Species[species]} (=${species})!`); return this; From 141c3f5a6ad50f43949455492e9958440dbfa19c Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 14:57:47 -0700 Subject: [PATCH 10/42] apply game.override.enemySpecies() --- src/test/abilities/ability_timing.test.ts | 2 +- src/test/abilities/aura_break.test.ts | 2 +- src/test/abilities/battery.test.ts | 2 +- src/test/abilities/disguise.test.ts | 2 +- src/test/abilities/dry_skin.test.ts | 2 +- src/test/abilities/hustle.test.ts | 2 +- src/test/abilities/ice_face.test.ts | 6 +++--- src/test/abilities/intimidate.test.ts | 2 +- src/test/abilities/intrepid_sword.test.ts | 2 +- src/test/abilities/libero.test.ts | 6 +++--- src/test/abilities/moxie.test.ts | 2 +- src/test/abilities/parental_bond.test.ts | 4 ++-- src/test/abilities/power_spot.test.ts | 2 +- src/test/abilities/protean.test.ts | 6 +++--- src/test/abilities/quick_draw.test.ts | 2 +- src/test/abilities/sand_veil.test.ts | 2 +- src/test/abilities/sap_sipper.test.ts | 12 ++++++------ src/test/abilities/screen_cleaner.test.ts | 2 +- src/test/abilities/serene_grace.test.ts | 2 +- src/test/abilities/sheer_force.test.ts | 2 +- src/test/abilities/shield_dust.test.ts | 2 +- src/test/abilities/steely_spirit.test.ts | 2 +- src/test/abilities/sturdy.test.ts | 2 +- src/test/abilities/unseen_fist.test.ts | 2 +- src/test/abilities/volt_absorb.test.ts | 2 +- src/test/abilities/wind_power.test.ts | 8 ++++---- src/test/abilities/wind_rider.test.ts | 10 +++++----- src/test/abilities/wonder_skin.test.ts | 2 +- src/test/abilities/zen_mode.test.ts | 2 +- src/test/achievements/achievement.test.ts | 2 +- src/test/arena/arena_gravity.test.ts | 2 +- src/test/arena/weather_fog.test.ts | 2 +- src/test/arena/weather_strong_winds.test.ts | 4 ++-- src/test/battle/battle-order.test.ts | 2 +- src/test/battle/battle.test.ts | 18 +++++++++--------- src/test/battle/error-handling.test.ts | 2 +- src/test/battle/special_battle.test.ts | 2 +- src/test/evolution.test.ts | 2 +- src/test/items/grip_claw.test.ts | 2 +- src/test/items/leek.test.ts | 2 +- src/test/items/leftovers.test.ts | 2 +- src/test/items/scope_lens.test.ts | 2 +- src/test/items/toxic_orb.test.ts | 2 +- src/test/moves/astonish.test.ts | 2 +- src/test/moves/aurora_veil.test.ts | 2 +- src/test/moves/ceaseless_edge.test.ts | 2 +- src/test/moves/double_team.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 2 +- src/test/moves/dynamax_cannon.test.ts | 2 +- src/test/moves/fissure.test.ts | 2 +- src/test/moves/flower_shield.test.ts | 8 ++++---- src/test/moves/follow_me.test.ts | 2 +- src/test/moves/gastro_acid.test.ts | 2 +- src/test/moves/glaive_rush.test.ts | 2 +- src/test/moves/growth.test.ts | 2 +- src/test/moves/hard_press.test.ts | 2 +- src/test/moves/hyper_beam.test.ts | 2 +- src/test/moves/light_screen.test.ts | 2 +- src/test/moves/magnet_rise.test.ts | 2 +- src/test/moves/make_it_rain.test.ts | 2 +- src/test/moves/multi_target.test.ts | 2 +- src/test/moves/octolock.test.ts | 2 +- src/test/moves/purify.test.ts | 2 +- src/test/moves/rage_powder.test.ts | 2 +- src/test/moves/reflect.test.ts | 2 +- src/test/moves/rollout.test.ts | 2 +- src/test/moves/roost.test.ts | 2 +- src/test/moves/spikes.test.ts | 4 ++-- src/test/moves/spit_up.test.ts | 2 +- src/test/moves/spotlight.test.ts | 2 +- src/test/moves/stockpile.test.ts | 2 +- src/test/moves/swallow.test.ts | 2 +- src/test/moves/tackle.test.ts | 4 ++-- src/test/moves/tail_whip.test.ts | 2 +- src/test/moves/thousand_arrows.test.ts | 6 +++--- src/test/moves/tidy_up.test.ts | 2 +- src/test/ui/transfer-item.test.ts | 2 +- 77 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/test/abilities/ability_timing.test.ts b/src/test/abilities/ability_timing.test.ts index 61f419e5fe5..894bb7c7e6b 100644 --- a/src/test/abilities/ability_timing.test.ts +++ b/src/test/abilities/ability_timing.test.ts @@ -28,7 +28,7 @@ describe("Ability Timing", () => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.PIDGEY); + game.override.enemySpecies(Species.PIDGEY); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.SPLASH)); diff --git a/src/test/abilities/aura_break.test.ts b/src/test/abilities/aura_break.test.ts index 65b2b44448a..2b3ebc5d6fb 100644 --- a/src/test/abilities/aura_break.test.ts +++ b/src/test/abilities/aura_break.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Aura Break", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MOONBLAST, Moves.DARK_PULSE, Moves.MOONBLAST, Moves.DARK_PULSE]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.AURA_BREAK); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); }); it("reverses the effect of fairy aura", async () => { diff --git a/src/test/abilities/battery.test.ts b/src/test/abilities/battery.test.ts index 62926b8c7dc..9347ba754e5 100644 --- a/src/test/abilities/battery.test.ts +++ b/src/test/abilities/battery.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Battery", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index 87ac53963fb..ee9160a8e4f 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -74,7 +74,7 @@ describe("Abilities - DISGUISE", () => { vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(20); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(20); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.MIMIKYU]: baseForm, }); diff --git a/src/test/abilities/dry_skin.test.ts b/src/test/abilities/dry_skin.test.ts index dbfe1fe761a..4d3502567d9 100644 --- a/src/test/abilities/dry_skin.test.ts +++ b/src/test/abilities/dry_skin.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Dry Skin", () => { vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DRY_SKIN); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.CHARMANDER); + game.override.enemySpecies(Species.CHARMANDER); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.CHANDELURE); }); diff --git a/src/test/abilities/hustle.test.ts b/src/test/abilities/hustle.test.ts index 853dd9bc904..2de86b54973 100644 --- a/src/test/abilities/hustle.test.ts +++ b/src/test/abilities/hustle.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Hustle", () => { vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); }); diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index e50c5dfd3d6..f696d9943dc 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Ice Face", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.EISCUE); + game.override.enemySpecies(Species.EISCUE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ICE_FACE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.ICE_BEAM, Moves.TOXIC_THREAD, Moves.HAIL]); }); @@ -158,7 +158,7 @@ describe("Abilities - Ice Face", () => { }); it("will not revert to its Ice Face if there is already Hail when it changes into Noice", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); await game.startBattle([Species.EISCUE]); @@ -204,7 +204,7 @@ describe("Abilities - Ice Face", () => { it("reverts to Ice Face on arena reset", async () => { game.override.startingWave(4); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(4); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.EISCUE]: noiceForm, }); diff --git a/src/test/abilities/intimidate.test.ts b/src/test/abilities/intimidate.test.ts index 709e60ea250..fbcd858415a 100644 --- a/src/test/abilities/intimidate.test.ts +++ b/src/test/abilities/intimidate.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Intimidate", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); diff --git a/src/test/abilities/intrepid_sword.test.ts b/src/test/abilities/intrepid_sword.test.ts index e803db2c049..878c5dbb0dc 100644 --- a/src/test/abilities/intrepid_sword.test.ts +++ b/src/test/abilities/intrepid_sword.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Intrepid Sword", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ZACIAN); + game.override.enemySpecies(Species.ZACIAN); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTREPID_SWORD); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTREPID_SWORD); }); diff --git a/src/test/abilities/libero.test.ts b/src/test/abilities/libero.test.ts index 3e8cbbfe387..bde6d74f74f 100644 --- a/src/test/abilities/libero.test.ts +++ b/src/test/abilities/libero.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Protean", () => { game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LIBERO); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); }); @@ -226,7 +226,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the pokemon's move fails because of type immunity", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GASTLY); + game.override.enemySpecies(Species.GASTLY); await game.startBattle([Species.MAGIKARP]); @@ -320,7 +320,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TRICK_OR_TREAT]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GASTLY); + game.override.enemySpecies(Species.GASTLY); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/moxie.test.ts b/src/test/abilities/moxie.test.ts index d1be9b7acbf..50c0b58b900 100644 --- a/src/test/abilities/moxie.test.ts +++ b/src/test/abilities/moxie.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Moxie", () => { game = new GameManager(phaserGame); const moveToUse = Moves.AERIAL_ACE; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index 609228de30f..c6e7cc4c95a 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -33,7 +33,7 @@ describe("Abilities - Parental Bond", () => { game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PARENTAL_BOND); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); @@ -76,7 +76,7 @@ describe("Abilities - Parental Bond", () => { "ability should apply secondary effects to both strikes", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.POWER_UP_PUNCH]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); + game.override.enemySpecies(Species.AMOONGUSS); await game.startBattle([Species.CHARIZARD]); diff --git a/src/test/abilities/power_spot.test.ts b/src/test/abilities/power_spot.test.ts index ca4ae543871..a9db0c3bea1 100644 --- a/src/test/abilities/power_spot.test.ts +++ b/src/test/abilities/power_spot.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Power Spot", () => { game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); }); diff --git a/src/test/abilities/protean.test.ts b/src/test/abilities/protean.test.ts index 2f973197444..a47777a01c1 100644 --- a/src/test/abilities/protean.test.ts +++ b/src/test/abilities/protean.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Protean", () => { game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PROTEAN); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); }); @@ -226,7 +226,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the pokemon's move fails because of type immunity", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GASTLY); + game.override.enemySpecies(Species.GASTLY); await game.startBattle([Species.MAGIKARP]); @@ -320,7 +320,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TRICK_OR_TREAT]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GASTLY); + game.override.enemySpecies(Species.GASTLY); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/quick_draw.test.ts b/src/test/abilities/quick_draw.test.ts index 3e9aab440fa..d6a4ef8038f 100644 --- a/src/test/abilities/quick_draw.test.ts +++ b/src/test/abilities/quick_draw.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Quick Draw", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TAIL_WHIP]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.TACKLE)); diff --git a/src/test/abilities/sand_veil.test.ts b/src/test/abilities/sand_veil.test.ts index 82055732c8c..dbdc9699600 100644 --- a/src/test/abilities/sand_veil.test.ts +++ b/src/test/abilities/sand_veil.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Sand Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEOWSCARADA); + game.override.enemySpecies(Species.MEOWSCARADA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/abilities/sap_sipper.test.ts b/src/test/abilities/sap_sipper.test.ts index 600239ef907..bc19531e46f 100644 --- a/src/test/abilities/sap_sipper.test.ts +++ b/src/test/abilities/sap_sipper.test.ts @@ -40,7 +40,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.DUSKULL); + game.override.enemySpecies(Species.DUSKULL); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); await game.startBattle(); @@ -61,7 +61,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); await game.startBattle(); @@ -80,7 +80,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); await game.startBattle(); @@ -100,7 +100,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); await game.startBattle(); @@ -122,7 +122,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); await game.startBattle(); @@ -147,7 +147,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); await game.startBattle(); diff --git a/src/test/abilities/screen_cleaner.test.ts b/src/test/abilities/screen_cleaner.test.ts index efb14e8ef02..864f088bdcf 100644 --- a/src/test/abilities/screen_cleaner.test.ts +++ b/src/test/abilities/screen_cleaner.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Screen Cleaner", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SCREEN_CLEANER); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); }); it("removes Aurora Veil", async () => { diff --git a/src/test/abilities/serene_grace.test.ts b/src/test/abilities/serene_grace.test.ts index d86c280eaab..e8d1f242041 100644 --- a/src/test/abilities/serene_grace.test.ts +++ b/src/test/abilities/serene_grace.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Serene Grace", () => { game = new GameManager(phaserGame); const movesToUse = [Moves.AIR_SLASH, Moves.TACKLE]; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ONIX); + game.override.enemySpecies(Species.ONIX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/abilities/sheer_force.test.ts b/src/test/abilities/sheer_force.test.ts index 0bd352aa142..f6477783f6c 100644 --- a/src/test/abilities/sheer_force.test.ts +++ b/src/test/abilities/sheer_force.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Sheer Force", () => { game = new GameManager(phaserGame); const movesToUse = [Moves.AIR_SLASH, Moves.BIND, Moves.CRUSH_CLAW, Moves.TACKLE]; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ONIX); + game.override.enemySpecies(Species.ONIX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/abilities/shield_dust.test.ts b/src/test/abilities/shield_dust.test.ts index 4efb864a880..186c5c3c6ad 100644 --- a/src/test/abilities/shield_dust.test.ts +++ b/src/test/abilities/shield_dust.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Shield Dust", () => { game = new GameManager(phaserGame); const movesToUse = [Moves.AIR_SLASH]; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ONIX); + game.override.enemySpecies(Species.ONIX); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHIELD_DUST); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); diff --git a/src/test/abilities/steely_spirit.test.ts b/src/test/abilities/steely_spirit.test.ts index b0c0721a4e3..374aef0ce2f 100644 --- a/src/test/abilities/steely_spirit.test.ts +++ b/src/test/abilities/steely_spirit.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Steely Spirit", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.IRON_HEAD, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/abilities/sturdy.test.ts b/src/test/abilities/sturdy.test.ts index 0459732ba87..d4c4ee66761 100644 --- a/src/test/abilities/sturdy.test.ts +++ b/src/test/abilities/sturdy.test.ts @@ -36,7 +36,7 @@ describe("Abilities - Sturdy", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.CLOSE_COMBAT, Moves.FISSURE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.ARON); + game.override.enemySpecies(Species.ARON); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.STURDY); }); diff --git a/src/test/abilities/unseen_fist.test.ts b/src/test/abilities/unseen_fist.test.ts index f2fcc6f0cce..6760b1098ba 100644 --- a/src/test/abilities/unseen_fist.test.ts +++ b/src/test/abilities/unseen_fist.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Unseen Fist", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.URSHIFU); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/abilities/volt_absorb.test.ts b/src/test/abilities/volt_absorb.test.ts index 2cbd3fd2533..881d745eed6 100644 --- a/src/test/abilities/volt_absorb.test.ts +++ b/src/test/abilities/volt_absorb.test.ts @@ -40,7 +40,7 @@ describe("Abilities - Volt Absorb", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.DUSKULL); + game.override.enemySpecies(Species.DUSKULL); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); await game.startBattle(); diff --git a/src/test/abilities/wind_power.test.ts b/src/test/abilities/wind_power.test.ts index d57a5f76b38..b7539f0188b 100644 --- a/src/test/abilities/wind_power.test.ts +++ b/src/test/abilities/wind_power.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Wind Power", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHIFTRY); + game.override.enemySpecies(Species.SHIFTRY); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_POWER); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); @@ -48,7 +48,7 @@ describe("Abilities - Wind Power", () => { it("it becomes charged when Tailwind takes effect on its side", async () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_POWER); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.SHIFTRY]); const shiftry = game.scene.getPlayerPokemon(); @@ -62,7 +62,7 @@ describe("Abilities - Wind Power", () => { }); it("does not become charged when Tailwind takes effect on opposing side", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_POWER); await game.startBattle([Species.SHIFTRY]); @@ -81,7 +81,7 @@ describe("Abilities - Wind Power", () => { }); it("does not interact with Sandstorm", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.SHIFTRY]); const shiftry = game.scene.getPlayerPokemon(); diff --git a/src/test/abilities/wind_rider.test.ts b/src/test/abilities/wind_rider.test.ts index 8b6fed67e97..ec09b39c539 100644 --- a/src/test/abilities/wind_rider.test.ts +++ b/src/test/abilities/wind_rider.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Wind Rider", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHIFTRY); + game.override.enemySpecies(Species.SHIFTRY); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_RIDER); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); @@ -50,7 +50,7 @@ describe("Abilities - Wind Rider", () => { it("Attack is increased by one stage when Tailwind is present on its side", async () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_RIDER); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.SHIFTRY]); const shiftry = game.scene.getPlayerPokemon(); @@ -66,7 +66,7 @@ describe("Abilities - Wind Rider", () => { it("does not increase Attack when Tailwind is present on opposing side", async () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_RIDER); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.SHIFTRY]); const magikarp = game.scene.getEnemyPokemon(); @@ -84,7 +84,7 @@ describe("Abilities - Wind Rider", () => { }); it("does not increase Attack when Tailwind is present on opposing side", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.SHIFTRY]); const magikarp = game.scene.getEnemyPokemon(); @@ -102,7 +102,7 @@ describe("Abilities - Wind Rider", () => { }); it("does not interact with Sandstorm", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.SHIFTRY]); const shiftry = game.scene.getPlayerPokemon(); diff --git a/src/test/abilities/wonder_skin.test.ts b/src/test/abilities/wonder_skin.test.ts index bdfde821382..a38ec41fa2d 100644 --- a/src/test/abilities/wonder_skin.test.ts +++ b/src/test/abilities/wonder_skin.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Wonder Skin", () => { game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.CHARM]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WONDER_SKIN); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); diff --git a/src/test/abilities/zen_mode.test.ts b/src/test/abilities/zen_mode.test.ts index 9cd795d5d81..1119b4cdb90 100644 --- a/src/test/abilities/zen_mode.test.ts +++ b/src/test/abilities/zen_mode.test.ts @@ -44,7 +44,7 @@ describe("Abilities - ZEN MODE", () => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/achievements/achievement.test.ts b/src/test/achievements/achievement.test.ts index 207293d1973..162c8c81ee3 100644 --- a/src/test/achievements/achievement.test.ts +++ b/src/test/achievements/achievement.test.ts @@ -104,11 +104,11 @@ describe("RibbonAchv", () => { beforeEach(() => { vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(0); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(0); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(0); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([]); game = new GameManager(phaserGame); + game.override.enemySpecies(0); game.override.startingWave(0); scene = game.scene; }); diff --git a/src/test/arena/arena_gravity.test.ts b/src/test/arena/arena_gravity.test.ts index b26f846c5b5..0e5b7b992a7 100644 --- a/src/test/arena/arena_gravity.test.ts +++ b/src/test/arena/arena_gravity.test.ts @@ -33,7 +33,7 @@ describe("Arena - Gravity", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.GRAVITY, Moves.FISSURE]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(new Array(4).fill(Moves.SPLASH)); }); diff --git a/src/test/arena/weather_fog.test.ts b/src/test/arena/weather_fog.test.ts index b2b277bcd79..b11d3728f10 100644 --- a/src/test/arena/weather_fog.test.ts +++ b/src/test/arena/weather_fog.test.ts @@ -34,7 +34,7 @@ describe("Weather - Fog", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(new Array(4).fill(Moves.SPLASH)); }); diff --git a/src/test/arena/weather_strong_winds.test.ts b/src/test/arena/weather_strong_winds.test.ts index 2225df80db5..245b1bcf74a 100644 --- a/src/test/arena/weather_strong_winds.test.ts +++ b/src/test/arena/weather_strong_winds.test.ts @@ -29,13 +29,13 @@ describe("Weather - Strong Winds", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.TAILLOW); + game.override.enemySpecies(Species.TAILLOW); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DELTA_STREAM); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.THUNDERBOLT, Moves.ICE_BEAM, Moves.ROCK_SLIDE]); }); it("electric type move is not very effective on Rayquaza", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RAYQUAZA); + game.override.enemySpecies(Species.RAYQUAZA); await game.startBattle([Species.PIKACHU]); const pikachu = game.scene.getPlayerPokemon(); diff --git a/src/test/battle/battle-order.test.ts b/src/test/battle/battle-order.test.ts index 130a71ff335..55753951881 100644 --- a/src/test/battle/battle-order.test.ts +++ b/src/test/battle/battle-order.test.ts @@ -34,7 +34,7 @@ describe("Battle order", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); + game.override.enemySpecies(Species.MEWTWO); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); diff --git a/src/test/battle/battle.test.ts b/src/test/battle/battle.test.ts index 0e2a2a6275e..f2dc328ac47 100644 --- a/src/test/battle/battle.test.ts +++ b/src/test/battle/battle.test.ts @@ -91,7 +91,7 @@ describe("Test Battle Phase", () => { it("do attack wave 3 - single battle - regular - OHKO", async() => { vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override .startingWave(3) @@ -112,7 +112,7 @@ describe("Test Battle Phase", () => { it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async() => { vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); @@ -206,7 +206,7 @@ describe("Test Battle Phase", () => { it("2vs1", async() => { game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); + game.override.enemySpecies(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); await game.startBattle([ @@ -219,7 +219,7 @@ describe("Test Battle Phase", () => { it("1vs1", async() => { game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); + game.override.enemySpecies(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); await game.startBattle([ @@ -231,7 +231,7 @@ describe("Test Battle Phase", () => { it("2vs2", async() => { game.override.battleType("double"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); + game.override.enemySpecies(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.startingWave(3); @@ -245,7 +245,7 @@ describe("Test Battle Phase", () => { it("4vs2", async() => { game.override.battleType("double"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MIGHTYENA); + game.override.enemySpecies(Species.MIGHTYENA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.startingWave(3); @@ -263,7 +263,7 @@ describe("Test Battle Phase", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); @@ -292,7 +292,7 @@ describe("Test Battle Phase", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); @@ -310,7 +310,7 @@ describe("Test Battle Phase", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/battle/error-handling.test.ts b/src/test/battle/error-handling.test.ts index 5ea0bd7fac0..c7bb45e8180 100644 --- a/src/test/battle/error-handling.test.ts +++ b/src/test/battle/error-handling.test.ts @@ -27,7 +27,7 @@ describe("Test Battle Phase", () => { .battleType("single") .startingWave(3); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/battle/special_battle.test.ts b/src/test/battle/special_battle.test.ts index f958488c2db..34bdac1f306 100644 --- a/src/test/battle/special_battle.test.ts +++ b/src/test/battle/special_battle.test.ts @@ -26,7 +26,7 @@ describe("Test Battle Phase", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); diff --git a/src/test/evolution.test.ts b/src/test/evolution.test.ts index ad02c168fbc..60e3392b281 100644 --- a/src/test/evolution.test.ts +++ b/src/test/evolution.test.ts @@ -26,7 +26,7 @@ describe("Evolution", () => { game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(60); diff --git a/src/test/items/grip_claw.test.ts b/src/test/items/grip_claw.test.ts index bfab8fbb5ea..defa55ca5f1 100644 --- a/src/test/items/grip_claw.test.ts +++ b/src/test/items/grip_claw.test.ts @@ -33,7 +33,7 @@ describe("Items - Grip Claw", () => { game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POPULATION_BOMB, Moves.SPLASH ]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.KLUTZ); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([ diff --git a/src/test/items/leek.test.ts b/src/test/items/leek.test.ts index f120dede4a4..a6268a397a8 100644 --- a/src/test/items/leek.test.ts +++ b/src/test/items/leek.test.ts @@ -27,7 +27,7 @@ describe("Items - Leek", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/items/leftovers.test.ts b/src/test/items/leftovers.test.ts index b8b866a8a4d..5cea7be42ba 100644 --- a/src/test/items/leftovers.test.ts +++ b/src/test/items/leftovers.test.ts @@ -29,7 +29,7 @@ describe("Items - Leftovers", () => { vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); - vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); vi.spyOn(overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "LEFTOVERS", count: 1}]); diff --git a/src/test/items/scope_lens.test.ts b/src/test/items/scope_lens.test.ts index 6a7af5388e7..9ba5b96ed07 100644 --- a/src/test/items/scope_lens.test.ts +++ b/src/test/items/scope_lens.test.ts @@ -27,7 +27,7 @@ describe("Items - Scope Lens", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/items/toxic_orb.test.ts b/src/test/items/toxic_orb.test.ts index 80ca065940f..132d939be9f 100644 --- a/src/test/items/toxic_orb.test.ts +++ b/src/test/items/toxic_orb.test.ts @@ -37,7 +37,7 @@ describe("Items - Toxic orb", () => { const moveToUse = Moves.GROWTH; const oppMoveToUse = Moves.TACKLE; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/moves/astonish.test.ts b/src/test/moves/astonish.test.ts index 01173f468b6..9a6d2df5e0b 100644 --- a/src/test/moves/astonish.test.ts +++ b/src/test/moves/astonish.test.ts @@ -30,7 +30,7 @@ describe("Moves - Astonish", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ASTONISH, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.BLASTOISE); + game.override.enemySpecies(Species.BLASTOISE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/aurora_veil.test.ts b/src/test/moves/aurora_veil.test.ts index c1052a1ef92..3922d86a74d 100644 --- a/src/test/moves/aurora_veil.test.ts +++ b/src/test/moves/aurora_veil.test.ts @@ -39,7 +39,7 @@ describe("Moves - Aurora Veil", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.weather(WeatherType.HAIL); diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index 07a1a704940..f6766ee2441 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -33,7 +33,7 @@ describe("Moves - Ceaseless Edge", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/double_team.test.ts b/src/test/moves/double_team.test.ts index f15ea0e04b2..da623b7ba92 100644 --- a/src/test/moves/double_team.test.ts +++ b/src/test/moves/double_team.test.ts @@ -31,7 +31,7 @@ describe("Moves - Double Team", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DOUBLE_TEAM]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); + game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index 0151d1b0627..ae6768e6688 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -43,7 +43,7 @@ describe("Moves - Dragon Rage", () => { vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/moves/dynamax_cannon.test.ts b/src/test/moves/dynamax_cannon.test.ts index b10131c318e..94900747662 100644 --- a/src/test/moves/dynamax_cannon.test.ts +++ b/src/test/moves/dynamax_cannon.test.ts @@ -36,7 +36,7 @@ describe("Moves - Dynamax Cannon", () => { game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(dynamaxCannon, "calculateBattlePower"); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index f0fff8e0615..b6bb37363e7 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -37,7 +37,7 @@ describe("Moves - Fissure", () => { vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/flower_shield.test.ts b/src/test/moves/flower_shield.test.ts index 923f6eff05d..7eb495672ae 100644 --- a/src/test/moves/flower_shield.test.ts +++ b/src/test/moves/flower_shield.test.ts @@ -38,7 +38,7 @@ describe("Moves - Flower Shield", () => { }); it("increases defense of all Grass-type Pokemon on the field by one stage - single battle", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.CHERRIM); + game.override.enemySpecies(Species.CHERRIM); await game.startBattle([Species.MAGIKARP]); const cherrim = game.scene.getEnemyPokemon(); @@ -55,7 +55,7 @@ describe("Moves - Flower Shield", () => { }); it("increases defense of all Grass-type Pokemon on the field by one stage - double battle", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "STARTING_BIOME_OVERRIDE", "get").mockReturnValue(Biome.GRASS); game.override.battleType("double"); @@ -80,7 +80,7 @@ describe("Moves - Flower Shield", () => { * See semi-vulnerable state tags. {@linkcode SemiInvulnerableTag} */ it("does not increase defense of a pokemon in semi-vulnerable state", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.PARAS); + game.override.enemySpecies(Species.PARAS); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DIG, Moves.DIG, Moves.DIG, Moves.DIG]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(50); @@ -101,7 +101,7 @@ describe("Moves - Flower Shield", () => { }); it("does nothing if there are no Grass-type pokemon on the field", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.MAGIKARP]); const enemy = game.scene.getEnemyPokemon(); diff --git a/src/test/moves/follow_me.test.ts b/src/test/moves/follow_me.test.ts index bf427b6300a..9d2dc016872 100644 --- a/src/test/moves/follow_me.test.ts +++ b/src/test/moves/follow_me.test.ts @@ -34,7 +34,7 @@ describe("Moves - Follow Me", () => { game = new GameManager(phaserGame); game.override.battleType("double"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); diff --git a/src/test/moves/gastro_acid.test.ts b/src/test/moves/gastro_acid.test.ts index 2c28b1b88b3..1c4028a351f 100644 --- a/src/test/moves/gastro_acid.test.ts +++ b/src/test/moves/gastro_acid.test.ts @@ -34,7 +34,7 @@ describe("Moves - Gastro Acid", () => { vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.BIDOOF); + game.override.enemySpecies(Species.BIDOOF); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WATER_ABSORB); }); diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index 67991f07870..4ed85fa74e8 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -28,7 +28,7 @@ describe("Moves - Glaive Rush", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.GLAIVE_RUSH)); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.KLINK); diff --git a/src/test/moves/growth.test.ts b/src/test/moves/growth.test.ts index b646da5445e..9a057fbc03b 100644 --- a/src/test/moves/growth.test.ts +++ b/src/test/moves/growth.test.ts @@ -35,7 +35,7 @@ describe("Moves - Growth", () => { game = new GameManager(phaserGame); const moveToUse = Moves.GROWTH; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/moves/hard_press.test.ts b/src/test/moves/hard_press.test.ts index ba323685cb0..1e607bc20fb 100644 --- a/src/test/moves/hard_press.test.ts +++ b/src/test/moves/hard_press.test.ts @@ -31,7 +31,7 @@ describe("Moves - Hard Press", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MUNCHLAX); + game.override.enemySpecies(Species.MUNCHLAX); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HARD_PRESS]); diff --git a/src/test/moves/hyper_beam.test.ts b/src/test/moves/hyper_beam.test.ts index 7df539fb5c0..480522ace4d 100644 --- a/src/test/moves/hyper_beam.test.ts +++ b/src/test/moves/hyper_beam.test.ts @@ -31,7 +31,7 @@ describe("Moves - Hyper Beam", () => { game.override.battleType("single"); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.SPLASH)); diff --git a/src/test/moves/light_screen.test.ts b/src/test/moves/light_screen.test.ts index 63ba9baa1f6..60220b71a1c 100644 --- a/src/test/moves/light_screen.test.ts +++ b/src/test/moves/light_screen.test.ts @@ -38,7 +38,7 @@ describe("Moves - Light Screen", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.DAZZLING_GLEAM, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); }); diff --git a/src/test/moves/magnet_rise.test.ts b/src/test/moves/magnet_rise.test.ts index b57fe9448dc..ddfa068fe4b 100644 --- a/src/test/moves/magnet_rise.test.ts +++ b/src/test/moves/magnet_rise.test.ts @@ -25,7 +25,7 @@ describe("Moves - Magnet Rise", () => { const moveToUse = Moves.MAGNET_RISE; game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGNEZONE); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); diff --git a/src/test/moves/make_it_rain.test.ts b/src/test/moves/make_it_rain.test.ts index 7d273b1c51b..d44fd252ba1 100644 --- a/src/test/moves/make_it_rain.test.ts +++ b/src/test/moves/make_it_rain.test.ts @@ -33,7 +33,7 @@ describe("Moves - Make It Rain", () => { game = new GameManager(phaserGame); game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MAKE_IT_RAIN, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/multi_target.test.ts b/src/test/moves/multi_target.test.ts index 3d22872de69..268d582156b 100644 --- a/src/test/moves/multi_target.test.ts +++ b/src/test/moves/multi_target.test.ts @@ -171,7 +171,7 @@ function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) { vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(50); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(40); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.EEVEE); + game.override.enemySpecies(Species.EEVEE); return game; } diff --git a/src/test/moves/octolock.test.ts b/src/test/moves/octolock.test.ts index 2c1b3e429ed..ada806fd4d0 100644 --- a/src/test/moves/octolock.test.ts +++ b/src/test/moves/octolock.test.ts @@ -30,7 +30,7 @@ describe("Moves - Octolock", () => { game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); diff --git a/src/test/moves/purify.test.ts b/src/test/moves/purify.test.ts index a8d28529d9f..551ecddbb64 100644 --- a/src/test/moves/purify.test.ts +++ b/src/test/moves/purify.test.ts @@ -35,7 +35,7 @@ describe("Moves - Purify", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PURIFY, Moves.SIZZLY_SLIDE]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(10); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); }); diff --git a/src/test/moves/rage_powder.test.ts b/src/test/moves/rage_powder.test.ts index 98a2572389e..779be067a95 100644 --- a/src/test/moves/rage_powder.test.ts +++ b/src/test/moves/rage_powder.test.ts @@ -33,7 +33,7 @@ describe("Moves - Rage Powder", () => { game = new GameManager(phaserGame); game.override.battleType("double"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); diff --git a/src/test/moves/reflect.test.ts b/src/test/moves/reflect.test.ts index dfc6d884ce3..2d4d791b902 100644 --- a/src/test/moves/reflect.test.ts +++ b/src/test/moves/reflect.test.ts @@ -38,7 +38,7 @@ describe("Moves - Reflect", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.REFLECT, Moves.REFLECT, Moves.REFLECT, Moves.REFLECT]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); }); diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index 9d7bf73f19a..a6a083ef92b 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -30,7 +30,7 @@ describe("Moves - Rollout", () => { game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.BIDOOF); + game.override.enemySpecies(Species.BIDOOF); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/roost.test.ts b/src/test/moves/roost.test.ts index 9411cf0ef35..b9255032cd4 100644 --- a/src/test/moves/roost.test.ts +++ b/src/test/moves/roost.test.ts @@ -28,7 +28,7 @@ describe("Moves - Roost", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.STARAPTOR); + game.override.enemySpecies(Species.STARAPTOR); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index fd52b6ae764..c198e347134 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -28,7 +28,7 @@ describe("Moves - Spikes", () => { game = new GameManager(phaserGame); game.scene.battleStyle = 1; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); @@ -106,7 +106,7 @@ describe("Moves - Spikes", () => { it("trainer - wild - force switch by himself opponent - should take damage", async() => { game.override.startingWave(5); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5000); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(0); + game.override.enemySpecies(0); // turn 1: player set spikes, opponent do splash // turn 2: player do splash, opponent switch pokemon // opponent pokemon should trigger spikes and lose HP diff --git a/src/test/moves/spit_up.test.ts b/src/test/moves/spit_up.test.ts index f0ac0caa9d7..fc83b0d4357 100644 --- a/src/test/moves/spit_up.test.ts +++ b/src/test/moves/spit_up.test.ts @@ -29,7 +29,7 @@ describe("Moves - Spit Up", () => { game.override.battleType("single"); - vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/moves/spotlight.test.ts b/src/test/moves/spotlight.test.ts index b627b959336..8ec1cd38069 100644 --- a/src/test/moves/spotlight.test.ts +++ b/src/test/moves/spotlight.test.ts @@ -33,7 +33,7 @@ describe("Moves - Spotlight", () => { game = new GameManager(phaserGame); game.override.battleType("double"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); diff --git a/src/test/moves/stockpile.test.ts b/src/test/moves/stockpile.test.ts index 39730c812d4..18e9cc366c4 100644 --- a/src/test/moves/stockpile.test.ts +++ b/src/test/moves/stockpile.test.ts @@ -29,7 +29,7 @@ describe("Moves - Stockpile", () => { game.override.battleType("single"); - vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); diff --git a/src/test/moves/swallow.test.ts b/src/test/moves/swallow.test.ts index 2b839ae2e86..37ce68527a2 100644 --- a/src/test/moves/swallow.test.ts +++ b/src/test/moves/swallow.test.ts @@ -28,7 +28,7 @@ describe("Moves - Swallow", () => { game.override.battleType("single"); - vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/moves/tackle.test.ts b/src/test/moves/tackle.test.ts index 147de6b0e33..97da84b5d17 100644 --- a/src/test/moves/tackle.test.ts +++ b/src/test/moves/tackle.test.ts @@ -32,7 +32,7 @@ describe("Moves - Tackle", () => { game = new GameManager(phaserGame); const moveToUse = Moves.TACKLE; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1); game.override.startingWave(97); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); @@ -42,7 +42,7 @@ describe("Moves - Tackle", () => { it("TACKLE against ghost", async() => { const moveToUse = Moves.TACKLE; - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GENGAR); + game.override.enemySpecies(Species.GENGAR); await game.startBattle([ Species.MIGHTYENA, ]); diff --git a/src/test/moves/tail_whip.test.ts b/src/test/moves/tail_whip.test.ts index 6fba92c6174..6122badeba1 100644 --- a/src/test/moves/tail_whip.test.ts +++ b/src/test/moves/tail_whip.test.ts @@ -34,7 +34,7 @@ describe("Moves - Tail whip", () => { game = new GameManager(phaserGame); const moveToUse = Moves.TAIL_WHIP; game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/moves/thousand_arrows.test.ts b/src/test/moves/thousand_arrows.test.ts index fdac2ade739..fb49195c2bd 100644 --- a/src/test/moves/thousand_arrows.test.ts +++ b/src/test/moves/thousand_arrows.test.ts @@ -31,7 +31,7 @@ describe("Moves - Thousand Arrows", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.TOGETIC); + game.override.enemySpecies(Species.TOGETIC); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.THOUSAND_ARROWS ]); @@ -61,7 +61,7 @@ describe("Moves - Thousand Arrows", () => { it( "move should hit and ground targets with Levitate", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LEVITATE); await game.startBattle([ Species.ILLUMISE ]); @@ -84,7 +84,7 @@ describe("Moves - Thousand Arrows", () => { it( "move should hit and ground targets under the effects of Magnet Rise", async () => { - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.enemySpecies(Species.SNORLAX); await game.startBattle([ Species.ILLUMISE ]); diff --git a/src/test/moves/tidy_up.test.ts b/src/test/moves/tidy_up.test.ts index 6d436215db3..c9e76ae5078 100644 --- a/src/test/moves/tidy_up.test.ts +++ b/src/test/moves/tidy_up.test.ts @@ -28,7 +28,7 @@ describe("Moves - Tidy Up", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.FEEBAS); diff --git a/src/test/ui/transfer-item.test.ts b/src/test/ui/transfer-item.test.ts index 6f3f16deddb..b17d5c7544f 100644 --- a/src/test/ui/transfer-item.test.ts +++ b/src/test/ui/transfer-item.test.ts @@ -42,7 +42,7 @@ describe("UI - Transfer Items", () => { { name: "BERRY", count: 2, type: BerryType.LUM }, ]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_CLAW]); - vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); await game.startBattle([Species.RAYQUAZA, Species.RAYQUAZA, Species.RAYQUAZA]); From 7cd75b13b9513606afb9d5d44c2bb8bf6dbe27b5 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:01:59 -0700 Subject: [PATCH 11/42] add OverridesHelper.enemyAbility --- src/test/utils/overridesHelper.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index bdc92a47714..f1273c26f38 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -1,4 +1,5 @@ import { Weather, WeatherType } from "#app/data/weather"; +import { Abilities } from "#app/enums/abilities.js"; import { Biome } from "#app/enums/biome"; import { Species } from "#app/enums/species.js"; import * as GameMode from "#app/game-mode"; @@ -56,8 +57,8 @@ export class OverridesHelper { } /** - * Override the weather (type) - * @param type weather type to set + * Override the {@linkcode WeatherType | weather (type)} + * @param type {@linkcode WeatherType | weather type} to set * @returns this */ weather(type: WeatherType): this { @@ -94,8 +95,8 @@ export class OverridesHelper { } /** - * Override the enemy (pokemon) species - * @param species the (pokemon) species to set + * Override the enemy (pokemon) {@linkcode Species | species} + * @param species the (pokemon) {@linkcode Species | species} to set * @returns this */ enemySpecies(species: Species | number): this { @@ -104,6 +105,17 @@ export class OverridesHelper { return this; } + /** + * Override the enemy (pokemon) {@linkcode Abilities | ability} + * @param ability the (pokemon) {@linkcode Abilities | ability} to set + * @returns this + */ + enemyAbility(ability: Abilities): this { + vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(ability); + this.log(`Enemy Pokemon species set to ${Abilities[ability]} (=${ability})!`); + return this; + } + private log(...params: any[]) { console.log("Overrides:", ...params); } From d14799f37afb67466067de74c1be79bbb590f189 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:05:32 -0700 Subject: [PATCH 12/42] apply game.override.enemyAbility --- src/test/abilities/ability_timing.test.ts | 2 +- src/test/abilities/aura_break.test.ts | 2 +- src/test/abilities/battery.test.ts | 2 +- src/test/abilities/costar.test.ts | 4 ++-- src/test/abilities/dry_skin.test.ts | 4 ++-- src/test/abilities/hustle.test.ts | 2 +- src/test/abilities/ice_face.test.ts | 2 +- src/test/abilities/intimidate.test.ts | 2 +- src/test/abilities/intrepid_sword.test.ts | 2 +- src/test/abilities/moxie.test.ts | 2 +- src/test/abilities/parental_bond.test.ts | 4 ++-- src/test/abilities/power_spot.test.ts | 2 +- src/test/abilities/quick_draw.test.ts | 2 +- src/test/abilities/sand_veil.test.ts | 2 +- src/test/abilities/sap_sipper.test.ts | 12 ++++++------ src/test/abilities/sheer_force.test.ts | 2 +- src/test/abilities/shield_dust.test.ts | 2 +- src/test/abilities/steely_spirit.test.ts | 2 +- src/test/abilities/sturdy.test.ts | 2 +- src/test/abilities/volt_absorb.test.ts | 2 +- src/test/abilities/wind_power.test.ts | 2 +- src/test/abilities/wind_rider.test.ts | 2 +- src/test/abilities/wonder_skin.test.ts | 2 +- src/test/abilities/zen_mode.test.ts | 2 +- src/test/arena/arena_gravity.test.ts | 2 +- src/test/arena/weather_fog.test.ts | 2 +- src/test/arena/weather_strong_winds.test.ts | 2 +- src/test/battle/battle-order.test.ts | 2 +- src/test/battle/battle.test.ts | 18 +++++++++--------- src/test/battle/error-handling.test.ts | 2 +- src/test/battle/special_battle.test.ts | 2 +- src/test/evolution.test.ts | 2 +- src/test/items/exp_booster.test.ts | 2 +- src/test/items/leftovers.test.ts | 2 +- src/test/items/toxic_orb.test.ts | 2 +- src/test/moves/astonish.test.ts | 2 +- src/test/moves/ceaseless_edge.test.ts | 2 +- src/test/moves/double_team.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 4 ++-- src/test/moves/fissure.test.ts | 2 +- src/test/moves/flower_shield.test.ts | 2 +- src/test/moves/gastro_acid.test.ts | 2 +- src/test/moves/glaive_rush.test.ts | 2 +- src/test/moves/growth.test.ts | 2 +- src/test/moves/hard_press.test.ts | 2 +- src/test/moves/hyper_beam.test.ts | 2 +- src/test/moves/make_it_rain.test.ts | 2 +- src/test/moves/multi_target.test.ts | 2 +- src/test/moves/octolock.test.ts | 2 +- src/test/moves/rollout.test.ts | 2 +- src/test/moves/roost.test.ts | 2 +- src/test/moves/spikes.test.ts | 2 +- src/test/moves/spit_up.test.ts | 2 +- src/test/moves/stockpile.test.ts | 2 +- src/test/moves/swallow.test.ts | 2 +- src/test/moves/tail_whip.test.ts | 2 +- src/test/moves/thousand_arrows.test.ts | 2 +- src/test/moves/tidy_up.test.ts | 2 +- 58 files changed, 75 insertions(+), 75 deletions(-) diff --git a/src/test/abilities/ability_timing.test.ts b/src/test/abilities/ability_timing.test.ts index 894bb7c7e6b..ebc3f4d9bce 100644 --- a/src/test/abilities/ability_timing.test.ts +++ b/src/test/abilities/ability_timing.test.ts @@ -29,7 +29,7 @@ describe("Ability Timing", () => { game.override.battleType("single"); game.override.enemySpecies(Species.PIDGEY); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); + game.override.enemyAbility(Abilities.INTIMIDATE); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.SPLASH)); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/abilities/aura_break.test.ts b/src/test/abilities/aura_break.test.ts index 2b3ebc5d6fb..2de8a86309d 100644 --- a/src/test/abilities/aura_break.test.ts +++ b/src/test/abilities/aura_break.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Aura Break", () => { game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MOONBLAST, Moves.DARK_PULSE, Moves.MOONBLAST, Moves.DARK_PULSE]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.AURA_BREAK); + game.override.enemyAbility(Abilities.AURA_BREAK); game.override.enemySpecies(Species.SHUCKLE); }); diff --git a/src/test/abilities/battery.test.ts b/src/test/abilities/battery.test.ts index 9347ba754e5..90dc8b62986 100644 --- a/src/test/abilities/battery.test.ts +++ b/src/test/abilities/battery.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Battery", () => { game = new GameManager(phaserGame); game.override.battleType("double"); game.override.enemySpecies(Species.SHUCKLE); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); diff --git a/src/test/abilities/costar.test.ts b/src/test/abilities/costar.test.ts index 7c791c3e140..282fda866ea 100644 --- a/src/test/abilities/costar.test.ts +++ b/src/test/abilities/costar.test.ts @@ -37,7 +37,7 @@ describe("Abilities - COSTAR", () => { test( "ability copies positive stat changes", async () => { - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]); @@ -68,7 +68,7 @@ describe("Abilities - COSTAR", () => { test( "ability copies negative stat changes", async () => { - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); + game.override.enemyAbility(Abilities.INTIMIDATE); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]); diff --git a/src/test/abilities/dry_skin.test.ts b/src/test/abilities/dry_skin.test.ts index 4d3502567d9..25069e35604 100644 --- a/src/test/abilities/dry_skin.test.ts +++ b/src/test/abilities/dry_skin.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Dry Skin", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DRY_SKIN); + game.override.enemyAbility(Abilities.DRY_SKIN); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); game.override.enemySpecies(Species.CHARMANDER); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); @@ -94,7 +94,7 @@ describe("Abilities - Dry Skin", () => { expect(enemy.hp > 0); enemy.hp = initialHP; - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.enemyAbility(Abilities.NONE); // second turn game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER)); diff --git a/src/test/abilities/hustle.test.ts b/src/test/abilities/hustle.test.ts index 2de86b54973..cea0bc10799 100644 --- a/src/test/abilities/hustle.test.ts +++ b/src/test/abilities/hustle.test.ts @@ -33,7 +33,7 @@ describe("Abilities - Hustle", () => { vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); game.override.enemySpecies(Species.SHUCKLE); - vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); }); it("increases the user's Attack stat by 50%", async () => { diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index f696d9943dc..6930c0d1db8 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Ice Face", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.EISCUE); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ICE_FACE); + game.override.enemyAbility(Abilities.ICE_FACE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.ICE_BEAM, Moves.TOXIC_THREAD, Moves.HAIL]); }); diff --git a/src/test/abilities/intimidate.test.ts b/src/test/abilities/intimidate.test.ts index fbcd858415a..b3edc0d0206 100644 --- a/src/test/abilities/intimidate.test.ts +++ b/src/test/abilities/intimidate.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Intimidate", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); + game.override.enemyAbility(Abilities.INTIMIDATE); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); game.override.startingWave(3); diff --git a/src/test/abilities/intrepid_sword.test.ts b/src/test/abilities/intrepid_sword.test.ts index 878c5dbb0dc..fa988fcab39 100644 --- a/src/test/abilities/intrepid_sword.test.ts +++ b/src/test/abilities/intrepid_sword.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Intrepid Sword", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.ZACIAN); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTREPID_SWORD); + game.override.enemyAbility(Abilities.INTREPID_SWORD); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTREPID_SWORD); }); diff --git a/src/test/abilities/moxie.test.ts b/src/test/abilities/moxie.test.ts index 50c0b58b900..a2a50f15488 100644 --- a/src/test/abilities/moxie.test.ts +++ b/src/test/abilities/moxie.test.ts @@ -36,7 +36,7 @@ describe("Abilities - Moxie", () => { const moveToUse = Moves.AERIAL_ACE; game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); + game.override.enemyAbility(Abilities.MOXIE); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index c6e7cc4c95a..991ccefd265 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Parental Bond", () => { vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PARENTAL_BOND); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); @@ -591,7 +591,7 @@ describe("Abilities - Parental Bond", () => { "ability should not cause user to hit into Storm Drain more than once", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WATER_GUN]); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.STORM_DRAIN); + game.override.enemyAbility(Abilities.STORM_DRAIN); await game.startBattle([Species.CHARIZARD]); diff --git a/src/test/abilities/power_spot.test.ts b/src/test/abilities/power_spot.test.ts index a9db0c3bea1..b63ad8522e4 100644 --- a/src/test/abilities/power_spot.test.ts +++ b/src/test/abilities/power_spot.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Power Spot", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); game.override.enemySpecies(Species.SHUCKLE); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); }); it("raises the power of allies' special moves by 30%", async () => { diff --git a/src/test/abilities/quick_draw.test.ts b/src/test/abilities/quick_draw.test.ts index d6a4ef8038f..922725b6ea0 100644 --- a/src/test/abilities/quick_draw.test.ts +++ b/src/test/abilities/quick_draw.test.ts @@ -33,7 +33,7 @@ describe("Abilities - Quick Draw", () => { vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.TACKLE)); vi.spyOn(allAbilities[Abilities.QUICK_DRAW].getAttrs(BypassSpeedChanceAbAttr)[0], "chance", "get").mockReturnValue(100); diff --git a/src/test/abilities/sand_veil.test.ts b/src/test/abilities/sand_veil.test.ts index dbdc9699600..4077dca2b31 100644 --- a/src/test/abilities/sand_veil.test.ts +++ b/src/test/abilities/sand_veil.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Sand Veil", () => { game = new GameManager(phaserGame); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.enemySpecies(Species.MEOWSCARADA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/abilities/sap_sipper.test.ts b/src/test/abilities/sap_sipper.test.ts index bc19531e46f..ce961f107dd 100644 --- a/src/test/abilities/sap_sipper.test.ts +++ b/src/test/abilities/sap_sipper.test.ts @@ -41,7 +41,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.DUSKULL); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); + game.override.enemyAbility(enemyAbility); await game.startBattle(); @@ -62,7 +62,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); + game.override.enemyAbility(enemyAbility); await game.startBattle(); @@ -81,7 +81,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); + game.override.enemyAbility(enemyAbility); await game.startBattle(); @@ -101,7 +101,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); + game.override.enemyAbility(enemyAbility); await game.startBattle(); @@ -123,7 +123,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.enemyAbility(Abilities.NONE); await game.startBattle(); @@ -148,7 +148,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); + game.override.enemyAbility(enemyAbility); await game.startBattle(); diff --git a/src/test/abilities/sheer_force.test.ts b/src/test/abilities/sheer_force.test.ts index f6477783f6c..5e7eb11a3c3 100644 --- a/src/test/abilities/sheer_force.test.ts +++ b/src/test/abilities/sheer_force.test.ts @@ -160,7 +160,7 @@ describe("Abilities - Sheer Force", () => { it("Sheer Force Disabling Specific Abilities", async() => { const moveToUse = Moves.CRUSH_CLAW; - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.COLOR_CHANGE); + game.override.enemyAbility(Abilities.COLOR_CHANGE); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "KINGS_ROCK", count: 1}]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHEER_FORCE); await game.startBattle([ diff --git a/src/test/abilities/shield_dust.test.ts b/src/test/abilities/shield_dust.test.ts index 186c5c3c6ad..c34ac94a6ed 100644 --- a/src/test/abilities/shield_dust.test.ts +++ b/src/test/abilities/shield_dust.test.ts @@ -36,7 +36,7 @@ describe("Abilities - Shield Dust", () => { const movesToUse = [Moves.AIR_SLASH]; game.override.battleType("single"); game.override.enemySpecies(Species.ONIX); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHIELD_DUST); + game.override.enemyAbility(Abilities.SHIELD_DUST); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/abilities/steely_spirit.test.ts b/src/test/abilities/steely_spirit.test.ts index 374aef0ce2f..f4b24d2c21e 100644 --- a/src/test/abilities/steely_spirit.test.ts +++ b/src/test/abilities/steely_spirit.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Steely Spirit", () => { game = new GameManager(phaserGame); game.override.battleType("double"); game.override.enemySpecies(Species.SHUCKLE); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.IRON_HEAD, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(allMoves[moveToCheck], "calculateBattlePower"); diff --git a/src/test/abilities/sturdy.test.ts b/src/test/abilities/sturdy.test.ts index d4c4ee66761..87a998e560d 100644 --- a/src/test/abilities/sturdy.test.ts +++ b/src/test/abilities/sturdy.test.ts @@ -38,7 +38,7 @@ describe("Abilities - Sturdy", () => { game.override.enemySpecies(Species.ARON); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.STURDY); + game.override.enemyAbility(Abilities.STURDY); }); test( diff --git a/src/test/abilities/volt_absorb.test.ts b/src/test/abilities/volt_absorb.test.ts index 881d745eed6..3a586df897a 100644 --- a/src/test/abilities/volt_absorb.test.ts +++ b/src/test/abilities/volt_absorb.test.ts @@ -41,7 +41,7 @@ describe("Abilities - Volt Absorb", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.DUSKULL); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); await game.startBattle(); diff --git a/src/test/abilities/wind_power.test.ts b/src/test/abilities/wind_power.test.ts index b7539f0188b..5eaf87f182f 100644 --- a/src/test/abilities/wind_power.test.ts +++ b/src/test/abilities/wind_power.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Wind Power", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.SHIFTRY); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_POWER); + game.override.enemyAbility(Abilities.WIND_POWER); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); diff --git a/src/test/abilities/wind_rider.test.ts b/src/test/abilities/wind_rider.test.ts index ec09b39c539..084317f6e09 100644 --- a/src/test/abilities/wind_rider.test.ts +++ b/src/test/abilities/wind_rider.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Wind Rider", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.SHIFTRY); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_RIDER); + game.override.enemyAbility(Abilities.WIND_RIDER); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); diff --git a/src/test/abilities/wonder_skin.test.ts b/src/test/abilities/wonder_skin.test.ts index a38ec41fa2d..5528b879bdf 100644 --- a/src/test/abilities/wonder_skin.test.ts +++ b/src/test/abilities/wonder_skin.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Wonder Skin", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.CHARM]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WONDER_SKIN); + game.override.enemyAbility(Abilities.WONDER_SKIN); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); diff --git a/src/test/abilities/zen_mode.test.ts b/src/test/abilities/zen_mode.test.ts index 1119b4cdb90..7b6f3e66aa1 100644 --- a/src/test/abilities/zen_mode.test.ts +++ b/src/test/abilities/zen_mode.test.ts @@ -45,7 +45,7 @@ describe("Abilities - ZEN MODE", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); diff --git a/src/test/arena/arena_gravity.test.ts b/src/test/arena/arena_gravity.test.ts index 0e5b7b992a7..5058f8701b7 100644 --- a/src/test/arena/arena_gravity.test.ts +++ b/src/test/arena/arena_gravity.test.ts @@ -32,7 +32,7 @@ describe("Arena - Gravity", () => { game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.GRAVITY, Moves.FISSURE]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(new Array(4).fill(Moves.SPLASH)); }); diff --git a/src/test/arena/weather_fog.test.ts b/src/test/arena/weather_fog.test.ts index b11d3728f10..273e5c88b19 100644 --- a/src/test/arena/weather_fog.test.ts +++ b/src/test/arena/weather_fog.test.ts @@ -33,7 +33,7 @@ describe("Weather - Fog", () => { .battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(new Array(4).fill(Moves.SPLASH)); }); diff --git a/src/test/arena/weather_strong_winds.test.ts b/src/test/arena/weather_strong_winds.test.ts index 245b1bcf74a..f25be43c426 100644 --- a/src/test/arena/weather_strong_winds.test.ts +++ b/src/test/arena/weather_strong_winds.test.ts @@ -30,7 +30,7 @@ describe("Weather - Strong Winds", () => { game.override.battleType("single"); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10); game.override.enemySpecies(Species.TAILLOW); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DELTA_STREAM); + game.override.enemyAbility(Abilities.DELTA_STREAM); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.THUNDERBOLT, Moves.ICE_BEAM, Moves.ROCK_SLIDE]); }); diff --git a/src/test/battle/battle-order.test.ts b/src/test/battle/battle-order.test.ts index 55753951881..7ffb363de9b 100644 --- a/src/test/battle/battle-order.test.ts +++ b/src/test/battle/battle-order.test.ts @@ -35,7 +35,7 @@ describe("Battle order", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.MEWTWO); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); }); diff --git a/src/test/battle/battle.test.ts b/src/test/battle/battle.test.ts index f2dc328ac47..a8f17543cc4 100644 --- a/src/test/battle/battle.test.ts +++ b/src/test/battle/battle.test.ts @@ -97,7 +97,7 @@ describe("Test Battle Phase", () => { .startingWave(3) .battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); await game.startBattle(); game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { @@ -116,7 +116,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP]); game.override.battleType("single"); await game.startBattle(); @@ -207,7 +207,7 @@ describe("Test Battle Phase", () => { it("2vs1", async() => { game.override.battleType("single"); game.override.enemySpecies(Species.MIGHTYENA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); await game.startBattle([ Species.BLASTOISE, @@ -220,7 +220,7 @@ describe("Test Battle Phase", () => { it("1vs1", async() => { game.override.battleType("single"); game.override.enemySpecies(Species.MIGHTYENA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); await game.startBattle([ Species.BLASTOISE, @@ -232,7 +232,7 @@ describe("Test Battle Phase", () => { it("2vs2", async() => { game.override.battleType("double"); game.override.enemySpecies(Species.MIGHTYENA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.startingWave(3); await game.startBattle([ @@ -246,7 +246,7 @@ describe("Test Battle Phase", () => { it("4vs2", async() => { game.override.battleType("double"); game.override.enemySpecies(Species.MIGHTYENA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.startingWave(3); await game.startBattle([ @@ -264,7 +264,7 @@ describe("Test Battle Phase", () => { game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.startingWave(3); @@ -293,7 +293,7 @@ describe("Test Battle Phase", () => { game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.startingWave(3); @@ -311,7 +311,7 @@ describe("Test Battle Phase", () => { game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.startingWave(3); diff --git a/src/test/battle/error-handling.test.ts b/src/test/battle/error-handling.test.ts index c7bb45e8180..75aad9a4ee3 100644 --- a/src/test/battle/error-handling.test.ts +++ b/src/test/battle/error-handling.test.ts @@ -28,7 +28,7 @@ describe("Test Battle Phase", () => { .startingWave(3); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); diff --git a/src/test/battle/special_battle.test.ts b/src/test/battle/special_battle.test.ts index 34bdac1f306..7b6330a9fe8 100644 --- a/src/test/battle/special_battle.test.ts +++ b/src/test/battle/special_battle.test.ts @@ -29,7 +29,7 @@ describe("Test Battle Phase", () => { game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/evolution.test.ts b/src/test/evolution.test.ts index 60e3392b281..f2cf1023457 100644 --- a/src/test/evolution.test.ts +++ b/src/test/evolution.test.ts @@ -27,7 +27,7 @@ describe("Evolution", () => { game.override.battleType("single"); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(60); }); diff --git a/src/test/items/exp_booster.test.ts b/src/test/items/exp_booster.test.ts index 75e0892efc6..3f0f2fd3424 100644 --- a/src/test/items/exp_booster.test.ts +++ b/src/test/items/exp_booster.test.ts @@ -23,7 +23,7 @@ describe("EXP Modifier Items", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.battleType("single"); }); diff --git a/src/test/items/leftovers.test.ts b/src/test/items/leftovers.test.ts index 5cea7be42ba..d3d6a8860b2 100644 --- a/src/test/items/leftovers.test.ts +++ b/src/test/items/leftovers.test.ts @@ -30,7 +30,7 @@ describe("Items - Leftovers", () => { vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.enemySpecies(Species.SHUCKLE); - vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); + game.override.enemyAbility(Abilities.UNNERVE); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); vi.spyOn(overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "LEFTOVERS", count: 1}]); }); diff --git a/src/test/items/toxic_orb.test.ts b/src/test/items/toxic_orb.test.ts index 132d939be9f..50bf108a008 100644 --- a/src/test/items/toxic_orb.test.ts +++ b/src/test/items/toxic_orb.test.ts @@ -39,7 +39,7 @@ describe("Items - Toxic orb", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([oppMoveToUse, oppMoveToUse, oppMoveToUse, oppMoveToUse]); diff --git a/src/test/moves/astonish.test.ts b/src/test/moves/astonish.test.ts index 9a6d2df5e0b..9f6ea21ae93 100644 --- a/src/test/moves/astonish.test.ts +++ b/src/test/moves/astonish.test.ts @@ -31,7 +31,7 @@ describe("Moves - Astonish", () => { game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ASTONISH, Moves.SPLASH]); game.override.enemySpecies(Species.BLASTOISE); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index f6766ee2441..3cd043cc390 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -34,7 +34,7 @@ describe("Moves - Ceaseless Edge", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); + game.override.enemyAbility(Abilities.RUN_AWAY); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/double_team.test.ts b/src/test/moves/double_team.test.ts index da623b7ba92..13f8087d165 100644 --- a/src/test/moves/double_team.test.ts +++ b/src/test/moves/double_team.test.ts @@ -32,7 +32,7 @@ describe("Moves - Double Team", () => { vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index ae6768e6688..419fca98771 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -45,7 +45,7 @@ describe("Moves - Dragon Rage", () => { game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); @@ -111,7 +111,7 @@ describe("Moves - Dragon Rage", () => { }); it("ignores damage modification from abilities such as ice scales", async () => { - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ICE_SCALES); + game.override.enemyAbility(Abilities.ICE_SCALES); game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE)); await game.phaseInterceptor.to(TurnEndPhase); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index b6bb37363e7..f5c1218af74 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -54,7 +54,7 @@ describe("Moves - Fissure", () => { it("ignores damage modification from abilities such as fur coat", async () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NO_GUARD); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FUR_COAT); + game.override.enemyAbility(Abilities.FUR_COAT); game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE)); await game.phaseInterceptor.to(DamagePhase, true); diff --git a/src/test/moves/flower_shield.test.ts b/src/test/moves/flower_shield.test.ts index 7eb495672ae..b51651aaf76 100644 --- a/src/test/moves/flower_shield.test.ts +++ b/src/test/moves/flower_shield.test.ts @@ -31,7 +31,7 @@ describe("Moves - Flower Shield", () => { beforeEach(() => { game = new GameManager(phaserGame); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.enemyAbility(Abilities.NONE); game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLOWER_SHIELD, Moves.SPLASH]); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/moves/gastro_acid.test.ts b/src/test/moves/gastro_acid.test.ts index 1c4028a351f..4275ee64fdf 100644 --- a/src/test/moves/gastro_acid.test.ts +++ b/src/test/moves/gastro_acid.test.ts @@ -36,7 +36,7 @@ describe("Moves - Gastro Acid", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER]); game.override.enemySpecies(Species.BIDOOF); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WATER_ABSORB); + game.override.enemyAbility(Abilities.WATER_ABSORB); }); it("suppresses effect of ability", async () => { diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index 4ed85fa74e8..ea0e6032709 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -29,7 +29,7 @@ describe("Moves - Glaive Rush", () => { game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.GLAIVE_RUSH)); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.KLINK); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); diff --git a/src/test/moves/growth.test.ts b/src/test/moves/growth.test.ts index 9a057fbc03b..56f62ae60a1 100644 --- a/src/test/moves/growth.test.ts +++ b/src/test/moves/growth.test.ts @@ -36,7 +36,7 @@ describe("Moves - Growth", () => { const moveToUse = Moves.GROWTH; game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); + game.override.enemyAbility(Abilities.MOXIE); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); diff --git a/src/test/moves/hard_press.test.ts b/src/test/moves/hard_press.test.ts index 1e607bc20fb..959b90cdde8 100644 --- a/src/test/moves/hard_press.test.ts +++ b/src/test/moves/hard_press.test.ts @@ -32,7 +32,7 @@ describe("Moves - Hard Press", () => { game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemySpecies(Species.MUNCHLAX); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HARD_PRESS]); vi.spyOn(moveToCheck, "calculateBattlePower"); diff --git a/src/test/moves/hyper_beam.test.ts b/src/test/moves/hyper_beam.test.ts index 480522ace4d..54789b68fbf 100644 --- a/src/test/moves/hyper_beam.test.ts +++ b/src/test/moves/hyper_beam.test.ts @@ -32,7 +32,7 @@ describe("Moves - Hyper Beam", () => { game.override.battleType("single"); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.SPLASH)); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HYPER_BEAM, Moves.TACKLE]); diff --git a/src/test/moves/make_it_rain.test.ts b/src/test/moves/make_it_rain.test.ts index d44fd252ba1..ee4aef3e343 100644 --- a/src/test/moves/make_it_rain.test.ts +++ b/src/test/moves/make_it_rain.test.ts @@ -34,7 +34,7 @@ describe("Moves - Make It Rain", () => { game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MAKE_IT_RAIN, Moves.SPLASH]); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/multi_target.test.ts b/src/test/moves/multi_target.test.ts index 268d582156b..40eb2e7daa6 100644 --- a/src/test/moves/multi_target.test.ts +++ b/src/test/moves/multi_target.test.ts @@ -69,7 +69,7 @@ describe("Moves - Multi target", () => { async function checkTargetMultiplier(game: GameManager, attackMove: Moves, killAlly: boolean, killSecondEnemy: boolean, shouldMultiplied: boolean, oppAbility?: Abilities) { // play an attack and check target count - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(oppAbility ? oppAbility : Abilities.BALL_FETCH); + game.override.enemyAbility(oppAbility ? oppAbility : Abilities.BALL_FETCH); await game.startBattle(); const playerPokemonRepr = game.scene.getPlayerField(); diff --git a/src/test/moves/octolock.test.ts b/src/test/moves/octolock.test.ts index ada806fd4d0..8881170a9a3 100644 --- a/src/test/moves/octolock.test.ts +++ b/src/test/moves/octolock.test.ts @@ -32,7 +32,7 @@ describe("Moves - Octolock", () => { game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.enemyAbility(Abilities.NONE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.OCTOLOCK, Moves.SPLASH]); diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index a6a083ef92b..93b07ce84fc 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -31,7 +31,7 @@ describe("Moves - Rollout", () => { vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); game.override.enemySpecies(Species.BIDOOF); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.enemyAbility(Abilities.NONE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(SPLASH_ONLY); diff --git a/src/test/moves/roost.test.ts b/src/test/moves/roost.test.ts index b9255032cd4..284937bd7db 100644 --- a/src/test/moves/roost.test.ts +++ b/src/test/moves/roost.test.ts @@ -29,7 +29,7 @@ describe("Moves - Roost", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.STARAPTOR); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.STOMPING_TANTRUM ]); diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index c198e347134..62ecfbc6312 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -29,7 +29,7 @@ describe("Moves - Spikes", () => { game.scene.battleStyle = 1; game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); diff --git a/src/test/moves/spit_up.test.ts b/src/test/moves/spit_up.test.ts index fc83b0d4357..cb40a3a1177 100644 --- a/src/test/moves/spit_up.test.ts +++ b/src/test/moves/spit_up.test.ts @@ -31,7 +31,7 @@ describe("Moves - Spit Up", () => { game.override.enemySpecies(Species.RATTATA); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.enemyAbility(Abilities.NONE); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP]); diff --git a/src/test/moves/stockpile.test.ts b/src/test/moves/stockpile.test.ts index 18e9cc366c4..adc70aa99b2 100644 --- a/src/test/moves/stockpile.test.ts +++ b/src/test/moves/stockpile.test.ts @@ -31,7 +31,7 @@ describe("Moves - Stockpile", () => { game.override.enemySpecies(Species.RATTATA); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.enemyAbility(Abilities.NONE); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STOCKPILE, Moves.SPLASH]); diff --git a/src/test/moves/swallow.test.ts b/src/test/moves/swallow.test.ts index 37ce68527a2..c6a6f485d11 100644 --- a/src/test/moves/swallow.test.ts +++ b/src/test/moves/swallow.test.ts @@ -30,7 +30,7 @@ describe("Moves - Swallow", () => { game.override.enemySpecies(Species.RATTATA); vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); - vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.enemyAbility(Abilities.NONE); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW]); diff --git a/src/test/moves/tail_whip.test.ts b/src/test/moves/tail_whip.test.ts index 6122badeba1..af5597d62ed 100644 --- a/src/test/moves/tail_whip.test.ts +++ b/src/test/moves/tail_whip.test.ts @@ -35,7 +35,7 @@ describe("Moves - Tail whip", () => { const moveToUse = Moves.TAIL_WHIP; game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); diff --git a/src/test/moves/thousand_arrows.test.ts b/src/test/moves/thousand_arrows.test.ts index fb49195c2bd..ca8609c7100 100644 --- a/src/test/moves/thousand_arrows.test.ts +++ b/src/test/moves/thousand_arrows.test.ts @@ -62,7 +62,7 @@ describe("Moves - Thousand Arrows", () => { "move should hit and ground targets with Levitate", async () => { game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LEVITATE); + game.override.enemyAbility(Abilities.LEVITATE); await game.startBattle([ Species.ILLUMISE ]); diff --git a/src/test/moves/tidy_up.test.ts b/src/test/moves/tidy_up.test.ts index c9e76ae5078..3d55c0a42a2 100644 --- a/src/test/moves/tidy_up.test.ts +++ b/src/test/moves/tidy_up.test.ts @@ -29,7 +29,7 @@ describe("Moves - Tidy Up", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.FEEBAS); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); From f55bfc3681910d252f2d4224954ae698e01c8d06 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:11:05 -0700 Subject: [PATCH 13/42] add OverridesHelper.enemyMoveset() --- src/test/utils/overridesHelper.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index f1273c26f38..7571a4eb657 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -1,6 +1,7 @@ import { Weather, WeatherType } from "#app/data/weather"; import { Abilities } from "#app/enums/abilities.js"; import { Biome } from "#app/enums/biome"; +import { Moves } from "#app/enums/moves.js"; import { Species } from "#app/enums/species.js"; import * as GameMode from "#app/game-mode"; import { GameModes, getGameMode } from "#app/game-mode"; @@ -112,7 +113,19 @@ export class OverridesHelper { */ enemyAbility(ability: Abilities): this { vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(ability); - this.log(`Enemy Pokemon species set to ${Abilities[ability]} (=${ability})!`); + this.log(`Enemy Pokemon ability set to ${Abilities[ability]} (=${ability})!`); + return this; + } + + /** + * Override the enemy (pokemon) {@linkcode Moves | moves}set + * @param moveset the {@linkcode Moves | moves}set to set + * @returns this + */ + enemyMoveset(moveset: Moves[]): this { + vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(moveset); + const movesetStr = moveset.map((moveId) => Moves[moveId]).join(", "); + this.log(`Enemy Pokemon moveset set to ${movesetStr} (=[${moveset.join(", ")}])!`); return this; } From b0279f34f32ef784fd78078b101c341e4af836fe Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:18:14 -0700 Subject: [PATCH 14/42] apply game.override.enemyMoveset --- src/test/abilities/ability_timing.test.ts | 3 ++- src/test/abilities/aura_break.test.ts | 3 ++- src/test/abilities/battery.test.ts | 3 ++- src/test/abilities/battle_bond.test.ts | 2 +- src/test/abilities/costar.test.ts | 3 ++- src/test/abilities/disguise.test.ts | 4 ++-- src/test/abilities/dry_skin.test.ts | 5 +++-- src/test/abilities/hustle.test.ts | 3 ++- src/test/abilities/ice_face.test.ts | 8 ++++---- src/test/abilities/intimidate.test.ts | 6 +++--- src/test/abilities/libero.test.ts | 7 ++++--- src/test/abilities/moxie.test.ts | 2 +- src/test/abilities/parental_bond.test.ts | 7 ++++--- src/test/abilities/power_construct.test.ts | 2 +- src/test/abilities/power_spot.test.ts | 3 ++- src/test/abilities/protean.test.ts | 7 ++++--- src/test/abilities/quick_draw.test.ts | 4 ++-- src/test/abilities/sand_veil.test.ts | 2 +- src/test/abilities/sap_sipper.test.ts | 12 ++++++------ src/test/abilities/schooling.test.ts | 2 +- src/test/abilities/screen_cleaner.test.ts | 6 +++--- src/test/abilities/serene_grace.test.ts | 2 +- src/test/abilities/sheer_force.test.ts | 2 +- src/test/abilities/shield_dust.test.ts | 2 +- src/test/abilities/shields_down.test.ts | 2 +- src/test/abilities/steely_spirit.test.ts | 3 ++- src/test/abilities/unseen_fist.test.ts | 4 ++-- src/test/abilities/volt_absorb.test.ts | 2 +- src/test/abilities/wind_power.test.ts | 3 ++- src/test/abilities/wind_rider.test.ts | 3 ++- src/test/abilities/wonder_skin.test.ts | 3 ++- src/test/abilities/zen_mode.test.ts | 2 +- src/test/abilities/zero_to_hero.test.ts | 2 +- src/test/achievements/achievement.test.ts | 2 +- src/test/arena/arena_gravity.test.ts | 2 +- src/test/arena/weather_fog.test.ts | 2 +- src/test/battle/battle.test.ts | 10 +++++----- src/test/battle/error-handling.test.ts | 2 +- src/test/battle/special_battle.test.ts | 2 +- src/test/items/grip_claw.test.ts | 2 +- src/test/items/leek.test.ts | 2 +- src/test/items/leftovers.test.ts | 2 +- src/test/items/scope_lens.test.ts | 2 +- src/test/items/toxic_orb.test.ts | 2 +- src/test/moves/astonish.test.ts | 2 +- src/test/moves/aurora_veil.test.ts | 2 +- src/test/moves/ceaseless_edge.test.ts | 2 +- src/test/moves/double_team.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 3 ++- src/test/moves/dynamax_cannon.test.ts | 2 +- src/test/moves/fissure.test.ts | 3 ++- src/test/moves/flower_shield.test.ts | 5 +++-- src/test/moves/follow_me.test.ts | 6 +++--- src/test/moves/gastro_acid.test.ts | 3 ++- src/test/moves/glaive_rush.test.ts | 8 ++++---- src/test/moves/growth.test.ts | 2 +- src/test/moves/hard_press.test.ts | 3 ++- src/test/moves/hyper_beam.test.ts | 2 +- src/test/moves/light_screen.test.ts | 2 +- src/test/moves/magnet_rise.test.ts | 2 +- src/test/moves/make_it_rain.test.ts | 3 ++- src/test/moves/multi_target.test.ts | 3 ++- src/test/moves/octolock.test.ts | 3 ++- src/test/moves/purify.test.ts | 2 +- src/test/moves/rage_powder.test.ts | 6 +++--- src/test/moves/reflect.test.ts | 2 +- src/test/moves/rollout.test.ts | 2 +- src/test/moves/roost.test.ts | 2 +- src/test/moves/spikes.test.ts | 2 +- src/test/moves/spit_up.test.ts | 3 ++- src/test/moves/spotlight.test.ts | 4 ++-- src/test/moves/stockpile.test.ts | 3 ++- src/test/moves/swallow.test.ts | 3 ++- src/test/moves/tackle.test.ts | 2 +- src/test/moves/tail_whip.test.ts | 2 +- src/test/moves/tailwind.test.ts | 3 ++- src/test/moves/thousand_arrows.test.ts | 2 +- src/test/moves/tidy_up.test.ts | 13 +++++++------ src/test/ui/transfer-item.test.ts | 2 +- 79 files changed, 146 insertions(+), 119 deletions(-) diff --git a/src/test/abilities/ability_timing.test.ts b/src/test/abilities/ability_timing.test.ts index ebc3f4d9bce..fb075594677 100644 --- a/src/test/abilities/ability_timing.test.ts +++ b/src/test/abilities/ability_timing.test.ts @@ -8,6 +8,7 @@ import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import i18next, { initI18n } from "#app/plugins/i18n"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Ability Timing", () => { @@ -30,7 +31,7 @@ describe("Ability Timing", () => { game.override.enemySpecies(Species.PIDGEY); game.override.enemyAbility(Abilities.INTIMIDATE); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.SPLASH)); + game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.ICE_BEAM]); diff --git a/src/test/abilities/aura_break.test.ts b/src/test/abilities/aura_break.test.ts index 2de8a86309d..ab4aa462bb4 100644 --- a/src/test/abilities/aura_break.test.ts +++ b/src/test/abilities/aura_break.test.ts @@ -8,6 +8,7 @@ import { Moves } from "#enums/moves"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { allMoves } from "#app/data/move.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Aura Break", () => { let phaserGame: Phaser.Game; @@ -29,7 +30,7 @@ describe("Abilities - Aura Break", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MOONBLAST, Moves.DARK_PULSE, Moves.MOONBLAST, Moves.DARK_PULSE]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.AURA_BREAK); game.override.enemySpecies(Species.SHUCKLE); }); diff --git a/src/test/abilities/battery.test.ts b/src/test/abilities/battery.test.ts index 90dc8b62986..be13bceff4d 100644 --- a/src/test/abilities/battery.test.ts +++ b/src/test/abilities/battery.test.ts @@ -8,6 +8,7 @@ import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { allMoves } from "#app/data/move.js"; import { Abilities } from "#app/enums/abilities.js"; import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Battery", () => { let phaserGame: Phaser.Game; @@ -31,7 +32,7 @@ describe("Abilities - Battery", () => { game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); }); it("raises the power of allies' special moves by 30%", async () => { diff --git a/src/test/abilities/battle_bond.test.ts b/src/test/abilities/battle_bond.test.ts index 88f15d78762..4dad547f8c4 100644 --- a/src/test/abilities/battle_bond.test.ts +++ b/src/test/abilities/battle_bond.test.ts @@ -31,7 +31,7 @@ describe("Abilities - BATTLE BOND", () => { game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BATTLE_BOND); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); test( diff --git a/src/test/abilities/costar.test.ts b/src/test/abilities/costar.test.ts index 282fda866ea..63f4e634800 100644 --- a/src/test/abilities/costar.test.ts +++ b/src/test/abilities/costar.test.ts @@ -8,6 +8,7 @@ import { getMovePosition } from "../utils/gameManagerUtils"; import { Abilities } from "#app/enums/abilities.js"; import { Moves } from "#app/enums/moves.js"; import { Species } from "#app/enums/species.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -30,7 +31,7 @@ describe("Abilities - COSTAR", () => { game.override.battleType("double"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.COSTAR); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NASTY_PLOT]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index ee9160a8e4f..258056f56d2 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -31,7 +31,7 @@ describe("Abilities - DISGUISE", () => { game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DISGUISE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); test( @@ -71,7 +71,7 @@ describe("Abilities - DISGUISE", () => { const baseForm = 0, bustedForm = 1; - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE]); + game.override.enemyMoveset([Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(20); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(20); game.override.enemySpecies(Species.MAGIKARP); diff --git a/src/test/abilities/dry_skin.test.ts b/src/test/abilities/dry_skin.test.ts index 25069e35604..ddcb8094b0b 100644 --- a/src/test/abilities/dry_skin.test.ts +++ b/src/test/abilities/dry_skin.test.ts @@ -7,6 +7,7 @@ import { Moves } from "#enums/moves"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { Species } from "#app/enums/species.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Dry Skin", () => { let phaserGame: Phaser.Game; @@ -27,7 +28,7 @@ describe("Abilities - Dry Skin", () => { game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.enemyAbility(Abilities.DRY_SKIN); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemySpecies(Species.CHARMANDER); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.CHANDELURE); @@ -128,7 +129,7 @@ describe("Abilities - Dry Skin", () => { expect(enemy).not.toBe(undefined); enemy.hp = 1; - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); + game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); game.doAttack(getMovePosition(game.scene, 0, Moves.WATER_GUN)); await game.phaseInterceptor.to(TurnEndPhase); diff --git a/src/test/abilities/hustle.test.ts b/src/test/abilities/hustle.test.ts index cea0bc10799..b2033f7ef5e 100644 --- a/src/test/abilities/hustle.test.ts +++ b/src/test/abilities/hustle.test.ts @@ -9,6 +9,7 @@ import { DamagePhase, MoveEffectPhase } from "#app/phases.js"; import { Abilities } from "#app/enums/abilities.js"; import { Stat } from "#app/enums/stat.js"; import { allMoves } from "#app/data/move.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Hustle", () => { let phaserGame: Phaser.Game; @@ -31,7 +32,7 @@ describe("Abilities - Hustle", () => { vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); - vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); }); diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index 6930c0d1db8..4ffc6fd848c 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -110,7 +110,7 @@ describe("Abilities - Ice Face", () => { it("transforms to Ice Face when Hail or Snow starts", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.QUICK_ATTACK]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HAIL, Moves.HAIL, Moves.HAIL, Moves.HAIL]); + game.override.enemyMoveset([Moves.HAIL, Moves.HAIL, Moves.HAIL, Moves.HAIL]); await game.startBattle([Species.MAGIKARP]); @@ -131,7 +131,7 @@ describe("Abilities - Ice Face", () => { }); it("transforms to Ice Face when summoned on arena with active Snow or Hail", async () => { - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SNOWSCAPE]); await game.startBattle([Species.EISCUE, Species.NINJASK]); @@ -159,7 +159,7 @@ describe("Abilities - Ice Face", () => { it("will not revert to its Ice Face if there is already Hail when it changes into Noice", async () => { game.override.enemySpecies(Species.SHUCKLE); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); await game.startBattle([Species.EISCUE]); @@ -178,7 +178,7 @@ describe("Abilities - Ice Face", () => { }); it("persists form change when switched out", async () => { - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.QUICK_ATTACK, Moves.QUICK_ATTACK, Moves.QUICK_ATTACK, Moves.QUICK_ATTACK]); + game.override.enemyMoveset([Moves.QUICK_ATTACK, Moves.QUICK_ATTACK, Moves.QUICK_ATTACK, Moves.QUICK_ATTACK]); await game.startBattle([Species.EISCUE, Species.MAGIKARP]); diff --git a/src/test/abilities/intimidate.test.ts b/src/test/abilities/intimidate.test.ts index b3edc0d0206..28ed00e30a5 100644 --- a/src/test/abilities/intimidate.test.ts +++ b/src/test/abilities/intimidate.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Intimidate", () => { vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); game.override.startingWave(3); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); it("single - wild with switch", async () => { @@ -255,7 +255,7 @@ describe("Abilities - Intimidate", () => { it("single - trainer should only trigger once and each time he switch", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH]); + game.override.enemyMoveset([Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH]); game.override.startingWave(5); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; @@ -294,7 +294,7 @@ describe("Abilities - Intimidate", () => { it("single - trainer should only trigger once whatever turn we are", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); game.override.startingWave(5); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; diff --git a/src/test/abilities/libero.test.ts b/src/test/abilities/libero.test.ts index bde6d74f74f..ea7fe46bbfc 100644 --- a/src/test/abilities/libero.test.ts +++ b/src/test/abilities/libero.test.ts @@ -13,6 +13,7 @@ import { Weather, WeatherType } from "#app/data/weather.js"; import { Type } from "#app/data/type.js"; import { Biome } from "#enums/biome"; import { PlayerPokemon } from "#app/field/pokemon.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -36,7 +37,7 @@ describe("Abilities - Protean", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LIBERO); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); + game.override.enemyMoveset([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); }); test( @@ -184,7 +185,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the pokemon's move misses", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); await game.startBattle([Species.MAGIKARP]); @@ -207,7 +208,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the pokemon's move is protected against", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); + game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/moxie.test.ts b/src/test/abilities/moxie.test.ts index a2a50f15488..daebf08e0b7 100644 --- a/src/test/abilities/moxie.test.ts +++ b/src/test/abilities/moxie.test.ts @@ -40,7 +40,7 @@ describe("Abilities - Moxie", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); it("MOXIE", async() => { diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index 991ccefd265..55c1b5dc6fe 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -11,6 +11,7 @@ import { BattleStat } from "#app/data/battle-stat.js"; import { Type } from "#app/data/type.js"; import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import { StatusEffect } from "#app/data/status-effect.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -35,7 +36,7 @@ describe("Abilities - Parental Bond", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PARENTAL_BOND); game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.INSOMNIA); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); }); @@ -211,7 +212,7 @@ describe("Abilities - Parental Bond", () => { "ability should not apply multiplier to counter moves", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.COUNTER]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle([Species.CHARIZARD]); @@ -569,7 +570,7 @@ describe("Abilities - Parental Bond", () => { "ability should not cause user to hit into King's Shield more than once", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.KINGS_SHIELD,Moves.KINGS_SHIELD,Moves.KINGS_SHIELD,Moves.KINGS_SHIELD]); + game.override.enemyMoveset([Moves.KINGS_SHIELD,Moves.KINGS_SHIELD,Moves.KINGS_SHIELD,Moves.KINGS_SHIELD]); await game.startBattle([Species.CHARIZARD]); diff --git a/src/test/abilities/power_construct.test.ts b/src/test/abilities/power_construct.test.ts index cf2c4769ad9..6c775fdec1d 100644 --- a/src/test/abilities/power_construct.test.ts +++ b/src/test/abilities/power_construct.test.ts @@ -31,7 +31,7 @@ describe("Abilities - POWER CONSTRUCT", () => { game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.POWER_CONSTRUCT); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); test( diff --git a/src/test/abilities/power_spot.test.ts b/src/test/abilities/power_spot.test.ts index b63ad8522e4..f47f977046e 100644 --- a/src/test/abilities/power_spot.test.ts +++ b/src/test/abilities/power_spot.test.ts @@ -8,6 +8,7 @@ import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { allMoves } from "#app/data/move.js"; import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; import { Abilities } from "#app/enums/abilities.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Power Spot", () => { let phaserGame: Phaser.Game; @@ -29,7 +30,7 @@ describe("Abilities - Power Spot", () => { game = new GameManager(phaserGame); game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); }); diff --git a/src/test/abilities/protean.test.ts b/src/test/abilities/protean.test.ts index a47777a01c1..c852b9b0f14 100644 --- a/src/test/abilities/protean.test.ts +++ b/src/test/abilities/protean.test.ts @@ -13,6 +13,7 @@ import { Weather, WeatherType } from "#app/data/weather.js"; import { Type } from "#app/data/type.js"; import { Biome } from "#enums/biome"; import { PlayerPokemon } from "#app/field/pokemon.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -36,7 +37,7 @@ describe("Abilities - Protean", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PROTEAN); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); + game.override.enemyMoveset([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); }); test( @@ -184,7 +185,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the pokemon's move misses", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); await game.startBattle([Species.MAGIKARP]); @@ -207,7 +208,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the pokemon's move is protected against", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); + game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/quick_draw.test.ts b/src/test/abilities/quick_draw.test.ts index 922725b6ea0..cc4d1a5612a 100644 --- a/src/test/abilities/quick_draw.test.ts +++ b/src/test/abilities/quick_draw.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Quick Draw", () => { vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.TACKLE)); + game.override.enemyMoveset(Array(4).fill(Moves.TACKLE)); vi.spyOn(allAbilities[Abilities.QUICK_DRAW].getAttrs(BypassSpeedChanceAbAttr)[0], "chance", "get").mockReturnValue(100); }); @@ -78,7 +78,7 @@ describe("Abilities - Quick Draw", () => { ); test("does not increase priority", async () => { - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.EXTREME_SPEED)); + game.override.enemyMoveset(Array(4).fill(Moves.EXTREME_SPEED)); await game.startBattle(); diff --git a/src/test/abilities/sand_veil.test.ts b/src/test/abilities/sand_veil.test.ts index 4077dca2b31..ddf9123d35b 100644 --- a/src/test/abilities/sand_veil.test.ts +++ b/src/test/abilities/sand_veil.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Sand Veil", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.enemySpecies(Species.MEOWSCARADA); game.override.enemyAbility(Abilities.INSOMNIA); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); + game.override.enemyMoveset([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override diff --git a/src/test/abilities/sap_sipper.test.ts b/src/test/abilities/sap_sipper.test.ts index ce961f107dd..970d830bf6d 100644 --- a/src/test/abilities/sap_sipper.test.ts +++ b/src/test/abilities/sap_sipper.test.ts @@ -39,7 +39,7 @@ describe("Abilities - Sap Sipper", () => { const enemyAbility = Abilities.SAP_SIPPER; vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); + game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.DUSKULL); game.override.enemyAbility(enemyAbility); @@ -60,7 +60,7 @@ describe("Abilities - Sap Sipper", () => { const enemyAbility = Abilities.SAP_SIPPER; vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); + game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(enemyAbility); @@ -79,7 +79,7 @@ describe("Abilities - Sap Sipper", () => { const enemyAbility = Abilities.SAP_SIPPER; vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); + game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(enemyAbility); @@ -99,7 +99,7 @@ describe("Abilities - Sap Sipper", () => { const enemyAbility = Abilities.SAP_SIPPER; vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); + game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(enemyAbility); @@ -121,7 +121,7 @@ describe("Abilities - Sap Sipper", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); + game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.NONE); @@ -146,7 +146,7 @@ describe("Abilities - Sap Sipper", () => { const enemyAbility = Abilities.SAP_SIPPER; vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); + game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(enemyAbility); diff --git a/src/test/abilities/schooling.test.ts b/src/test/abilities/schooling.test.ts index c39c9d6ce80..0e341687f80 100644 --- a/src/test/abilities/schooling.test.ts +++ b/src/test/abilities/schooling.test.ts @@ -31,7 +31,7 @@ describe("Abilities - SCHOOLING", () => { game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SCHOOLING); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); test( diff --git a/src/test/abilities/screen_cleaner.test.ts b/src/test/abilities/screen_cleaner.test.ts index 864f088bdcf..22114b737a9 100644 --- a/src/test/abilities/screen_cleaner.test.ts +++ b/src/test/abilities/screen_cleaner.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Screen Cleaner", () => { it("removes Aurora Veil", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HAIL]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); + game.override.enemyMoveset([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]); @@ -49,7 +49,7 @@ describe("Abilities - Screen Cleaner", () => { }); it("removes Light Screen", async () => { - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN]); + game.override.enemyMoveset([Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]); @@ -66,7 +66,7 @@ describe("Abilities - Screen Cleaner", () => { }); it("removes Reflect", async () => { - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.REFLECT, Moves.REFLECT, Moves.REFLECT, Moves.REFLECT]); + game.override.enemyMoveset([Moves.REFLECT, Moves.REFLECT, Moves.REFLECT, Moves.REFLECT]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]); diff --git a/src/test/abilities/serene_grace.test.ts b/src/test/abilities/serene_grace.test.ts index e8d1f242041..1515feecdca 100644 --- a/src/test/abilities/serene_grace.test.ts +++ b/src/test/abilities/serene_grace.test.ts @@ -38,7 +38,7 @@ describe("Abilities - Serene Grace", () => { game.override.enemySpecies(Species.ONIX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); it("Move chance without Serene Grace", async() => { diff --git a/src/test/abilities/sheer_force.test.ts b/src/test/abilities/sheer_force.test.ts index 5e7eb11a3c3..d4665215e00 100644 --- a/src/test/abilities/sheer_force.test.ts +++ b/src/test/abilities/sheer_force.test.ts @@ -38,7 +38,7 @@ describe("Abilities - Sheer Force", () => { game.override.enemySpecies(Species.ONIX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); it("Sheer Force", async() => { diff --git a/src/test/abilities/shield_dust.test.ts b/src/test/abilities/shield_dust.test.ts index c34ac94a6ed..edf9555d8b6 100644 --- a/src/test/abilities/shield_dust.test.ts +++ b/src/test/abilities/shield_dust.test.ts @@ -39,7 +39,7 @@ describe("Abilities - Shield Dust", () => { game.override.enemyAbility(Abilities.SHIELD_DUST); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); it("Shield Dust", async() => { diff --git a/src/test/abilities/shields_down.test.ts b/src/test/abilities/shields_down.test.ts index ec13404b19c..a0790501096 100644 --- a/src/test/abilities/shields_down.test.ts +++ b/src/test/abilities/shields_down.test.ts @@ -31,7 +31,7 @@ describe("Abilities - SHIELDS DOWN", () => { game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHIELDS_DOWN); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); test( diff --git a/src/test/abilities/steely_spirit.test.ts b/src/test/abilities/steely_spirit.test.ts index f4b24d2c21e..3b276b6ad4a 100644 --- a/src/test/abilities/steely_spirit.test.ts +++ b/src/test/abilities/steely_spirit.test.ts @@ -9,6 +9,7 @@ import { allMoves } from "#app/data/move.js"; import { allAbilities } from "#app/data/ability.js"; import { Abilities } from "#app/enums/abilities.js"; import { MoveEffectPhase, SelectTargetPhase } from "#app/phases.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Steely Spirit", () => { let phaserGame: Phaser.Game; @@ -33,7 +34,7 @@ describe("Abilities - Steely Spirit", () => { game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.IRON_HEAD, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(allMoves[moveToCheck], "calculateBattlePower"); }); diff --git a/src/test/abilities/unseen_fist.test.ts b/src/test/abilities/unseen_fist.test.ts index 6760b1098ba..d8005f2e948 100644 --- a/src/test/abilities/unseen_fist.test.ts +++ b/src/test/abilities/unseen_fist.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Unseen Fist", () => { game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.URSHIFU); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); + game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); }); @@ -69,7 +69,7 @@ describe("Abilities - Unseen Fist", () => { async function testUnseenFistHitResult(game: GameManager, attackMove: Moves, protectMove: Moves, shouldSucceed: boolean = true): Promise { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([attackMove]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([protectMove, protectMove, protectMove, protectMove]); + game.override.enemyMoveset([protectMove, protectMove, protectMove, protectMove]); await game.startBattle(); diff --git a/src/test/abilities/volt_absorb.test.ts b/src/test/abilities/volt_absorb.test.ts index 3a586df897a..51ce6b8d2e1 100644 --- a/src/test/abilities/volt_absorb.test.ts +++ b/src/test/abilities/volt_absorb.test.ts @@ -39,7 +39,7 @@ describe("Abilities - Volt Absorb", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); + game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.DUSKULL); game.override.enemyAbility(Abilities.BALL_FETCH); diff --git a/src/test/abilities/wind_power.test.ts b/src/test/abilities/wind_power.test.ts index 5eaf87f182f..7c7e2af72df 100644 --- a/src/test/abilities/wind_power.test.ts +++ b/src/test/abilities/wind_power.test.ts @@ -10,6 +10,7 @@ import { Moves } from "#enums/moves"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Wind Power", () => { let phaserGame: Phaser.Game; @@ -31,7 +32,7 @@ describe("Abilities - Wind Power", () => { game.override.enemySpecies(Species.SHIFTRY); game.override.enemyAbility(Abilities.WIND_POWER); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); }); it("it becomes charged when hit by wind moves", async () => { diff --git a/src/test/abilities/wind_rider.test.ts b/src/test/abilities/wind_rider.test.ts index 084317f6e09..8be74c50f1c 100644 --- a/src/test/abilities/wind_rider.test.ts +++ b/src/test/abilities/wind_rider.test.ts @@ -10,6 +10,7 @@ import { Moves } from "#enums/moves"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { BattleStat } from "#app/data/battle-stat.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Wind Rider", () => { let phaserGame: Phaser.Game; @@ -31,7 +32,7 @@ describe("Abilities - Wind Rider", () => { game.override.enemySpecies(Species.SHIFTRY); game.override.enemyAbility(Abilities.WIND_RIDER); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); }); it("takes no damage from wind moves and its Attack is increased by one stage when hit by one", async () => { diff --git a/src/test/abilities/wonder_skin.test.ts b/src/test/abilities/wonder_skin.test.ts index 5528b879bdf..89f8088ab59 100644 --- a/src/test/abilities/wonder_skin.test.ts +++ b/src/test/abilities/wonder_skin.test.ts @@ -9,6 +9,7 @@ import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { allMoves } from "#app/data/move.js"; import { allAbilities } from "#app/data/ability.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Wonder Skin", () => { let phaserGame: Phaser.Game; @@ -31,7 +32,7 @@ describe("Abilities - Wonder Skin", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.WONDER_SKIN); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); }); it("lowers accuracy of status moves to 50%", async () => { diff --git a/src/test/abilities/zen_mode.test.ts b/src/test/abilities/zen_mode.test.ts index 7b6f3e66aa1..40e43d3130d 100644 --- a/src/test/abilities/zen_mode.test.ts +++ b/src/test/abilities/zen_mode.test.ts @@ -49,7 +49,7 @@ describe("Abilities - ZEN MODE", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); test( diff --git a/src/test/abilities/zero_to_hero.test.ts b/src/test/abilities/zero_to_hero.test.ts index 78cc87ad592..a55d56543e2 100644 --- a/src/test/abilities/zero_to_hero.test.ts +++ b/src/test/abilities/zero_to_hero.test.ts @@ -31,7 +31,7 @@ describe("Abilities - ZERO TO HERO", () => { game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZERO_TO_HERO); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); test( diff --git a/src/test/achievements/achievement.test.ts b/src/test/achievements/achievement.test.ts index 162c8c81ee3..b59d6ef1e89 100644 --- a/src/test/achievements/achievement.test.ts +++ b/src/test/achievements/achievement.test.ts @@ -105,9 +105,9 @@ describe("RibbonAchv", () => { beforeEach(() => { vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(0); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(0); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([]); game = new GameManager(phaserGame); + game.override.enemyMoveset([]); game.override.enemySpecies(0); game.override.startingWave(0); scene = game.scene; diff --git a/src/test/arena/arena_gravity.test.ts b/src/test/arena/arena_gravity.test.ts index 5058f8701b7..3ce1507eae7 100644 --- a/src/test/arena/arena_gravity.test.ts +++ b/src/test/arena/arena_gravity.test.ts @@ -34,7 +34,7 @@ describe("Arena - Gravity", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(new Array(4).fill(Moves.SPLASH)); + game.override.enemyMoveset(new Array(4).fill(Moves.SPLASH)); }); it("non-OHKO move accuracy is multiplied by 1.67", async () => { diff --git a/src/test/arena/weather_fog.test.ts b/src/test/arena/weather_fog.test.ts index 273e5c88b19..ec6cbba3d32 100644 --- a/src/test/arena/weather_fog.test.ts +++ b/src/test/arena/weather_fog.test.ts @@ -35,7 +35,7 @@ describe("Weather - Fog", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(new Array(4).fill(Moves.SPLASH)); + game.override.enemyMoveset(new Array(4).fill(Moves.SPLASH)); }); it("move accuracy is multiplied by 90%", async () => { diff --git a/src/test/battle/battle.test.ts b/src/test/battle/battle.test.ts index a8f17543cc4..7c77cd9eaf3 100644 --- a/src/test/battle/battle.test.ts +++ b/src/test/battle/battle.test.ts @@ -98,7 +98,7 @@ describe("Test Battle Phase", () => { .battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); await game.startBattle(); game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex()); @@ -117,7 +117,7 @@ describe("Test Battle Phase", () => { game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP]); + game.override.enemyMoveset([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP]); game.override.battleType("single"); await game.startBattle(); game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { @@ -269,7 +269,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle([ Species.DARMANITAN, Species.CHARIZARD, @@ -298,7 +298,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle(); const turn = game.scene.currentBattle.turn; game.doAttack(0); @@ -316,7 +316,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle(); const waveIndex = game.scene.currentBattle.waveIndex; game.doAttack(0); diff --git a/src/test/battle/error-handling.test.ts b/src/test/battle/error-handling.test.ts index 75aad9a4ee3..2c43edcfbc5 100644 --- a/src/test/battle/error-handling.test.ts +++ b/src/test/battle/error-handling.test.ts @@ -32,7 +32,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); it.skip("to next turn", async() => { diff --git a/src/test/battle/special_battle.test.ts b/src/test/battle/special_battle.test.ts index 7b6330a9fe8..5ebbb010d2f 100644 --- a/src/test/battle/special_battle.test.ts +++ b/src/test/battle/special_battle.test.ts @@ -31,7 +31,7 @@ describe("Test Battle Phase", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); it("startBattle 2vs1 boss", async() => { diff --git a/src/test/items/grip_claw.test.ts b/src/test/items/grip_claw.test.ts index defa55ca5f1..611d63195fc 100644 --- a/src/test/items/grip_claw.test.ts +++ b/src/test/items/grip_claw.test.ts @@ -35,7 +35,7 @@ describe("Items - Grip Claw", () => { vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]); game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.KLUTZ); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); + game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([ {name: "BERRY", type: BerryType.SITRUS, count: 2}, {name: "BERRY", type: BerryType.LUM, count: 2} diff --git a/src/test/items/leek.test.ts b/src/test/items/leek.test.ts index a6268a397a8..e03caec36d9 100644 --- a/src/test/items/leek.test.ts +++ b/src/test/items/leek.test.ts @@ -28,7 +28,7 @@ describe("Items - Leek", () => { game = new GameManager(phaserGame); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); + game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.battleType("single"); diff --git a/src/test/items/leftovers.test.ts b/src/test/items/leftovers.test.ts index d3d6a8860b2..ee2ead08234 100644 --- a/src/test/items/leftovers.test.ts +++ b/src/test/items/leftovers.test.ts @@ -31,7 +31,7 @@ describe("Items - Leftovers", () => { vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.UNNERVE); - vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); vi.spyOn(overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "LEFTOVERS", count: 1}]); }); diff --git a/src/test/items/scope_lens.test.ts b/src/test/items/scope_lens.test.ts index 9ba5b96ed07..4ddb4177cd9 100644 --- a/src/test/items/scope_lens.test.ts +++ b/src/test/items/scope_lens.test.ts @@ -28,7 +28,7 @@ describe("Items - Scope Lens", () => { game = new GameManager(phaserGame); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); + game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.battleType("single"); diff --git a/src/test/items/toxic_orb.test.ts b/src/test/items/toxic_orb.test.ts index 50bf108a008..0bd58a0cd74 100644 --- a/src/test/items/toxic_orb.test.ts +++ b/src/test/items/toxic_orb.test.ts @@ -42,7 +42,7 @@ describe("Items - Toxic orb", () => { game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([oppMoveToUse, oppMoveToUse, oppMoveToUse, oppMoveToUse]); + game.override.enemyMoveset([oppMoveToUse, oppMoveToUse, oppMoveToUse, oppMoveToUse]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "TOXIC_ORB", }]); diff --git a/src/test/moves/astonish.test.ts b/src/test/moves/astonish.test.ts index 9f6ea21ae93..16fe3013b22 100644 --- a/src/test/moves/astonish.test.ts +++ b/src/test/moves/astonish.test.ts @@ -32,7 +32,7 @@ describe("Moves - Astonish", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ASTONISH, Moves.SPLASH]); game.override.enemySpecies(Species.BLASTOISE); game.override.enemyAbility(Abilities.INSOMNIA); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/aurora_veil.test.ts b/src/test/moves/aurora_veil.test.ts index 3922d86a74d..4d4d48994e8 100644 --- a/src/test/moves/aurora_veil.test.ts +++ b/src/test/moves/aurora_veil.test.ts @@ -40,7 +40,7 @@ describe("Moves - Aurora Veil", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); + game.override.enemyMoveset([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.weather(WeatherType.HAIL); }); diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index 3cd043cc390..4d8fc6c79c5 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -39,7 +39,7 @@ describe("Moves - Ceaseless Edge", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.CEASELESS_EDGE, Moves.SPLASH, Moves.ROAR ]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); + game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); vi.spyOn(allMoves[Moves.CEASELESS_EDGE], "accuracy", "get").mockReturnValue(100); }); diff --git a/src/test/moves/double_team.test.ts b/src/test/moves/double_team.test.ts index 13f8087d165..886f6d58085 100644 --- a/src/test/moves/double_team.test.ts +++ b/src/test/moves/double_team.test.ts @@ -33,7 +33,7 @@ describe("Moves - Double Team", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); it("increases the user's evasion by one stage.", async () => { diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index 419fca98771..ca58d098b35 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -12,6 +12,7 @@ import { BattleStat } from "#app/data/battle-stat"; import { BattlerTagType } from "#enums/battler-tag-type"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import { modifierTypes } from "#app/modifier/modifier-type"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Dragon Rage", () => { let phaserGame: Phaser.Game; @@ -44,7 +45,7 @@ describe("Moves - Dragon Rage", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/dynamax_cannon.test.ts b/src/test/moves/dynamax_cannon.test.ts index 94900747662..96ffb461ea2 100644 --- a/src/test/moves/dynamax_cannon.test.ts +++ b/src/test/moves/dynamax_cannon.test.ts @@ -37,7 +37,7 @@ describe("Moves - Dynamax Cannon", () => { vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); + game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(dynamaxCannon, "calculateBattlePower"); }); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index f5c1218af74..b58ae553ebe 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -9,6 +9,7 @@ import { Abilities } from "#enums/abilities"; import { Species } from "#app/enums/species.js"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import { BattleStat } from "#app/data/battle-stat"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Fissure", () => { let phaserGame: Phaser.Game; @@ -38,7 +39,7 @@ describe("Moves - Fissure", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/flower_shield.test.ts b/src/test/moves/flower_shield.test.ts index b51651aaf76..b27cdbbcf60 100644 --- a/src/test/moves/flower_shield.test.ts +++ b/src/test/moves/flower_shield.test.ts @@ -13,6 +13,7 @@ import { BattleStat } from "#app/data/battle-stat.js"; import { Biome } from "#app/enums/biome.js"; import { Type } from "#app/data/type.js"; import { SemiInvulnerableTag } from "#app/data/battler-tags.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Flower Shield", () => { let phaserGame: Phaser.Game; @@ -34,7 +35,7 @@ describe("Moves - Flower Shield", () => { game.override.enemyAbility(Abilities.NONE); game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLOWER_SHIELD, Moves.SPLASH]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); }); it("increases defense of all Grass-type Pokemon on the field by one stage - single battle", async () => { @@ -81,7 +82,7 @@ describe("Moves - Flower Shield", () => { */ it("does not increase defense of a pokemon in semi-vulnerable state", async () => { game.override.enemySpecies(Species.PARAS); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DIG, Moves.DIG, Moves.DIG, Moves.DIG]); + game.override.enemyMoveset([Moves.DIG, Moves.DIG, Moves.DIG, Moves.DIG]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(50); await game.startBattle([Species.CHERRIM]); diff --git a/src/test/moves/follow_me.test.ts b/src/test/moves/follow_me.test.ts index 9d2dc016872..1e29805b760 100644 --- a/src/test/moves/follow_me.test.ts +++ b/src/test/moves/follow_me.test.ts @@ -38,7 +38,7 @@ describe("Moves - Follow Me", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); test( @@ -103,7 +103,7 @@ describe("Moves - Follow Me", () => { async () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.STALWART); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.QUICK_ATTACK ]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME ]); + game.override.enemyMoveset([ Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME ]); await game.startBattle([ Species.AMOONGUSS, Species.CHARIZARD ]); @@ -137,7 +137,7 @@ describe("Moves - Follow Me", () => { "move effect should be bypassed by Snipe Shot", async () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SNIPE_SHOT ]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME ]); + game.override.enemyMoveset([ Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME ]); await game.startBattle([ Species.AMOONGUSS, Species.CHARIZARD ]); diff --git a/src/test/moves/gastro_acid.test.ts b/src/test/moves/gastro_acid.test.ts index 4275ee64fdf..d8288b46790 100644 --- a/src/test/moves/gastro_acid.test.ts +++ b/src/test/moves/gastro_acid.test.ts @@ -10,6 +10,7 @@ import { getMovePosition } from "../utils/gameManagerUtils"; import { MoveResult } from "#app/field/pokemon.js"; import { Stat } from "#app/data/pokemon-stat.js"; import { Species } from "#app/enums/species.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -35,7 +36,7 @@ describe("Moves - Gastro Acid", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER]); game.override.enemySpecies(Species.BIDOOF); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.WATER_ABSORB); }); diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index ea0e6032709..d2decd5e35b 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -30,7 +30,7 @@ describe("Moves - Glaive Rush", () => { vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.GLAIVE_RUSH)); + game.override.enemyMoveset(Array(4).fill(Moves.GLAIVE_RUSH)); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.KLINK); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FUR_COAT); @@ -67,7 +67,7 @@ describe("Moves - Glaive Rush", () => { it("interacts properly with multi-lens", async() => { vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 2}]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.AVALANCHE)); + game.override.enemyMoveset(Array(4).fill(Moves.AVALANCHE)); await game.startBattle(); const player = game.scene.getPlayerPokemon(); const enemy = game.scene.getEnemyPokemon(); @@ -86,7 +86,7 @@ describe("Moves - Glaive Rush", () => { }, 20000); it("secondary effects only last until next move", async() => { - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.SHADOW_SNEAK)); + game.override.enemyMoveset(Array(4).fill(Moves.SHADOW_SNEAK)); await game.startBattle(); const player = game.scene.getPlayerPokemon(); const enemy = game.scene.getEnemyPokemon(); @@ -110,7 +110,7 @@ describe("Moves - Glaive Rush", () => { }, 20000); it("secondary effects are removed upon switching", async() => { - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.SHADOW_SNEAK)); + game.override.enemyMoveset(Array(4).fill(Moves.SHADOW_SNEAK)); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(0); await game.startBattle([Species.KLINK, Species.FEEBAS]); const player = game.scene.getPlayerPokemon(); diff --git a/src/test/moves/growth.test.ts b/src/test/moves/growth.test.ts index 56f62ae60a1..f2324c94f88 100644 --- a/src/test/moves/growth.test.ts +++ b/src/test/moves/growth.test.ts @@ -40,7 +40,7 @@ describe("Moves - Growth", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); it("GROWTH", async() => { diff --git a/src/test/moves/hard_press.test.ts b/src/test/moves/hard_press.test.ts index 959b90cdde8..8e6ebb5d404 100644 --- a/src/test/moves/hard_press.test.ts +++ b/src/test/moves/hard_press.test.ts @@ -10,6 +10,7 @@ import { Moves } from "#enums/moves"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { allMoves } from "#app/data/move.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Hard Press", () => { let phaserGame: Phaser.Game; @@ -33,7 +34,7 @@ describe("Moves - Hard Press", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemySpecies(Species.MUNCHLAX); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HARD_PRESS]); vi.spyOn(moveToCheck, "calculateBattlePower"); }); diff --git a/src/test/moves/hyper_beam.test.ts b/src/test/moves/hyper_beam.test.ts index 54789b68fbf..b6c6c08f089 100644 --- a/src/test/moves/hyper_beam.test.ts +++ b/src/test/moves/hyper_beam.test.ts @@ -33,7 +33,7 @@ describe("Moves - Hyper Beam", () => { vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.SPLASH)); + game.override.enemyMoveset(Array(4).fill(Moves.SPLASH)); vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HYPER_BEAM, Moves.TACKLE]); vi.spyOn(allMoves[Moves.HYPER_BEAM], "accuracy", "get").mockReturnValue(100); diff --git a/src/test/moves/light_screen.test.ts b/src/test/moves/light_screen.test.ts index 60220b71a1c..e35a9a95c71 100644 --- a/src/test/moves/light_screen.test.ts +++ b/src/test/moves/light_screen.test.ts @@ -39,7 +39,7 @@ describe("Moves - Light Screen", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.DAZZLING_GLEAM, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN]); + game.override.enemyMoveset([Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); }); diff --git a/src/test/moves/magnet_rise.test.ts b/src/test/moves/magnet_rise.test.ts index ddfa068fe4b..9543ee7c91b 100644 --- a/src/test/moves/magnet_rise.test.ts +++ b/src/test/moves/magnet_rise.test.ts @@ -26,7 +26,7 @@ describe("Moves - Magnet Rise", () => { game.override.battleType("single"); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGNEZONE); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]); + game.override.enemyMoveset([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse, Moves.SPLASH, Moves.GRAVITY, Moves.BATON_PASS]); diff --git a/src/test/moves/make_it_rain.test.ts b/src/test/moves/make_it_rain.test.ts index ee4aef3e343..1359c947c51 100644 --- a/src/test/moves/make_it_rain.test.ts +++ b/src/test/moves/make_it_rain.test.ts @@ -12,6 +12,7 @@ import { Moves } from "#enums/moves"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { BattleStat } from "#app/data/battle-stat.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -35,7 +36,7 @@ describe("Moves - Make It Rain", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MAKE_IT_RAIN, Moves.SPLASH]); game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.INSOMNIA); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); }); diff --git a/src/test/moves/multi_target.test.ts b/src/test/moves/multi_target.test.ts index 40eb2e7daa6..7db6e7ec5f9 100644 --- a/src/test/moves/multi_target.test.ts +++ b/src/test/moves/multi_target.test.ts @@ -8,6 +8,7 @@ import { Abilities } from "#app/enums/abilities.js"; import { Species } from "#app/enums/species.js"; import { getMovePosition } from "../utils/gameManagerUtils"; import { TurnEndPhase } from "#app/phases.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -167,7 +168,7 @@ function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) { game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE, Moves.HYPER_VOICE, Moves.SURF, Moves.SPLASH]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(50); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(40); diff --git a/src/test/moves/octolock.test.ts b/src/test/moves/octolock.test.ts index 8881170a9a3..a8578153a42 100644 --- a/src/test/moves/octolock.test.ts +++ b/src/test/moves/octolock.test.ts @@ -9,6 +9,7 @@ import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import { TrappedTag } from "#app/data/battler-tags.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Octolock", () => { describe("integration tests", () => { @@ -31,7 +32,7 @@ describe("Moves - Octolock", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.NONE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/moves/purify.test.ts b/src/test/moves/purify.test.ts index 551ecddbb64..05b3272521b 100644 --- a/src/test/moves/purify.test.ts +++ b/src/test/moves/purify.test.ts @@ -37,7 +37,7 @@ describe("Moves - Purify", () => { game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(10); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); + game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); }); test( diff --git a/src/test/moves/rage_powder.test.ts b/src/test/moves/rage_powder.test.ts index 779be067a95..514b2e7f4b4 100644 --- a/src/test/moves/rage_powder.test.ts +++ b/src/test/moves/rage_powder.test.ts @@ -37,13 +37,13 @@ describe("Moves - Rage Powder", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); test( "move effect should be bypassed by Grass type", async () => { - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER ]); + game.override.enemyMoveset([ Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER ]); await game.startBattle([ Species.AMOONGUSS, Species.VENUSAUR ]); @@ -77,7 +77,7 @@ describe("Moves - Rage Powder", () => { "move effect should be bypassed by Overcoat", async () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.OVERCOAT); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER ]); + game.override.enemyMoveset([ Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER ]); // Test with two non-Grass type player Pokemon await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD ]); diff --git a/src/test/moves/reflect.test.ts b/src/test/moves/reflect.test.ts index 2d4d791b902..fb279fa7689 100644 --- a/src/test/moves/reflect.test.ts +++ b/src/test/moves/reflect.test.ts @@ -39,7 +39,7 @@ describe("Moves - Reflect", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.REFLECT, Moves.REFLECT, Moves.REFLECT, Moves.REFLECT]); + game.override.enemyMoveset([Moves.REFLECT, Moves.REFLECT, Moves.REFLECT, Moves.REFLECT]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); }); diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index 93b07ce84fc..d3c80dcfc69 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -34,7 +34,7 @@ describe("Moves - Rollout", () => { game.override.enemyAbility(Abilities.NONE); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(SPLASH_ONLY); + game.override.enemyMoveset(SPLASH_ONLY); }); it("should double it's dmg on sequential uses but reset after 5", async () => { diff --git a/src/test/moves/roost.test.ts b/src/test/moves/roost.test.ts index 284937bd7db..47c0bcc6156 100644 --- a/src/test/moves/roost.test.ts +++ b/src/test/moves/roost.test.ts @@ -33,7 +33,7 @@ describe("Moves - Roost", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.STOMPING_TANTRUM ]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ROOST,Moves.ROOST,Moves.ROOST,Moves.ROOST]); + game.override.enemyMoveset([Moves.ROOST,Moves.ROOST,Moves.ROOST,Moves.ROOST]); }); test( diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index 62ecfbc6312..a66bcd28e1e 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -34,7 +34,7 @@ describe("Moves - Spikes", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.startingWave(3); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); + game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPIKES,Moves.SPLASH, Moves.ROAR]); }); diff --git a/src/test/moves/spit_up.test.ts b/src/test/moves/spit_up.test.ts index cb40a3a1177..4b58e9f73a0 100644 --- a/src/test/moves/spit_up.test.ts +++ b/src/test/moves/spit_up.test.ts @@ -11,6 +11,7 @@ import { StockpilingTag } from "#app/data/battler-tags.js"; import { MoveResult, TurnMove } from "#app/field/pokemon.js"; import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import { allMoves } from "#app/data/move.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Spit Up", () => { let phaserGame: Phaser.Game; @@ -30,7 +31,7 @@ describe("Moves - Spit Up", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.NONE); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/moves/spotlight.test.ts b/src/test/moves/spotlight.test.ts index 8ec1cd38069..4a61f28091e 100644 --- a/src/test/moves/spotlight.test.ts +++ b/src/test/moves/spotlight.test.ts @@ -37,7 +37,7 @@ describe("Moves - Spotlight", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); test( @@ -73,7 +73,7 @@ describe("Moves - Spotlight", () => { test( "move should cause other redirection moves to fail", async () => { - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME ]); + game.override.enemyMoveset([ Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME ]); await game.startBattle([ Species.AMOONGUSS, Species.CHARIZARD ]); diff --git a/src/test/moves/stockpile.test.ts b/src/test/moves/stockpile.test.ts index adc70aa99b2..760bbdf7381 100644 --- a/src/test/moves/stockpile.test.ts +++ b/src/test/moves/stockpile.test.ts @@ -10,6 +10,7 @@ import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; import { StockpilingTag } from "#app/data/battler-tags.js"; import { MoveResult, TurnMove } from "#app/field/pokemon.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Stockpile", () => { describe("integration tests", () => { @@ -30,7 +31,7 @@ describe("Moves - Stockpile", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.NONE); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/moves/swallow.test.ts b/src/test/moves/swallow.test.ts index c6a6f485d11..70826c02c5d 100644 --- a/src/test/moves/swallow.test.ts +++ b/src/test/moves/swallow.test.ts @@ -10,6 +10,7 @@ import { Species } from "#enums/species"; import { StockpilingTag } from "#app/data/battler-tags.js"; import { MoveResult, TurnMove } from "#app/field/pokemon.js"; import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Swallow", () => { let phaserGame: Phaser.Game; @@ -29,7 +30,7 @@ describe("Moves - Swallow", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.NONE); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); diff --git a/src/test/moves/tackle.test.ts b/src/test/moves/tackle.test.ts index 97da84b5d17..877651d9089 100644 --- a/src/test/moves/tackle.test.ts +++ b/src/test/moves/tackle.test.ts @@ -36,7 +36,7 @@ describe("Moves - Tackle", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1); game.override.startingWave(97); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.GROWTH,Moves.GROWTH,Moves.GROWTH,Moves.GROWTH]); + game.override.enemyMoveset([Moves.GROWTH,Moves.GROWTH,Moves.GROWTH,Moves.GROWTH]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); }); diff --git a/src/test/moves/tail_whip.test.ts b/src/test/moves/tail_whip.test.ts index af5597d62ed..5c9394dcabb 100644 --- a/src/test/moves/tail_whip.test.ts +++ b/src/test/moves/tail_whip.test.ts @@ -39,7 +39,7 @@ describe("Moves - Tail whip", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); + game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); it("TAIL_WHIP", async() => { diff --git a/src/test/moves/tailwind.test.ts b/src/test/moves/tailwind.test.ts index a4c62f77275..02924d429f3 100644 --- a/src/test/moves/tailwind.test.ts +++ b/src/test/moves/tailwind.test.ts @@ -11,6 +11,7 @@ import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Stat } from "#app/data/pokemon-stat.js"; import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { ArenaTagSide } from "#app/data/arena-tag.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Wind Rider", () => { let phaserGame: Phaser.Game; @@ -30,7 +31,7 @@ describe("Abilities - Wind Rider", () => { game = new GameManager(phaserGame); game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); }); it("doubles the Speed stat of the Pokemons on its side", async () => { diff --git a/src/test/moves/thousand_arrows.test.ts b/src/test/moves/thousand_arrows.test.ts index ca8609c7100..301bb89391d 100644 --- a/src/test/moves/thousand_arrows.test.ts +++ b/src/test/moves/thousand_arrows.test.ts @@ -35,7 +35,7 @@ describe("Moves - Thousand Arrows", () => { vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.THOUSAND_ARROWS ]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); + game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); }); it( diff --git a/src/test/moves/tidy_up.test.ts b/src/test/moves/tidy_up.test.ts index 3d55c0a42a2..d51f98e7974 100644 --- a/src/test/moves/tidy_up.test.ts +++ b/src/test/moves/tidy_up.test.ts @@ -9,6 +9,7 @@ import { Species } from "#enums/species"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { BattleStat } from "#app/data/battle-stat.js"; +import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Tidy Up", () => { @@ -30,7 +31,7 @@ describe("Moves - Tidy Up", () => { game.override.battleType("single"); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); + game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.FEEBAS); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TIDY_UP]); @@ -39,7 +40,7 @@ describe("Moves - Tidy Up", () => { it("spikes are cleared", async() => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPIKES, Moves.TIDY_UP]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPIKES, Moves.SPIKES, Moves.SPIKES, Moves.SPIKES]); + game.override.enemyMoveset([Moves.SPIKES, Moves.SPIKES, Moves.SPIKES, Moves.SPIKES]); await game.startBattle(); game.doAttack(getMovePosition(game.scene, 0, Moves.SPIKES)); @@ -52,7 +53,7 @@ describe("Moves - Tidy Up", () => { it("stealth rocks are cleared", async() => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STEALTH_ROCK, Moves.TIDY_UP]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STEALTH_ROCK, Moves.STEALTH_ROCK, Moves.STEALTH_ROCK, Moves.STEALTH_ROCK]); + game.override.enemyMoveset([Moves.STEALTH_ROCK, Moves.STEALTH_ROCK, Moves.STEALTH_ROCK, Moves.STEALTH_ROCK]); await game.startBattle(); game.doAttack(getMovePosition(game.scene, 0, Moves.STEALTH_ROCK)); @@ -65,7 +66,7 @@ describe("Moves - Tidy Up", () => { it("toxic spikes are cleared", async() => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TOXIC_SPIKES, Moves.TIDY_UP]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TOXIC_SPIKES, Moves.TOXIC_SPIKES, Moves.TOXIC_SPIKES, Moves.TOXIC_SPIKES]); + game.override.enemyMoveset([Moves.TOXIC_SPIKES, Moves.TOXIC_SPIKES, Moves.TOXIC_SPIKES, Moves.TOXIC_SPIKES]); await game.startBattle(); game.doAttack(getMovePosition(game.scene, 0, Moves.TOXIC_SPIKES)); @@ -78,7 +79,7 @@ describe("Moves - Tidy Up", () => { it("sticky webs are cleared", async() => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STICKY_WEB, Moves.TIDY_UP]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STICKY_WEB, Moves.STICKY_WEB, Moves.STICKY_WEB, Moves.STICKY_WEB]); + game.override.enemyMoveset([Moves.STICKY_WEB, Moves.STICKY_WEB, Moves.STICKY_WEB, Moves.STICKY_WEB]); await game.startBattle(); @@ -92,7 +93,7 @@ describe("Moves - Tidy Up", () => { it.skip("substitutes are cleared", async() => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SUBSTITUTE, Moves.TIDY_UP]); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SUBSTITUTE, Moves.SUBSTITUTE, Moves.SUBSTITUTE, Moves.SUBSTITUTE]); + game.override.enemyMoveset([Moves.SUBSTITUTE, Moves.SUBSTITUTE, Moves.SUBSTITUTE, Moves.SUBSTITUTE]); await game.startBattle(); diff --git a/src/test/ui/transfer-item.test.ts b/src/test/ui/transfer-item.test.ts index b17d5c7544f..06898a9182d 100644 --- a/src/test/ui/transfer-item.test.ts +++ b/src/test/ui/transfer-item.test.ts @@ -43,7 +43,7 @@ describe("UI - Transfer Items", () => { ]); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_CLAW]); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.enemyMoveset([Moves.SPLASH]); await game.startBattle([Species.RAYQUAZA, Species.RAYQUAZA, Species.RAYQUAZA]); From f8e6230a14c96edc64090e6bf44fd330ad7cd0dc Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:19:16 -0700 Subject: [PATCH 15/42] add OverridesHelper.starterSpecies() --- src/test/utils/overridesHelper.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index 7571a4eb657..c9627f38c0b 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -41,6 +41,17 @@ export class OverridesHelper { return this; } + /** + * Override the player (pokemon) {@linkcode Species | species} + * @param species the (pokemon) {@linkcode Species | species} to set + * @returns this + */ + starterSpecies(species: Species | number): this { + vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(species); + this.log(`Player Pokemon species set to ${Species[species]} (=${species})!`); + return this; + } + /** * Override each wave to have or not have standard trainer battles * @returns this From 5a173df24de7c30a09ec655f8d85eb2bf06c9445 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:24:07 -0700 Subject: [PATCH 16/42] apply game.override.starterSpecies --- src/test/abilities/dry_skin.test.ts | 2 +- src/test/abilities/quick_draw.test.ts | 2 +- src/test/abilities/sturdy.test.ts | 2 +- src/test/abilities/unseen_fist.test.ts | 2 +- src/test/achievements/achievement.test.ts | 2 +- src/test/battle/battle.test.ts | 10 +++++----- src/test/battle/error-handling.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 2 +- src/test/moves/fissure.test.ts | 2 +- src/test/moves/follow_me.test.ts | 2 +- src/test/moves/glaive_rush.test.ts | 4 ++-- src/test/moves/magnet_rise.test.ts | 2 +- src/test/moves/purify.test.ts | 2 +- src/test/moves/rage_powder.test.ts | 2 +- src/test/moves/rollout.test.ts | 2 +- src/test/moves/spotlight.test.ts | 2 +- src/test/moves/tidy_up.test.ts | 2 +- 17 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/test/abilities/dry_skin.test.ts b/src/test/abilities/dry_skin.test.ts index ddcb8094b0b..dfe358d6628 100644 --- a/src/test/abilities/dry_skin.test.ts +++ b/src/test/abilities/dry_skin.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Dry Skin", () => { game.override.enemyMoveset(SPLASH_ONLY); game.override.enemySpecies(Species.CHARMANDER); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.CHANDELURE); + game.override.starterSpecies(Species.CHANDELURE); }); it("during sunlight, lose 1/8 of maximum health at the end of each turn", async () => { diff --git a/src/test/abilities/quick_draw.test.ts b/src/test/abilities/quick_draw.test.ts index cc4d1a5612a..44e5b12e21b 100644 --- a/src/test/abilities/quick_draw.test.ts +++ b/src/test/abilities/quick_draw.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Quick Draw", () => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); + game.override.starterSpecies(Species.MAGIKARP); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.QUICK_DRAW); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TAIL_WHIP]); diff --git a/src/test/abilities/sturdy.test.ts b/src/test/abilities/sturdy.test.ts index 87a998e560d..b6ea7660a73 100644 --- a/src/test/abilities/sturdy.test.ts +++ b/src/test/abilities/sturdy.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Sturdy", () => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.LUCARIO); + game.override.starterSpecies(Species.LUCARIO); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.CLOSE_COMBAT, Moves.FISSURE]); diff --git a/src/test/abilities/unseen_fist.test.ts b/src/test/abilities/unseen_fist.test.ts index d8005f2e948..53f457f65c2 100644 --- a/src/test/abilities/unseen_fist.test.ts +++ b/src/test/abilities/unseen_fist.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Unseen Fist", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.URSHIFU); + game.override.starterSpecies(Species.URSHIFU); game.override.enemySpecies(Species.SNORLAX); game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/achievements/achievement.test.ts b/src/test/achievements/achievement.test.ts index b59d6ef1e89..438e59f1263 100644 --- a/src/test/achievements/achievement.test.ts +++ b/src/test/achievements/achievement.test.ts @@ -103,10 +103,10 @@ describe("RibbonAchv", () => { }); beforeEach(() => { - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(0); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(0); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([]); game = new GameManager(phaserGame); + game.override.starterSpecies(0); game.override.enemyMoveset([]); game.override.enemySpecies(0); game.override.startingWave(0); diff --git a/src/test/battle/battle.test.ts b/src/test/battle/battle.test.ts index 7c77cd9eaf3..7708e2a8fa9 100644 --- a/src/test/battle/battle.test.ts +++ b/src/test/battle/battle.test.ts @@ -90,7 +90,7 @@ describe("Test Battle Phase", () => { }, 20000); it("do attack wave 3 - single battle - regular - OHKO", async() => { - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); + game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override @@ -111,7 +111,7 @@ describe("Test Battle Phase", () => { }, 20000); it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async() => { - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); + game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); game.override.startingWave(3); @@ -262,7 +262,7 @@ describe("Test Battle Phase", () => { it("kill opponent pokemon", async() => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); + game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); @@ -291,7 +291,7 @@ describe("Test Battle Phase", () => { it("to next turn", async() => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); + game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); @@ -309,7 +309,7 @@ describe("Test Battle Phase", () => { it("to next wave with pokemon killed, single", async() => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); + game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); diff --git a/src/test/battle/error-handling.test.ts b/src/test/battle/error-handling.test.ts index 2c43edcfbc5..2e846730329 100644 --- a/src/test/battle/error-handling.test.ts +++ b/src/test/battle/error-handling.test.ts @@ -26,7 +26,7 @@ describe("Test Battle Phase", () => { game.override .battleType("single") .startingWave(3); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); + game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index ca58d098b35..3549e34a7ed 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -38,7 +38,7 @@ describe("Moves - Dragon Rage", () => { game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.starterSpecies(Species.SNORLAX); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_RAGE]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index b58ae553ebe..cf0d6677952 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -33,7 +33,7 @@ describe("Moves - Fissure", () => { game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); + game.override.starterSpecies(Species.SNORLAX); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FISSURE]); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/follow_me.test.ts b/src/test/moves/follow_me.test.ts index 1e29805b760..ec556c5dd56 100644 --- a/src/test/moves/follow_me.test.ts +++ b/src/test/moves/follow_me.test.ts @@ -33,7 +33,7 @@ describe("Moves - Follow Me", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); + game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index d2decd5e35b..a16a7ae0eec 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -31,7 +31,7 @@ describe("Moves - Glaive Rush", () => { game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(Array(4).fill(Moves.GLAIVE_RUSH)); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.KLINK); + game.override.starterSpecies(Species.KLINK); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FUR_COAT); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SHADOW_SNEAK, Moves.AVALANCHE, Moves.SPLASH, Moves.GLAIVE_RUSH]); @@ -111,7 +111,7 @@ describe("Moves - Glaive Rush", () => { it("secondary effects are removed upon switching", async() => { game.override.enemyMoveset(Array(4).fill(Moves.SHADOW_SNEAK)); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(0); + game.override.starterSpecies(0); await game.startBattle([Species.KLINK, Species.FEEBAS]); const player = game.scene.getPlayerPokemon(); const enemy = game.scene.getEnemyPokemon(); diff --git a/src/test/moves/magnet_rise.test.ts b/src/test/moves/magnet_rise.test.ts index 9543ee7c91b..a321499d11f 100644 --- a/src/test/moves/magnet_rise.test.ts +++ b/src/test/moves/magnet_rise.test.ts @@ -24,7 +24,7 @@ describe("Moves - Magnet Rise", () => { game = new GameManager(phaserGame); const moveToUse = Moves.MAGNET_RISE; game.override.battleType("single"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGNEZONE); + game.override.starterSpecies(Species.MAGNEZONE); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/moves/purify.test.ts b/src/test/moves/purify.test.ts index 05b3272521b..81db23a1576 100644 --- a/src/test/moves/purify.test.ts +++ b/src/test/moves/purify.test.ts @@ -31,7 +31,7 @@ describe("Moves - Purify", () => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.PYUKUMUKU); + game.override.starterSpecies(Species.PYUKUMUKU); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PURIFY, Moves.SIZZLY_SLIDE]); diff --git a/src/test/moves/rage_powder.test.ts b/src/test/moves/rage_powder.test.ts index 514b2e7f4b4..c0166619e07 100644 --- a/src/test/moves/rage_powder.test.ts +++ b/src/test/moves/rage_powder.test.ts @@ -32,7 +32,7 @@ describe("Moves - Rage Powder", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); + game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index d3c80dcfc69..da9c8f079f9 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -28,7 +28,7 @@ describe("Moves - Rollout", () => { game = new GameManager(phaserGame); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.battleType("single"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); + game.override.starterSpecies(Species.RATTATA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); game.override.enemySpecies(Species.BIDOOF); game.override.enemyAbility(Abilities.NONE); diff --git a/src/test/moves/spotlight.test.ts b/src/test/moves/spotlight.test.ts index 4a61f28091e..e9a6d9f5210 100644 --- a/src/test/moves/spotlight.test.ts +++ b/src/test/moves/spotlight.test.ts @@ -32,7 +32,7 @@ describe("Moves - Spotlight", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); + game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/moves/tidy_up.test.ts b/src/test/moves/tidy_up.test.ts index d51f98e7974..aed2b14f8ff 100644 --- a/src/test/moves/tidy_up.test.ts +++ b/src/test/moves/tidy_up.test.ts @@ -32,7 +32,7 @@ describe("Moves - Tidy Up", () => { game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(SPLASH_ONLY); - vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.FEEBAS); + game.override.starterSpecies(Species.FEEBAS); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TIDY_UP]); vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(50); From b16a28d5b8df5fe720e197cdd9a72824207da0a4 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:26:21 -0700 Subject: [PATCH 17/42] add OverridesHelper.startingLevel() --- src/test/utils/overridesHelper.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index c9627f38c0b..bcb550945a6 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -41,6 +41,17 @@ export class OverridesHelper { return this; } + /** + * Override the player (pokemon) starting level + * @param level the (pokemon) level to set + * @returns this + */ + startingLevel(level: Species | number): this { + vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(level); + this.log(`Player Pokemon starting level set to ${level}!`); + return this; + } + /** * Override the player (pokemon) {@linkcode Species | species} * @param species the (pokemon) {@linkcode Species | species} to set From 5924e5c1b45900607ccd8c157098fc6064d5c34e Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:29:19 -0700 Subject: [PATCH 18/42] apply game.override.startingLevel --- src/test/abilities/disguise.test.ts | 2 +- src/test/abilities/ice_face.test.ts | 2 +- src/test/abilities/libero.test.ts | 2 +- src/test/abilities/moxie.test.ts | 2 +- src/test/abilities/parental_bond.test.ts | 2 +- src/test/abilities/protean.test.ts | 2 +- src/test/abilities/sand_veil.test.ts | 2 +- src/test/abilities/serene_grace.test.ts | 2 +- src/test/abilities/sheer_force.test.ts | 2 +- src/test/abilities/shield_dust.test.ts | 2 +- src/test/abilities/sturdy.test.ts | 2 +- src/test/abilities/unseen_fist.test.ts | 2 +- src/test/abilities/zen_mode.test.ts | 2 +- src/test/achievements/achievement.test.ts | 2 +- src/test/arena/arena_gravity.test.ts | 2 +- src/test/arena/weather_strong_winds.test.ts | 2 +- src/test/battle/battle.test.ts | 10 +++++----- src/test/battle/error-handling.test.ts | 2 +- src/test/battle/special_battle.test.ts | 2 +- src/test/evolution.test.ts | 13 ++++++------- src/test/items/grip_claw.test.ts | 2 +- src/test/items/toxic_orb.test.ts | 2 +- src/test/moves/astonish.test.ts | 2 +- src/test/moves/ceaseless_edge.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 2 +- src/test/moves/dynamax_cannon.test.ts | 2 +- src/test/moves/fissure.test.ts | 2 +- src/test/moves/follow_me.test.ts | 2 +- src/test/moves/gastro_acid.test.ts | 2 +- src/test/moves/growth.test.ts | 2 +- src/test/moves/make_it_rain.test.ts | 2 +- src/test/moves/multi_target.test.ts | 2 +- src/test/moves/octolock.test.ts | 2 +- src/test/moves/purify.test.ts | 2 +- src/test/moves/rage_powder.test.ts | 2 +- src/test/moves/rollout.test.ts | 2 +- src/test/moves/roost.test.ts | 2 +- src/test/moves/spikes.test.ts | 2 +- src/test/moves/spotlight.test.ts | 2 +- src/test/moves/tackle.test.ts | 2 +- src/test/moves/tail_whip.test.ts | 2 +- src/test/moves/thousand_arrows.test.ts | 2 +- src/test/moves/tidy_up.test.ts | 2 +- src/test/ui/transfer-item.test.ts | 2 +- 44 files changed, 53 insertions(+), 54 deletions(-) diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index 258056f56d2..04071e20538 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -72,7 +72,7 @@ describe("Abilities - DISGUISE", () => { bustedForm = 1; game.override.enemyMoveset([Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE]); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(20); + game.override.startingLevel(20); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(20); game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index 4ffc6fd848c..a5a2ff1f1ad 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -203,7 +203,7 @@ describe("Abilities - Ice Face", () => { it("reverts to Ice Face on arena reset", async () => { game.override.startingWave(4); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(4); + game.override.startingLevel(4); game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ [Species.EISCUE]: noiceForm, diff --git a/src/test/abilities/libero.test.ts b/src/test/abilities/libero.test.ts index ea7fe46bbfc..c7866f1ca3c 100644 --- a/src/test/abilities/libero.test.ts +++ b/src/test/abilities/libero.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Protean", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LIBERO); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); }); diff --git a/src/test/abilities/moxie.test.ts b/src/test/abilities/moxie.test.ts index daebf08e0b7..038657475f7 100644 --- a/src/test/abilities/moxie.test.ts +++ b/src/test/abilities/moxie.test.ts @@ -38,7 +38,7 @@ describe("Abilities - Moxie", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.MOXIE); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index 55c1b5dc6fe..7f96403e81c 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -37,7 +37,7 @@ describe("Abilities - Parental Bond", () => { game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset(SPLASH_ONLY); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); }); diff --git a/src/test/abilities/protean.test.ts b/src/test/abilities/protean.test.ts index c852b9b0f14..d6afd665930 100644 --- a/src/test/abilities/protean.test.ts +++ b/src/test/abilities/protean.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Protean", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PROTEAN); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); }); diff --git a/src/test/abilities/sand_veil.test.ts b/src/test/abilities/sand_veil.test.ts index ddf9123d35b..e87398e05c2 100644 --- a/src/test/abilities/sand_veil.test.ts +++ b/src/test/abilities/sand_veil.test.ts @@ -33,7 +33,7 @@ describe("Abilities - Sand Veil", () => { game.override.enemySpecies(Species.MEOWSCARADA); game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override .weather(WeatherType.SANDSTORM) diff --git a/src/test/abilities/serene_grace.test.ts b/src/test/abilities/serene_grace.test.ts index 1515feecdca..77a5629a7c5 100644 --- a/src/test/abilities/serene_grace.test.ts +++ b/src/test/abilities/serene_grace.test.ts @@ -36,7 +36,7 @@ describe("Abilities - Serene Grace", () => { const movesToUse = [Moves.AIR_SLASH, Moves.TACKLE]; game.override.battleType("single"); game.override.enemySpecies(Species.ONIX); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/abilities/sheer_force.test.ts b/src/test/abilities/sheer_force.test.ts index d4665215e00..815f9bbf37c 100644 --- a/src/test/abilities/sheer_force.test.ts +++ b/src/test/abilities/sheer_force.test.ts @@ -36,7 +36,7 @@ describe("Abilities - Sheer Force", () => { const movesToUse = [Moves.AIR_SLASH, Moves.BIND, Moves.CRUSH_CLAW, Moves.TACKLE]; game.override.battleType("single"); game.override.enemySpecies(Species.ONIX); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/abilities/shield_dust.test.ts b/src/test/abilities/shield_dust.test.ts index edf9555d8b6..a9d5dbe3209 100644 --- a/src/test/abilities/shield_dust.test.ts +++ b/src/test/abilities/shield_dust.test.ts @@ -37,7 +37,7 @@ describe("Abilities - Shield Dust", () => { game.override.battleType("single"); game.override.enemySpecies(Species.ONIX); game.override.enemyAbility(Abilities.SHIELD_DUST); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/abilities/sturdy.test.ts b/src/test/abilities/sturdy.test.ts index b6ea7660a73..18bf7d0e36a 100644 --- a/src/test/abilities/sturdy.test.ts +++ b/src/test/abilities/sturdy.test.ts @@ -33,7 +33,7 @@ describe("Abilities - Sturdy", () => { game.override.battleType("single"); game.override.starterSpecies(Species.LUCARIO); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.CLOSE_COMBAT, Moves.FISSURE]); game.override.enemySpecies(Species.ARON); diff --git a/src/test/abilities/unseen_fist.test.ts b/src/test/abilities/unseen_fist.test.ts index 53f457f65c2..f955f7c4ed4 100644 --- a/src/test/abilities/unseen_fist.test.ts +++ b/src/test/abilities/unseen_fist.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Unseen Fist", () => { game.override.starterSpecies(Species.URSHIFU); game.override.enemySpecies(Species.SNORLAX); game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); }); diff --git a/src/test/abilities/zen_mode.test.ts b/src/test/abilities/zen_mode.test.ts index 40e43d3130d..d7eab759de1 100644 --- a/src/test/abilities/zen_mode.test.ts +++ b/src/test/abilities/zen_mode.test.ts @@ -47,7 +47,7 @@ describe("Abilities - ZEN MODE", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/achievements/achievement.test.ts b/src/test/achievements/achievement.test.ts index 438e59f1263..57c18c43708 100644 --- a/src/test/achievements/achievement.test.ts +++ b/src/test/achievements/achievement.test.ts @@ -103,9 +103,9 @@ describe("RibbonAchv", () => { }); beforeEach(() => { - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(0); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([]); game = new GameManager(phaserGame); + game.override.startingLevel(0); game.override.starterSpecies(0); game.override.enemyMoveset([]); game.override.enemySpecies(0); diff --git a/src/test/arena/arena_gravity.test.ts b/src/test/arena/arena_gravity.test.ts index 3ce1507eae7..8e171388b06 100644 --- a/src/test/arena/arena_gravity.test.ts +++ b/src/test/arena/arena_gravity.test.ts @@ -58,7 +58,7 @@ describe("Arena - Gravity", () => { }); it("OHKO move accuracy is not affected", async () => { - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); + game.override.startingLevel(5); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); /** See Fissure {@link https://bulbapedia.bulbagarden.net/wiki/Fissure_(move)} */ diff --git a/src/test/arena/weather_strong_winds.test.ts b/src/test/arena/weather_strong_winds.test.ts index f25be43c426..cc85d7a0866 100644 --- a/src/test/arena/weather_strong_winds.test.ts +++ b/src/test/arena/weather_strong_winds.test.ts @@ -28,7 +28,7 @@ describe("Weather - Strong Winds", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10); + game.override.startingLevel(10); game.override.enemySpecies(Species.TAILLOW); game.override.enemyAbility(Abilities.DELTA_STREAM); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.THUNDERBOLT, Moves.ICE_BEAM, Moves.ROCK_SLIDE]); diff --git a/src/test/battle/battle.test.ts b/src/test/battle/battle.test.ts index 7708e2a8fa9..130e2c338f2 100644 --- a/src/test/battle/battle.test.ts +++ b/src/test/battle/battle.test.ts @@ -92,7 +92,7 @@ describe("Test Battle Phase", () => { it("do attack wave 3 - single battle - regular - OHKO", async() => { game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); game.override .startingWave(3) .battleType("single"); @@ -113,7 +113,7 @@ describe("Test Battle Phase", () => { it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async() => { game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); + game.override.startingLevel(5); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); @@ -266,7 +266,7 @@ describe("Test Battle Phase", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); @@ -295,7 +295,7 @@ describe("Test Battle Phase", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); @@ -313,7 +313,7 @@ describe("Test Battle Phase", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/battle/error-handling.test.ts b/src/test/battle/error-handling.test.ts index 2e846730329..4af376117f2 100644 --- a/src/test/battle/error-handling.test.ts +++ b/src/test/battle/error-handling.test.ts @@ -30,7 +30,7 @@ describe("Test Battle Phase", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/battle/special_battle.test.ts b/src/test/battle/special_battle.test.ts index 5ebbb010d2f..28b59cd86b7 100644 --- a/src/test/battle/special_battle.test.ts +++ b/src/test/battle/special_battle.test.ts @@ -27,7 +27,7 @@ describe("Test Battle Phase", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); diff --git a/src/test/evolution.test.ts b/src/test/evolution.test.ts index f2cf1023457..70682666f32 100644 --- a/src/test/evolution.test.ts +++ b/src/test/evolution.test.ts @@ -1,10 +1,9 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import { Species } from "#app/enums/species.js"; -import { Abilities } from "#app/enums/abilities.js"; -import Overrides from "#app/overrides"; import { pokemonEvolutions } from "#app/data/pokemon-evolutions.js"; +import { Abilities } from "#app/enums/abilities.js"; +import { Species } from "#app/enums/species.js"; +import GameManager from "#app/test/utils/gameManager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Evolution", () => { let phaserGame: Phaser.Game; @@ -29,7 +28,7 @@ describe("Evolution", () => { game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(60); + game.override.startingLevel(60); }); it("should keep hidden ability after evolving", async () => { diff --git a/src/test/items/grip_claw.test.ts b/src/test/items/grip_claw.test.ts index 611d63195fc..6f975c242f7 100644 --- a/src/test/items/grip_claw.test.ts +++ b/src/test/items/grip_claw.test.ts @@ -40,7 +40,7 @@ describe("Items - Grip Claw", () => { {name: "BERRY", type: BerryType.SITRUS, count: 2}, {name: "BERRY", type: BerryType.LUM, count: 2} ]); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(allMoves[Moves.POPULATION_BOMB], "accuracy", "get").mockReturnValue(100); diff --git a/src/test/items/toxic_orb.test.ts b/src/test/items/toxic_orb.test.ts index 0bd58a0cd74..67d121f8855 100644 --- a/src/test/items/toxic_orb.test.ts +++ b/src/test/items/toxic_orb.test.ts @@ -40,7 +40,7 @@ describe("Items - Toxic orb", () => { game.override.enemySpecies(Species.RATTATA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); game.override.enemyAbility(Abilities.INSOMNIA); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([oppMoveToUse, oppMoveToUse, oppMoveToUse, oppMoveToUse]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ diff --git a/src/test/moves/astonish.test.ts b/src/test/moves/astonish.test.ts index 16fe3013b22..ac5ef3fde76 100644 --- a/src/test/moves/astonish.test.ts +++ b/src/test/moves/astonish.test.ts @@ -33,7 +33,7 @@ describe("Moves - Astonish", () => { game.override.enemySpecies(Species.BLASTOISE); game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(allMoves[Moves.ASTONISH], "chance", "get").mockReturnValue(100); diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index 4d8fc6c79c5..dafa1be3049 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -36,7 +36,7 @@ describe("Moves - Ceaseless Edge", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.RUN_AWAY); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.CEASELESS_EDGE, Moves.SPLASH, Moves.ROAR ]); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index 3549e34a7ed..f6b24510db0 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -42,7 +42,7 @@ describe("Moves - Dragon Rage", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_RAGE]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); game.override.enemySpecies(Species.SNORLAX); game.override.enemyMoveset(SPLASH_ONLY); diff --git a/src/test/moves/dynamax_cannon.test.ts b/src/test/moves/dynamax_cannon.test.ts index 96ffb461ea2..88251b74115 100644 --- a/src/test/moves/dynamax_cannon.test.ts +++ b/src/test/moves/dynamax_cannon.test.ts @@ -29,7 +29,7 @@ describe("Moves - Dynamax Cannon", () => { game = new GameManager(phaserGame); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ dynamaxCannon.id ]); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(200); + game.override.startingLevel(200); // Note that, for Waves 1-10, the level cap is 10 game.override.startingWave(1); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index cf0d6677952..fc91c3aa80d 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -36,7 +36,7 @@ describe("Moves - Fissure", () => { game.override.starterSpecies(Species.SNORLAX); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FISSURE]); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); game.override.enemySpecies(Species.SNORLAX); game.override.enemyMoveset(SPLASH_ONLY); diff --git a/src/test/moves/follow_me.test.ts b/src/test/moves/follow_me.test.ts index ec556c5dd56..44bede6ee76 100644 --- a/src/test/moves/follow_me.test.ts +++ b/src/test/moves/follow_me.test.ts @@ -35,7 +35,7 @@ describe("Moves - Follow Me", () => { game.override.battleType("double"); game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/moves/gastro_acid.test.ts b/src/test/moves/gastro_acid.test.ts index d8288b46790..901904538c4 100644 --- a/src/test/moves/gastro_acid.test.ts +++ b/src/test/moves/gastro_acid.test.ts @@ -31,7 +31,7 @@ describe("Moves - Gastro Acid", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1); + game.override.startingLevel(1); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER]); diff --git a/src/test/moves/growth.test.ts b/src/test/moves/growth.test.ts index f2324c94f88..2a3b863c0f1 100644 --- a/src/test/moves/growth.test.ts +++ b/src/test/moves/growth.test.ts @@ -38,7 +38,7 @@ describe("Moves - Growth", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.MOXIE); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/moves/make_it_rain.test.ts b/src/test/moves/make_it_rain.test.ts index 1359c947c51..ca207a63c3f 100644 --- a/src/test/moves/make_it_rain.test.ts +++ b/src/test/moves/make_it_rain.test.ts @@ -37,7 +37,7 @@ describe("Moves - Make It Rain", () => { game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset(SPLASH_ONLY); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); }); diff --git a/src/test/moves/multi_target.test.ts b/src/test/moves/multi_target.test.ts index 7db6e7ec5f9..1627109559c 100644 --- a/src/test/moves/multi_target.test.ts +++ b/src/test/moves/multi_target.test.ts @@ -170,7 +170,7 @@ function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(50); + game.override.startingLevel(50); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(40); game.override.enemySpecies(Species.EEVEE); return game; diff --git a/src/test/moves/octolock.test.ts b/src/test/moves/octolock.test.ts index a8578153a42..6884aeabc2e 100644 --- a/src/test/moves/octolock.test.ts +++ b/src/test/moves/octolock.test.ts @@ -35,7 +35,7 @@ describe("Moves - Octolock", () => { game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.NONE); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.OCTOLOCK, Moves.SPLASH]); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); }); diff --git a/src/test/moves/purify.test.ts b/src/test/moves/purify.test.ts index 81db23a1576..0a5419f7288 100644 --- a/src/test/moves/purify.test.ts +++ b/src/test/moves/purify.test.ts @@ -32,7 +32,7 @@ describe("Moves - Purify", () => { game.override.battleType("single"); game.override.starterSpecies(Species.PYUKUMUKU); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(10); + game.override.startingLevel(10); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PURIFY, Moves.SIZZLY_SLIDE]); game.override.enemySpecies(Species.MAGIKARP); diff --git a/src/test/moves/rage_powder.test.ts b/src/test/moves/rage_powder.test.ts index c0166619e07..bd28a65db33 100644 --- a/src/test/moves/rage_powder.test.ts +++ b/src/test/moves/rage_powder.test.ts @@ -34,7 +34,7 @@ describe("Moves - Rage Powder", () => { game.override.battleType("double"); game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index da9c8f079f9..c3da6b9c79d 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -32,7 +32,7 @@ describe("Moves - Rollout", () => { vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); game.override.enemySpecies(Species.BIDOOF); game.override.enemyAbility(Abilities.NONE); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/moves/roost.test.ts b/src/test/moves/roost.test.ts index 47c0bcc6156..e29056ff443 100644 --- a/src/test/moves/roost.test.ts +++ b/src/test/moves/roost.test.ts @@ -30,7 +30,7 @@ describe("Moves - Roost", () => { game.override.battleType("single"); game.override.enemySpecies(Species.STARAPTOR); game.override.enemyAbility(Abilities.INSOMNIA); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.STOMPING_TANTRUM ]); game.override.enemyMoveset([Moves.ROOST,Moves.ROOST,Moves.ROOST,Moves.ROOST]); diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index a66bcd28e1e..b1104d7d7be 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -105,7 +105,7 @@ describe("Moves - Spikes", () => { it("trainer - wild - force switch by himself opponent - should take damage", async() => { game.override.startingWave(5); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5000); + game.override.startingLevel(5000); game.override.enemySpecies(0); // turn 1: player set spikes, opponent do splash // turn 2: player do splash, opponent switch pokemon diff --git a/src/test/moves/spotlight.test.ts b/src/test/moves/spotlight.test.ts index e9a6d9f5210..5790214ceb1 100644 --- a/src/test/moves/spotlight.test.ts +++ b/src/test/moves/spotlight.test.ts @@ -34,7 +34,7 @@ describe("Moves - Spotlight", () => { game.override.battleType("double"); game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/moves/tackle.test.ts b/src/test/moves/tackle.test.ts index 877651d9089..7f58aa8e23b 100644 --- a/src/test/moves/tackle.test.ts +++ b/src/test/moves/tackle.test.ts @@ -33,7 +33,7 @@ describe("Moves - Tackle", () => { const moveToUse = Moves.TACKLE; game.override.battleType("single"); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1); + game.override.startingLevel(1); game.override.startingWave(97); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.GROWTH,Moves.GROWTH,Moves.GROWTH,Moves.GROWTH]); diff --git a/src/test/moves/tail_whip.test.ts b/src/test/moves/tail_whip.test.ts index 5c9394dcabb..7bac64d282f 100644 --- a/src/test/moves/tail_whip.test.ts +++ b/src/test/moves/tail_whip.test.ts @@ -37,7 +37,7 @@ describe("Moves - Tail whip", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.INSOMNIA); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/moves/thousand_arrows.test.ts b/src/test/moves/thousand_arrows.test.ts index 301bb89391d..e0121c6ece2 100644 --- a/src/test/moves/thousand_arrows.test.ts +++ b/src/test/moves/thousand_arrows.test.ts @@ -32,7 +32,7 @@ describe("Moves - Thousand Arrows", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.enemySpecies(Species.TOGETIC); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.THOUSAND_ARROWS ]); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); diff --git a/src/test/moves/tidy_up.test.ts b/src/test/moves/tidy_up.test.ts index aed2b14f8ff..ece454c2988 100644 --- a/src/test/moves/tidy_up.test.ts +++ b/src/test/moves/tidy_up.test.ts @@ -35,7 +35,7 @@ describe("Moves - Tidy Up", () => { game.override.starterSpecies(Species.FEEBAS); vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TIDY_UP]); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(50); + game.override.startingLevel(50); }); it("spikes are cleared", async() => { diff --git a/src/test/ui/transfer-item.test.ts b/src/test/ui/transfer-item.test.ts index 06898a9182d..9007b1dabe2 100644 --- a/src/test/ui/transfer-item.test.ts +++ b/src/test/ui/transfer-item.test.ts @@ -34,7 +34,7 @@ describe("UI - Transfer Items", () => { beforeEach(async () => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); game.override.startingWave(1); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([ { name: "BERRY", count: 1, type: BerryType.SITRUS }, From 7732411c92ee4af5c9fb1746c63f2091e8728b70 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:31:16 -0700 Subject: [PATCH 19/42] add OverridesHelper.ability() --- src/test/utils/overridesHelper.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index bcb550945a6..a888e257c44 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -63,6 +63,17 @@ export class OverridesHelper { return this; } + /** + * Override the player (pokemon) {@linkcode Abilities | ability} + * @param ability the (pokemon) {@linkcode Abilities | ability} to set + * @returns this + */ + ability(ability: Abilities): this { + vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); + this.log(`Player Pokemon ability set to ${Abilities[ability]} (=${ability})!`); + return this; + } + /** * Override each wave to have or not have standard trainer battles * @returns this From c7a3ae24ac5397aca97e01d23ed19cef81009591 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:35:20 -0700 Subject: [PATCH 20/42] apply game.override.ability --- src/test/abilities/ability_timing.test.ts | 2 +- src/test/abilities/aura_break.test.ts | 4 ++-- src/test/abilities/battle_bond.test.ts | 2 +- src/test/abilities/costar.test.ts | 2 +- src/test/abilities/disguise.test.ts | 2 +- src/test/abilities/dry_skin.test.ts | 2 +- src/test/abilities/ice_face.test.ts | 2 +- src/test/abilities/intimidate.test.ts | 2 +- src/test/abilities/intrepid_sword.test.ts | 15 +++++++-------- src/test/abilities/libero.test.ts | 2 +- src/test/abilities/moxie.test.ts | 2 +- src/test/abilities/parental_bond.test.ts | 2 +- src/test/abilities/power_construct.test.ts | 2 +- src/test/abilities/protean.test.ts | 2 +- src/test/abilities/quick_draw.test.ts | 2 +- src/test/abilities/sap_sipper.test.ts | 2 +- src/test/abilities/schooling.test.ts | 2 +- src/test/abilities/screen_cleaner.test.ts | 2 +- src/test/abilities/serene_grace.test.ts | 2 +- src/test/abilities/sheer_force.test.ts | 8 ++++---- src/test/abilities/shields_down.test.ts | 2 +- src/test/abilities/sturdy.test.ts | 2 +- src/test/abilities/volt_absorb.test.ts | 2 +- src/test/abilities/wind_power.test.ts | 4 ++-- src/test/abilities/wind_rider.test.ts | 4 ++-- src/test/abilities/wonder_skin.test.ts | 4 ++-- src/test/abilities/zen_mode.test.ts | 2 +- src/test/abilities/zero_to_hero.test.ts | 2 +- src/test/arena/arena_gravity.test.ts | 2 +- src/test/arena/weather_fog.test.ts | 2 +- src/test/battle/battle-order.test.ts | 2 +- src/test/battle/battle.test.ts | 14 +++++++------- src/test/battle/error-handling.test.ts | 2 +- src/test/battle/special_battle.test.ts | 2 +- src/test/items/exp_booster.test.ts | 2 +- src/test/items/grip_claw.test.ts | 2 +- src/test/items/toxic_orb.test.ts | 2 +- src/test/moves/aurora_veil.test.ts | 2 +- src/test/moves/double_team.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 2 +- src/test/moves/fissure.test.ts | 2 +- src/test/moves/flower_shield.test.ts | 2 +- src/test/moves/follow_me.test.ts | 2 +- src/test/moves/gastro_acid.test.ts | 2 +- src/test/moves/glaive_rush.test.ts | 2 +- src/test/moves/growth.test.ts | 2 +- src/test/moves/hard_press.test.ts | 2 +- src/test/moves/light_screen.test.ts | 2 +- src/test/moves/multi_target.test.ts | 2 +- src/test/moves/octolock.test.ts | 2 +- src/test/moves/rage_powder.test.ts | 2 +- src/test/moves/reflect.test.ts | 2 +- src/test/moves/rollout.test.ts | 2 +- src/test/moves/spikes.test.ts | 2 +- src/test/moves/tail_whip.test.ts | 2 +- src/test/moves/tidy_up.test.ts | 2 +- 56 files changed, 75 insertions(+), 76 deletions(-) diff --git a/src/test/abilities/ability_timing.test.ts b/src/test/abilities/ability_timing.test.ts index fb075594677..b3f6c37b15c 100644 --- a/src/test/abilities/ability_timing.test.ts +++ b/src/test/abilities/ability_timing.test.ts @@ -33,7 +33,7 @@ describe("Ability Timing", () => { game.override.enemyAbility(Abilities.INTIMIDATE); game.override.enemyMoveset(SPLASH_ONLY); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.ICE_BEAM]); }); diff --git a/src/test/abilities/aura_break.test.ts b/src/test/abilities/aura_break.test.ts index ab4aa462bb4..20c15f679e8 100644 --- a/src/test/abilities/aura_break.test.ts +++ b/src/test/abilities/aura_break.test.ts @@ -39,7 +39,7 @@ describe("Abilities - Aura Break", () => { const moveToCheck = allMoves[Moves.MOONBLAST]; const basePower = moveToCheck.power; - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FAIRY_AURA); + game.override.ability(Abilities.FAIRY_AURA); vi.spyOn(moveToCheck, "calculateBattlePower"); await game.startBattle([Species.PIKACHU]); @@ -53,7 +53,7 @@ describe("Abilities - Aura Break", () => { const moveToCheck = allMoves[Moves.DARK_PULSE]; const basePower = moveToCheck.power; - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DARK_AURA); + game.override.ability(Abilities.DARK_AURA); vi.spyOn(moveToCheck, "calculateBattlePower"); await game.startBattle([Species.PIKACHU]); diff --git a/src/test/abilities/battle_bond.test.ts b/src/test/abilities/battle_bond.test.ts index 4dad547f8c4..094bdc9dd53 100644 --- a/src/test/abilities/battle_bond.test.ts +++ b/src/test/abilities/battle_bond.test.ts @@ -29,7 +29,7 @@ describe("Abilities - BATTLE BOND", () => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BATTLE_BOND); + game.override.ability(Abilities.BATTLE_BOND); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/costar.test.ts b/src/test/abilities/costar.test.ts index 63f4e634800..566f982fc08 100644 --- a/src/test/abilities/costar.test.ts +++ b/src/test/abilities/costar.test.ts @@ -29,7 +29,7 @@ describe("Abilities - COSTAR", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.COSTAR); + game.override.ability(Abilities.COSTAR); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NASTY_PLOT]); game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index 04071e20538..fd486f89c69 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -29,7 +29,7 @@ describe("Abilities - DISGUISE", () => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DISGUISE); + game.override.ability(Abilities.DISGUISE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/dry_skin.test.ts b/src/test/abilities/dry_skin.test.ts index dfe358d6628..9cb92710285 100644 --- a/src/test/abilities/dry_skin.test.ts +++ b/src/test/abilities/dry_skin.test.ts @@ -30,7 +30,7 @@ describe("Abilities - Dry Skin", () => { game.override.enemyAbility(Abilities.DRY_SKIN); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemySpecies(Species.CHARMANDER); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); + game.override.ability(Abilities.UNNERVE); game.override.starterSpecies(Species.CHANDELURE); }); diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index a5a2ff1f1ad..c0f91e8dff8 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -259,7 +259,7 @@ describe("Abilities - Ice Face", () => { }); it("cannot be copied", async () => { - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.TRACE); + game.override.ability(Abilities.TRACE); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/intimidate.test.ts b/src/test/abilities/intimidate.test.ts index 28ed00e30a5..5bba42bd6d8 100644 --- a/src/test/abilities/intimidate.test.ts +++ b/src/test/abilities/intimidate.test.ts @@ -33,7 +33,7 @@ describe("Abilities - Intimidate", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.INTIMIDATE); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); + game.override.ability(Abilities.INTIMIDATE); game.override.startingWave(3); game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); }); diff --git a/src/test/abilities/intrepid_sword.test.ts b/src/test/abilities/intrepid_sword.test.ts index fa988fcab39..5292bcd7c82 100644 --- a/src/test/abilities/intrepid_sword.test.ts +++ b/src/test/abilities/intrepid_sword.test.ts @@ -1,13 +1,12 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import {Abilities} from "#enums/abilities"; -import {Species} from "#enums/species"; +import { BattleStat } from "#app/data/battle-stat"; import { CommandPhase, } from "#app/phases"; -import {BattleStat} from "#app/data/battle-stat"; +import GameManager from "#app/test/utils/gameManager"; +import { Abilities } from "#enums/abilities"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Abilities - Intrepid Sword", () => { @@ -29,7 +28,7 @@ describe("Abilities - Intrepid Sword", () => { game.override.battleType("single"); game.override.enemySpecies(Species.ZACIAN); game.override.enemyAbility(Abilities.INTREPID_SWORD); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTREPID_SWORD); + game.override.ability(Abilities.INTREPID_SWORD); }); it("INTREPID SWORD on player", async() => { diff --git a/src/test/abilities/libero.test.ts b/src/test/abilities/libero.test.ts index c7866f1ca3c..ce65614d0aa 100644 --- a/src/test/abilities/libero.test.ts +++ b/src/test/abilities/libero.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Protean", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LIBERO); + game.override.ability(Abilities.LIBERO); game.override.startingLevel(100); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); diff --git a/src/test/abilities/moxie.test.ts b/src/test/abilities/moxie.test.ts index 038657475f7..0ad48bbaad9 100644 --- a/src/test/abilities/moxie.test.ts +++ b/src/test/abilities/moxie.test.ts @@ -37,7 +37,7 @@ describe("Abilities - Moxie", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.MOXIE); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOXIE); + game.override.ability(Abilities.MOXIE); game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index 7f96403e81c..c6de23432e6 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -33,7 +33,7 @@ describe("Abilities - Parental Bond", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PARENTAL_BOND); + game.override.ability(Abilities.PARENTAL_BOND); game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset(SPLASH_ONLY); diff --git a/src/test/abilities/power_construct.test.ts b/src/test/abilities/power_construct.test.ts index 6c775fdec1d..803be7e8147 100644 --- a/src/test/abilities/power_construct.test.ts +++ b/src/test/abilities/power_construct.test.ts @@ -29,7 +29,7 @@ describe("Abilities - POWER CONSTRUCT", () => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.POWER_CONSTRUCT); + game.override.ability(Abilities.POWER_CONSTRUCT); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/protean.test.ts b/src/test/abilities/protean.test.ts index d6afd665930..4889bc99b5c 100644 --- a/src/test/abilities/protean.test.ts +++ b/src/test/abilities/protean.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Protean", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PROTEAN); + game.override.ability(Abilities.PROTEAN); game.override.startingLevel(100); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]); diff --git a/src/test/abilities/quick_draw.test.ts b/src/test/abilities/quick_draw.test.ts index 44e5b12e21b..f94a8c55a6c 100644 --- a/src/test/abilities/quick_draw.test.ts +++ b/src/test/abilities/quick_draw.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Quick Draw", () => { game.override.battleType("single"); game.override.starterSpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.QUICK_DRAW); + game.override.ability(Abilities.QUICK_DRAW); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TAIL_WHIP]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); diff --git a/src/test/abilities/sap_sipper.test.ts b/src/test/abilities/sap_sipper.test.ts index 970d830bf6d..4ffab7792d1 100644 --- a/src/test/abilities/sap_sipper.test.ts +++ b/src/test/abilities/sap_sipper.test.ts @@ -120,7 +120,7 @@ describe("Abilities - Sap Sipper", () => { const ability = Abilities.SAP_SIPPER; vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); + game.override.ability(ability); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.NONE); diff --git a/src/test/abilities/schooling.test.ts b/src/test/abilities/schooling.test.ts index 0e341687f80..f3e95d987f2 100644 --- a/src/test/abilities/schooling.test.ts +++ b/src/test/abilities/schooling.test.ts @@ -29,7 +29,7 @@ describe("Abilities - SCHOOLING", () => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SCHOOLING); + game.override.ability(Abilities.SCHOOLING); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/screen_cleaner.test.ts b/src/test/abilities/screen_cleaner.test.ts index 22114b737a9..04fc2e47f14 100644 --- a/src/test/abilities/screen_cleaner.test.ts +++ b/src/test/abilities/screen_cleaner.test.ts @@ -26,7 +26,7 @@ describe("Abilities - Screen Cleaner", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SCREEN_CLEANER); + game.override.ability(Abilities.SCREEN_CLEANER); game.override.enemySpecies(Species.SHUCKLE); }); diff --git a/src/test/abilities/serene_grace.test.ts b/src/test/abilities/serene_grace.test.ts index 77a5629a7c5..f46e1bbff62 100644 --- a/src/test/abilities/serene_grace.test.ts +++ b/src/test/abilities/serene_grace.test.ts @@ -76,7 +76,7 @@ describe("Abilities - Serene Grace", () => { it("Move chance with Serene Grace", async() => { const moveToUse = Moves.AIR_SLASH; - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SERENE_GRACE); + game.override.ability(Abilities.SERENE_GRACE); await game.startBattle([ Species.TOGEKISS ]); diff --git a/src/test/abilities/sheer_force.test.ts b/src/test/abilities/sheer_force.test.ts index 815f9bbf37c..e4df5920a04 100644 --- a/src/test/abilities/sheer_force.test.ts +++ b/src/test/abilities/sheer_force.test.ts @@ -43,7 +43,7 @@ describe("Abilities - Sheer Force", () => { it("Sheer Force", async() => { const moveToUse = Moves.AIR_SLASH; - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHEER_FORCE); + game.override.ability(Abilities.SHEER_FORCE); await game.startBattle([ Species.PIDGEOT ]); @@ -82,7 +82,7 @@ describe("Abilities - Sheer Force", () => { it("Sheer Force with exceptions including binding moves", async() => { const moveToUse = Moves.BIND; - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHEER_FORCE); + game.override.ability(Abilities.SHEER_FORCE); await game.startBattle([ Species.PIDGEOT ]); @@ -121,7 +121,7 @@ describe("Abilities - Sheer Force", () => { it("Sheer Force with moves with no secondary effect", async() => { const moveToUse = Moves.TACKLE; - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHEER_FORCE); + game.override.ability(Abilities.SHEER_FORCE); await game.startBattle([ Species.PIDGEOT ]); @@ -162,7 +162,7 @@ describe("Abilities - Sheer Force", () => { const moveToUse = Moves.CRUSH_CLAW; game.override.enemyAbility(Abilities.COLOR_CHANGE); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "KINGS_ROCK", count: 1}]); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHEER_FORCE); + game.override.ability(Abilities.SHEER_FORCE); await game.startBattle([ Species.PIDGEOT ]); diff --git a/src/test/abilities/shields_down.test.ts b/src/test/abilities/shields_down.test.ts index a0790501096..4b3b49d0ff0 100644 --- a/src/test/abilities/shields_down.test.ts +++ b/src/test/abilities/shields_down.test.ts @@ -29,7 +29,7 @@ describe("Abilities - SHIELDS DOWN", () => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHIELDS_DOWN); + game.override.ability(Abilities.SHIELDS_DOWN); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/sturdy.test.ts b/src/test/abilities/sturdy.test.ts index 18bf7d0e36a..34f7c16d542 100644 --- a/src/test/abilities/sturdy.test.ts +++ b/src/test/abilities/sturdy.test.ts @@ -85,7 +85,7 @@ describe("Abilities - Sturdy", () => { test( "Sturdy is ignored by pokemon with `Abilities.MOLD_BREAKER`", async () => { - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOLD_BREAKER); + game.override.ability(Abilities.MOLD_BREAKER); await game.startBattle(); game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT)); diff --git a/src/test/abilities/volt_absorb.test.ts b/src/test/abilities/volt_absorb.test.ts index 51ce6b8d2e1..32e96c91fd0 100644 --- a/src/test/abilities/volt_absorb.test.ts +++ b/src/test/abilities/volt_absorb.test.ts @@ -38,7 +38,7 @@ describe("Abilities - Volt Absorb", () => { const ability = Abilities.VOLT_ABSORB; vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); + game.override.ability(ability); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.DUSKULL); game.override.enemyAbility(Abilities.BALL_FETCH); diff --git a/src/test/abilities/wind_power.test.ts b/src/test/abilities/wind_power.test.ts index 7c7e2af72df..36109f81c33 100644 --- a/src/test/abilities/wind_power.test.ts +++ b/src/test/abilities/wind_power.test.ts @@ -48,7 +48,7 @@ describe("Abilities - Wind Power", () => { }); it("it becomes charged when Tailwind takes effect on its side", async () => { - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_POWER); + game.override.ability(Abilities.WIND_POWER); game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.SHIFTRY]); @@ -64,7 +64,7 @@ describe("Abilities - Wind Power", () => { it("does not become charged when Tailwind takes effect on opposing side", async () => { game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_POWER); + game.override.ability(Abilities.WIND_POWER); await game.startBattle([Species.SHIFTRY]); const magikarp = game.scene.getEnemyPokemon(); diff --git a/src/test/abilities/wind_rider.test.ts b/src/test/abilities/wind_rider.test.ts index 8be74c50f1c..a3d1ae44d44 100644 --- a/src/test/abilities/wind_rider.test.ts +++ b/src/test/abilities/wind_rider.test.ts @@ -50,7 +50,7 @@ describe("Abilities - Wind Rider", () => { }); it("Attack is increased by one stage when Tailwind is present on its side", async () => { - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_RIDER); + game.override.ability(Abilities.WIND_RIDER); game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.SHIFTRY]); @@ -66,7 +66,7 @@ describe("Abilities - Wind Rider", () => { }); it("does not increase Attack when Tailwind is present on opposing side", async () => { - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WIND_RIDER); + game.override.ability(Abilities.WIND_RIDER); game.override.enemySpecies(Species.MAGIKARP); await game.startBattle([Species.SHIFTRY]); diff --git a/src/test/abilities/wonder_skin.test.ts b/src/test/abilities/wonder_skin.test.ts index 89f8088ab59..c62a4eaed66 100644 --- a/src/test/abilities/wonder_skin.test.ts +++ b/src/test/abilities/wonder_skin.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Wonder Skin", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.CHARM]); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.WONDER_SKIN); game.override.enemyMoveset(SPLASH_ONLY); @@ -65,7 +65,7 @@ describe("Abilities - Wonder Skin", () => { it(`does not affect pokemon with ${allAbilities[ability].name}`, async () => { const moveToCheck = allMoves[Moves.CHARM]; - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); + game.override.ability(ability); vi.spyOn(moveToCheck, "calculateBattleAccuracy"); await game.startBattle([Species.PIKACHU]); diff --git a/src/test/abilities/zen_mode.test.ts b/src/test/abilities/zen_mode.test.ts index d7eab759de1..b620431d288 100644 --- a/src/test/abilities/zen_mode.test.ts +++ b/src/test/abilities/zen_mode.test.ts @@ -46,7 +46,7 @@ describe("Abilities - ZEN MODE", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); + game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(100); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/abilities/zero_to_hero.test.ts b/src/test/abilities/zero_to_hero.test.ts index a55d56543e2..cb930382592 100644 --- a/src/test/abilities/zero_to_hero.test.ts +++ b/src/test/abilities/zero_to_hero.test.ts @@ -29,7 +29,7 @@ describe("Abilities - ZERO TO HERO", () => { game = new GameManager(phaserGame); const moveToUse = Moves.SPLASH; game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZERO_TO_HERO); + game.override.ability(Abilities.ZERO_TO_HERO); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/arena/arena_gravity.test.ts b/src/test/arena/arena_gravity.test.ts index 8e171388b06..916a4542924 100644 --- a/src/test/arena/arena_gravity.test.ts +++ b/src/test/arena/arena_gravity.test.ts @@ -31,7 +31,7 @@ describe("Arena - Gravity", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.GRAVITY, Moves.FISSURE]); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); + game.override.ability(Abilities.UNNERVE); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyMoveset(new Array(4).fill(Moves.SPLASH)); diff --git a/src/test/arena/weather_fog.test.ts b/src/test/arena/weather_fog.test.ts index ec6cbba3d32..e0dcf8450d1 100644 --- a/src/test/arena/weather_fog.test.ts +++ b/src/test/arena/weather_fog.test.ts @@ -32,7 +32,7 @@ describe("Weather - Fog", () => { .weather(WeatherType.FOG) .battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset(new Array(4).fill(Moves.SPLASH)); diff --git a/src/test/battle/battle-order.test.ts b/src/test/battle/battle-order.test.ts index 7ffb363de9b..77368d74d32 100644 --- a/src/test/battle/battle-order.test.ts +++ b/src/test/battle/battle-order.test.ts @@ -36,7 +36,7 @@ describe("Battle order", () => { game.override.battleType("single"); game.override.enemySpecies(Species.MEWTWO); game.override.enemyAbility(Abilities.INSOMNIA); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.ability(Abilities.INSOMNIA); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); }); diff --git a/src/test/battle/battle.test.ts b/src/test/battle/battle.test.ts index 130e2c338f2..2eba8f3d93e 100644 --- a/src/test/battle/battle.test.ts +++ b/src/test/battle/battle.test.ts @@ -208,7 +208,7 @@ describe("Test Battle Phase", () => { game.override.battleType("single"); game.override.enemySpecies(Species.MIGHTYENA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.ability(Abilities.HYDRATION); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD, @@ -221,7 +221,7 @@ describe("Test Battle Phase", () => { game.override.battleType("single"); game.override.enemySpecies(Species.MIGHTYENA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.ability(Abilities.HYDRATION); await game.startBattle([ Species.BLASTOISE, ]); @@ -233,7 +233,7 @@ describe("Test Battle Phase", () => { game.override.battleType("double"); game.override.enemySpecies(Species.MIGHTYENA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.ability(Abilities.HYDRATION); game.override.startingWave(3); await game.startBattle([ Species.BLASTOISE, @@ -247,7 +247,7 @@ describe("Test Battle Phase", () => { game.override.battleType("double"); game.override.enemySpecies(Species.MIGHTYENA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.ability(Abilities.HYDRATION); game.override.startingWave(3); await game.startBattle([ Species.BLASTOISE, @@ -265,7 +265,7 @@ describe("Test Battle Phase", () => { game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); + game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(2000); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); @@ -294,7 +294,7 @@ describe("Test Battle Phase", () => { game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); + game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(2000); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); @@ -312,7 +312,7 @@ describe("Test Battle Phase", () => { game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); + game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(2000); game.override.startingWave(3); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); diff --git a/src/test/battle/error-handling.test.ts b/src/test/battle/error-handling.test.ts index 4af376117f2..6998972cd35 100644 --- a/src/test/battle/error-handling.test.ts +++ b/src/test/battle/error-handling.test.ts @@ -29,7 +29,7 @@ describe("Test Battle Phase", () => { game.override.starterSpecies(Species.MEWTWO); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); + game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/battle/special_battle.test.ts b/src/test/battle/special_battle.test.ts index 28b59cd86b7..1d6ce09e70c 100644 --- a/src/test/battle/special_battle.test.ts +++ b/src/test/battle/special_battle.test.ts @@ -30,7 +30,7 @@ describe("Test Battle Phase", () => { game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.ability(Abilities.HYDRATION); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/items/exp_booster.test.ts b/src/test/items/exp_booster.test.ts index 3f0f2fd3424..8e61d8decda 100644 --- a/src/test/items/exp_booster.test.ts +++ b/src/test/items/exp_booster.test.ts @@ -24,7 +24,7 @@ describe("EXP Modifier Items", () => { game = new GameManager(phaserGame); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); game.override.battleType("single"); }); diff --git a/src/test/items/grip_claw.test.ts b/src/test/items/grip_claw.test.ts index 6f975c242f7..951e34fae2c 100644 --- a/src/test/items/grip_claw.test.ts +++ b/src/test/items/grip_claw.test.ts @@ -34,7 +34,7 @@ describe("Items - Grip Claw", () => { vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POPULATION_BOMB, Moves.SPLASH ]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]); game.override.enemySpecies(Species.SNORLAX); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.KLUTZ); + game.override.ability(Abilities.KLUTZ); game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([ {name: "BERRY", type: BerryType.SITRUS, count: 2}, diff --git a/src/test/items/toxic_orb.test.ts b/src/test/items/toxic_orb.test.ts index 67d121f8855..f5ef6a62c60 100644 --- a/src/test/items/toxic_orb.test.ts +++ b/src/test/items/toxic_orb.test.ts @@ -38,7 +38,7 @@ describe("Items - Toxic orb", () => { const oppMoveToUse = Moves.TACKLE; game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.ability(Abilities.INSOMNIA); game.override.enemyAbility(Abilities.INSOMNIA); game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); diff --git a/src/test/moves/aurora_veil.test.ts b/src/test/moves/aurora_veil.test.ts index 4d4d48994e8..5ca56c4d243 100644 --- a/src/test/moves/aurora_veil.test.ts +++ b/src/test/moves/aurora_veil.test.ts @@ -36,7 +36,7 @@ describe("Moves - Aurora Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); diff --git a/src/test/moves/double_team.test.ts b/src/test/moves/double_team.test.ts index 886f6d58085..637f0f39fc6 100644 --- a/src/test/moves/double_team.test.ts +++ b/src/test/moves/double_team.test.ts @@ -30,7 +30,7 @@ describe("Moves - Double Team", () => { game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DOUBLE_TEAM]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index f6b24510db0..a1e8a18540e 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -40,7 +40,7 @@ describe("Moves - Dragon Rage", () => { game.override.starterSpecies(Species.SNORLAX); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_RAGE]); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.startingLevel(100); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index fc91c3aa80d..f67b275a8ba 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -54,7 +54,7 @@ describe("Moves - Fissure", () => { }); it("ignores damage modification from abilities such as fur coat", async () => { - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NO_GUARD); + game.override.ability(Abilities.NO_GUARD); game.override.enemyAbility(Abilities.FUR_COAT); game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE)); diff --git a/src/test/moves/flower_shield.test.ts b/src/test/moves/flower_shield.test.ts index b27cdbbcf60..95a2736aa32 100644 --- a/src/test/moves/flower_shield.test.ts +++ b/src/test/moves/flower_shield.test.ts @@ -31,7 +31,7 @@ describe("Moves - Flower Shield", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); game.override.enemyAbility(Abilities.NONE); game.override.battleType("single"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLOWER_SHIELD, Moves.SPLASH]); diff --git a/src/test/moves/follow_me.test.ts b/src/test/moves/follow_me.test.ts index 44bede6ee76..bdc09605c0c 100644 --- a/src/test/moves/follow_me.test.ts +++ b/src/test/moves/follow_me.test.ts @@ -101,7 +101,7 @@ describe("Moves - Follow Me", () => { test( "move effect should be bypassed by Stalwart", async () => { - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.STALWART); + game.override.ability(Abilities.STALWART); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.QUICK_ATTACK ]); game.override.enemyMoveset([ Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME ]); diff --git a/src/test/moves/gastro_acid.test.ts b/src/test/moves/gastro_acid.test.ts index 901904538c4..161eab37183 100644 --- a/src/test/moves/gastro_acid.test.ts +++ b/src/test/moves/gastro_acid.test.ts @@ -33,7 +33,7 @@ describe("Moves - Gastro Acid", () => { game.override.battleType("double"); game.override.startingLevel(1); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER]); game.override.enemySpecies(Species.BIDOOF); game.override.enemyMoveset(SPLASH_ONLY); diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index a16a7ae0eec..15e81b489d6 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -32,7 +32,7 @@ describe("Moves - Glaive Rush", () => { game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(Array(4).fill(Moves.GLAIVE_RUSH)); game.override.starterSpecies(Species.KLINK); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); + game.override.ability(Abilities.UNNERVE); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FUR_COAT); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SHADOW_SNEAK, Moves.AVALANCHE, Moves.SPLASH, Moves.GLAIVE_RUSH]); }); diff --git a/src/test/moves/growth.test.ts b/src/test/moves/growth.test.ts index 2a3b863c0f1..6b9abd8da59 100644 --- a/src/test/moves/growth.test.ts +++ b/src/test/moves/growth.test.ts @@ -37,7 +37,7 @@ describe("Moves - Growth", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.MOXIE); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.ability(Abilities.INSOMNIA); game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/moves/hard_press.test.ts b/src/test/moves/hard_press.test.ts index 8e6ebb5d404..27c4af71004 100644 --- a/src/test/moves/hard_press.test.ts +++ b/src/test/moves/hard_press.test.ts @@ -31,7 +31,7 @@ describe("Moves - Hard Press", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.MUNCHLAX); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(SPLASH_ONLY); diff --git a/src/test/moves/light_screen.test.ts b/src/test/moves/light_screen.test.ts index e35a9a95c71..c8543c2faed 100644 --- a/src/test/moves/light_screen.test.ts +++ b/src/test/moves/light_screen.test.ts @@ -35,7 +35,7 @@ describe("Moves - Light Screen", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.DAZZLING_GLEAM, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); diff --git a/src/test/moves/multi_target.test.ts b/src/test/moves/multi_target.test.ts index 1627109559c..f60429909db 100644 --- a/src/test/moves/multi_target.test.ts +++ b/src/test/moves/multi_target.test.ts @@ -167,7 +167,7 @@ function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) { const game = new GameManager(phaserGame); game.override.battleType("double"); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE, Moves.HYPER_VOICE, Moves.SURF, Moves.SPLASH]); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.startingLevel(50); diff --git a/src/test/moves/octolock.test.ts b/src/test/moves/octolock.test.ts index 6884aeabc2e..061aaff5d48 100644 --- a/src/test/moves/octolock.test.ts +++ b/src/test/moves/octolock.test.ts @@ -37,7 +37,7 @@ describe("Moves - Octolock", () => { game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.OCTOLOCK, Moves.SPLASH]); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); }); it("Reduces DEf and SPDEF by 1 each turn", { timeout: 10000 }, async () => { diff --git a/src/test/moves/rage_powder.test.ts b/src/test/moves/rage_powder.test.ts index bd28a65db33..768d3580026 100644 --- a/src/test/moves/rage_powder.test.ts +++ b/src/test/moves/rage_powder.test.ts @@ -76,7 +76,7 @@ describe("Moves - Rage Powder", () => { test( "move effect should be bypassed by Overcoat", async () => { - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.OVERCOAT); + game.override.ability(Abilities.OVERCOAT); game.override.enemyMoveset([ Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER, Moves.RAGE_POWDER ]); // Test with two non-Grass type player Pokemon diff --git a/src/test/moves/reflect.test.ts b/src/test/moves/reflect.test.ts index fb279fa7689..35f9599c5f7 100644 --- a/src/test/moves/reflect.test.ts +++ b/src/test/moves/reflect.test.ts @@ -35,7 +35,7 @@ describe("Moves - Reflect", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index c3da6b9c79d..90a3fe065d8 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -29,7 +29,7 @@ describe("Moves - Rollout", () => { vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.battleType("single"); game.override.starterSpecies(Species.RATTATA); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); game.override.enemySpecies(Species.BIDOOF); game.override.enemyAbility(Abilities.NONE); game.override.startingLevel(100); diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index b1104d7d7be..4240c06d10a 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -31,7 +31,7 @@ describe("Moves - Spikes", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.ability(Abilities.HYDRATION); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.startingWave(3); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); diff --git a/src/test/moves/tail_whip.test.ts b/src/test/moves/tail_whip.test.ts index 7bac64d282f..be1e8614c86 100644 --- a/src/test/moves/tail_whip.test.ts +++ b/src/test/moves/tail_whip.test.ts @@ -36,7 +36,7 @@ describe("Moves - Tail whip", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.INSOMNIA); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); + game.override.ability(Abilities.INSOMNIA); game.override.startingLevel(2000); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); diff --git a/src/test/moves/tidy_up.test.ts b/src/test/moves/tidy_up.test.ts index ece454c2988..0fd17baac60 100644 --- a/src/test/moves/tidy_up.test.ts +++ b/src/test/moves/tidy_up.test.ts @@ -33,7 +33,7 @@ describe("Moves - Tidy Up", () => { game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(SPLASH_ONLY); game.override.starterSpecies(Species.FEEBAS); - vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TIDY_UP]); game.override.startingLevel(50); }); From bb1e3f7d209a0c67a6a3134a41756cc0675a93ba Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:36:06 -0700 Subject: [PATCH 21/42] add OverridesHelper.moveset() --- src/test/utils/overridesHelper.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index a888e257c44..5767cac4914 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -74,6 +74,18 @@ export class OverridesHelper { return this; } + /** + * Override the player (pokemon) {@linkcode Moves | moves}set + * @param moveset the {@linkcode Moves | moves}set to set + * @returns this + */ + moveset(moveset: Moves[]): this { + vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(moveset); + const movesetStr = moveset.map((moveId) => Moves[moveId]).join(", "); + this.log(`Player Pokemon moveset set to ${movesetStr} (=[${moveset.join(", ")}])!`); + return this; + } + /** * Override each wave to have or not have standard trainer battles * @returns this From 3242a084f1f77902df11c9b480c8bdb2ff5053e0 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:51:05 -0700 Subject: [PATCH 22/42] apply game.override.moveset --- src/test/abilities/ability_timing.test.ts | 11 +++-- src/test/abilities/aura_break.test.ts | 15 ++++--- src/test/abilities/battery.test.ts | 15 ++++--- src/test/abilities/battle_bond.test.ts | 2 +- src/test/abilities/costar.test.ts | 13 +++--- src/test/abilities/disguise.test.ts | 2 +- src/test/abilities/dry_skin.test.ts | 12 +++--- src/test/abilities/hustle.test.ts | 2 +- src/test/abilities/ice_face.test.ts | 12 +++--- src/test/abilities/intimidate.test.ts | 8 ++-- src/test/abilities/libero.test.ts | 30 +++++++------- src/test/abilities/moxie.test.ts | 19 ++++----- src/test/abilities/parental_bond.test.ts | 46 ++++++++++----------- src/test/abilities/power_construct.test.ts | 2 +- src/test/abilities/power_spot.test.ts | 17 ++++---- src/test/abilities/protean.test.ts | 30 +++++++------- src/test/abilities/quick_draw.test.ts | 2 +- src/test/abilities/sand_veil.test.ts | 2 +- src/test/abilities/sap_sipper.test.ts | 12 +++--- src/test/abilities/schooling.test.ts | 2 +- src/test/abilities/screen_cleaner.test.ts | 15 ++++--- src/test/abilities/serene_grace.test.ts | 25 ++++++----- src/test/abilities/sheer_force.test.ts | 2 +- src/test/abilities/shield_dust.test.ts | 25 ++++++----- src/test/abilities/shields_down.test.ts | 2 +- src/test/abilities/steely_spirit.test.ts | 17 ++++---- src/test/abilities/sturdy.test.ts | 2 +- src/test/abilities/unseen_fist.test.ts | 2 +- src/test/abilities/volt_absorb.test.ts | 2 +- src/test/abilities/wind_power.test.ts | 15 ++++--- src/test/abilities/wind_rider.test.ts | 15 ++++--- src/test/abilities/wonder_skin.test.ts | 17 ++++---- src/test/abilities/zen_mode.test.ts | 2 +- src/test/abilities/zero_to_hero.test.ts | 2 +- src/test/achievements/achievement.test.ts | 13 +++--- src/test/arena/arena_gravity.test.ts | 2 +- src/test/arena/weather_fog.test.ts | 21 +++++----- src/test/arena/weather_strong_winds.test.ts | 15 ++++--- src/test/battle/battle-order.test.ts | 19 ++++----- src/test/battle/battle.test.ts | 27 ++++++------ src/test/battle/error-handling.test.ts | 7 ++-- src/test/battle/special_battle.test.ts | 9 ++-- src/test/items/grip_claw.test.ts | 2 +- src/test/items/leek.test.ts | 2 +- src/test/items/leftovers.test.ts | 2 +- src/test/items/scope_lens.test.ts | 2 +- src/test/items/toxic_orb.test.ts | 2 +- src/test/moves/astonish.test.ts | 2 +- src/test/moves/aurora_veil.test.ts | 2 +- src/test/moves/ceaseless_edge.test.ts | 2 +- src/test/moves/double_team.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 2 +- src/test/moves/dynamax_cannon.test.ts | 2 +- src/test/moves/fissure.test.ts | 2 +- src/test/moves/flower_shield.test.ts | 2 +- src/test/moves/follow_me.test.ts | 6 +-- src/test/moves/gastro_acid.test.ts | 2 +- src/test/moves/glaive_rush.test.ts | 2 +- src/test/moves/growth.test.ts | 19 ++++----- src/test/moves/hard_press.test.ts | 15 ++++--- src/test/moves/hyper_beam.test.ts | 2 +- src/test/moves/light_screen.test.ts | 2 +- src/test/moves/magnet_rise.test.ts | 2 +- src/test/moves/make_it_rain.test.ts | 2 +- src/test/moves/multi_target.test.ts | 2 +- src/test/moves/octolock.test.ts | 15 ++++--- src/test/moves/purify.test.ts | 2 +- src/test/moves/rage_powder.test.ts | 2 +- src/test/moves/reflect.test.ts | 2 +- src/test/moves/rollout.test.ts | 2 +- src/test/moves/roost.test.ts | 2 +- src/test/moves/spikes.test.ts | 2 +- src/test/moves/spit_up.test.ts | 2 +- src/test/moves/spotlight.test.ts | 2 +- src/test/moves/stockpile.test.ts | 2 +- src/test/moves/swallow.test.ts | 2 +- src/test/moves/tackle.test.ts | 2 +- src/test/moves/tail_whip.test.ts | 17 ++++---- src/test/moves/tailwind.test.ts | 19 ++++----- src/test/moves/thousand_arrows.test.ts | 2 +- src/test/moves/tidy_up.test.ts | 25 ++++++----- src/test/ui/transfer-item.test.ts | 2 +- 82 files changed, 333 insertions(+), 359 deletions(-) diff --git a/src/test/abilities/ability_timing.test.ts b/src/test/abilities/ability_timing.test.ts index b3f6c37b15c..0004479ed8c 100644 --- a/src/test/abilities/ability_timing.test.ts +++ b/src/test/abilities/ability_timing.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; import { CommandPhase, MessagePhase, TurnInitPhase } from "#app/phases"; +import i18next, { initI18n } from "#app/plugins/i18n"; +import GameManager from "#app/test/utils/gameManager"; import { Mode } from "#app/ui/ui"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import i18next, { initI18n } from "#app/plugins/i18n"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; @@ -34,7 +33,7 @@ describe("Ability Timing", () => { game.override.enemyMoveset(SPLASH_ONLY); game.override.ability(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.ICE_BEAM]); + game.override.moveset([Moves.SPLASH, Moves.ICE_BEAM]); }); it("should trigger after switch check", async() => { diff --git a/src/test/abilities/aura_break.test.ts b/src/test/abilities/aura_break.test.ts index 20c15f679e8..918905fc00a 100644 --- a/src/test/abilities/aura_break.test.ts +++ b/src/test/abilities/aura_break.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { allMoves } from "#app/data/move.js"; import { MoveEffectPhase } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { allMoves } from "#app/data/move.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Aura Break", () => { @@ -29,7 +28,7 @@ describe("Abilities - Aura Break", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MOONBLAST, Moves.DARK_PULSE, Moves.MOONBLAST, Moves.DARK_PULSE]); + game.override.moveset([Moves.MOONBLAST, Moves.DARK_PULSE, Moves.MOONBLAST, Moves.DARK_PULSE]); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.AURA_BREAK); game.override.enemySpecies(Species.SHUCKLE); diff --git a/src/test/abilities/battery.test.ts b/src/test/abilities/battery.test.ts index be13bceff4d..9c3248f39c0 100644 --- a/src/test/abilities/battery.test.ts +++ b/src/test/abilities/battery.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Moves } from "#enums/moves"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { allMoves } from "#app/data/move.js"; import { Abilities } from "#app/enums/abilities.js"; import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Battery", () => { @@ -31,7 +30,7 @@ describe("Abilities - Battery", () => { game.override.battleType("double"); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); + game.override.moveset([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/abilities/battle_bond.test.ts b/src/test/abilities/battle_bond.test.ts index 094bdc9dd53..2129bcd24e4 100644 --- a/src/test/abilities/battle_bond.test.ts +++ b/src/test/abilities/battle_bond.test.ts @@ -30,7 +30,7 @@ describe("Abilities - BATTLE BOND", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); game.override.ability(Abilities.BATTLE_BOND); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/costar.test.ts b/src/test/abilities/costar.test.ts index 566f982fc08..1d58d899565 100644 --- a/src/test/abilities/costar.test.ts +++ b/src/test/abilities/costar.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; -import GameManager from "../utils/gameManager"; -import Phaser from "phaser"; -import Overrides from "#app/overrides"; import { BattleStat } from "#app/data/battle-stat.js"; -import { CommandPhase, MessagePhase } from "#app/phases.js"; -import { getMovePosition } from "../utils/gameManagerUtils"; import { Abilities } from "#app/enums/abilities.js"; import { Moves } from "#app/enums/moves.js"; import { Species } from "#app/enums/species.js"; +import { CommandPhase, MessagePhase } from "#app/phases.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; +import GameManager from "../utils/gameManager"; +import { getMovePosition } from "../utils/gameManagerUtils"; import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -30,7 +29,7 @@ describe("Abilities - COSTAR", () => { game = new GameManager(phaserGame); game.override.battleType("double"); game.override.ability(Abilities.COSTAR); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.NASTY_PLOT]); + game.override.moveset([Moves.SPLASH, Moves.NASTY_PLOT]); game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index fd486f89c69..cdc5852e8c7 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -30,7 +30,7 @@ describe("Abilities - DISGUISE", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); game.override.ability(Abilities.DISGUISE); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/dry_skin.test.ts b/src/test/abilities/dry_skin.test.ts index 9cb92710285..135acbf88f7 100644 --- a/src/test/abilities/dry_skin.test.ts +++ b/src/test/abilities/dry_skin.test.ts @@ -35,7 +35,7 @@ describe("Abilities - Dry Skin", () => { }); it("during sunlight, lose 1/8 of maximum health at the end of each turn", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SUNNY_DAY, Moves.SPLASH]); + game.override.moveset([Moves.SUNNY_DAY, Moves.SPLASH]); await game.startBattle(); @@ -56,7 +56,7 @@ describe("Abilities - Dry Skin", () => { }); it("during rain, gain 1/8 of maximum health at the end of each turn", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.RAIN_DANCE, Moves.SPLASH]); + game.override.moveset([Moves.RAIN_DANCE, Moves.SPLASH]); await game.startBattle(); @@ -79,7 +79,7 @@ describe("Abilities - Dry Skin", () => { }); it("opposing fire attacks do 25% more damage", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLAMETHROWER]); + game.override.moveset([Moves.FLAMETHROWER]); await game.startBattle(); @@ -106,7 +106,7 @@ describe("Abilities - Dry Skin", () => { }); it("opposing water attacks heal 1/4 of maximum health and deal no damage", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WATER_GUN]); + game.override.moveset([Moves.WATER_GUN]); await game.startBattle(); @@ -121,7 +121,7 @@ describe("Abilities - Dry Skin", () => { }); it("opposing water attacks do not heal if they were protected from", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WATER_GUN]); + game.override.moveset([Moves.WATER_GUN]); await game.startBattle(); @@ -137,7 +137,7 @@ describe("Abilities - Dry Skin", () => { }); it("multi-strike water attacks only heal once", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WATER_GUN, Moves.WATER_SHURIKEN]); + game.override.moveset([Moves.WATER_GUN, Moves.WATER_SHURIKEN]); await game.startBattle(); diff --git a/src/test/abilities/hustle.test.ts b/src/test/abilities/hustle.test.ts index b2033f7ef5e..165169bb66e 100644 --- a/src/test/abilities/hustle.test.ts +++ b/src/test/abilities/hustle.test.ts @@ -28,7 +28,7 @@ describe("Abilities - Hustle", () => { beforeEach(() => { game = new GameManager(phaserGame); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HUSTLE); - vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.GIGA_DRAIN, Moves.FISSURE]); + game.override.moveset([Moves.TACKLE, Moves.GIGA_DRAIN, Moves.FISSURE]); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index c0f91e8dff8..65d9fe1e489 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -36,7 +36,7 @@ describe("Abilities - Ice Face", () => { game.override.battleType("single"); game.override.enemySpecies(Species.EISCUE); game.override.enemyAbility(Abilities.ICE_FACE); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.ICE_BEAM, Moves.TOXIC_THREAD, Moves.HAIL]); + game.override.moveset([Moves.TACKLE, Moves.ICE_BEAM, Moves.TOXIC_THREAD, Moves.HAIL]); }); it("takes no damage from physical move and transforms to Noice", async () => { @@ -54,7 +54,7 @@ describe("Abilities - Ice Face", () => { }); it("takes no damage from the first hit of multihit physical move and transforms to Noice", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SURGING_STRIKES]); + game.override.moveset([Moves.SURGING_STRIKES]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); await game.startBattle([Species.HITMONLEE]); @@ -109,7 +109,7 @@ describe("Abilities - Ice Face", () => { }); it("transforms to Ice Face when Hail or Snow starts", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.QUICK_ATTACK]); + game.override.moveset([Moves.QUICK_ATTACK]); game.override.enemyMoveset([Moves.HAIL, Moves.HAIL, Moves.HAIL, Moves.HAIL]); await game.startBattle([Species.MAGIKARP]); @@ -132,7 +132,7 @@ describe("Abilities - Ice Face", () => { it("transforms to Ice Face when summoned on arena with active Snow or Hail", async () => { game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SNOWSCAPE]); + game.override.moveset([Moves.SNOWSCAPE]); await game.startBattle([Species.EISCUE, Species.NINJASK]); @@ -227,7 +227,7 @@ describe("Abilities - Ice Face", () => { }); it("cannot be suppressed", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.GASTRO_ACID]); + game.override.moveset([Moves.GASTRO_ACID]); await game.startBattle([Species.MAGIKARP]); @@ -243,7 +243,7 @@ describe("Abilities - Ice Face", () => { }); it("cannot be swapped with another ability", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SKILL_SWAP]); + game.override.moveset([Moves.SKILL_SWAP]); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/intimidate.test.ts b/src/test/abilities/intimidate.test.ts index 5bba42bd6d8..c42af129227 100644 --- a/src/test/abilities/intimidate.test.ts +++ b/src/test/abilities/intimidate.test.ts @@ -205,7 +205,7 @@ describe("Abilities - Intimidate", () => { it("single - wild next wave opp triger once, us: none", async () => { game.override.startingWave(2); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.AERIAL_ACE]); + game.override.moveset([Moves.AERIAL_ACE]); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1); @@ -231,7 +231,7 @@ describe("Abilities - Intimidate", () => { it("single - wild next turn - no retrigger on next turn", async () => { game.override.startingWave(2); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; expect(battleStatsOpponent[BattleStat.ATK]).toBe(-1); @@ -254,7 +254,7 @@ describe("Abilities - Intimidate", () => { }, 20000); it("single - trainer should only trigger once and each time he switch", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); game.override.enemyMoveset([Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH, Moves.VOLT_SWITCH]); game.override.startingWave(5); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); @@ -293,7 +293,7 @@ describe("Abilities - Intimidate", () => { }, 200000); it("single - trainer should only trigger once whatever turn we are", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); game.override.startingWave(5); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); diff --git a/src/test/abilities/libero.test.ts b/src/test/abilities/libero.test.ts index ce65614d0aa..cc69334b805 100644 --- a/src/test/abilities/libero.test.ts +++ b/src/test/abilities/libero.test.ts @@ -43,7 +43,7 @@ describe("Abilities - Protean", () => { test( "ability applies and changes a pokemon's type", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); await game.startBattle([Species.MAGIKARP]); @@ -61,7 +61,7 @@ describe("Abilities - Protean", () => { test.skip( "ability applies only once per switch in", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.AGILITY]); + game.override.moveset([Moves.SPLASH, Moves.AGILITY]); await game.startBattle([Species.MAGIKARP, Species.BULBASAUR]); @@ -101,7 +101,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move has a variable type", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WEATHER_BALL]); + game.override.moveset([Moves.WEATHER_BALL]); await game.startBattle([Species.MAGIKARP]); @@ -124,7 +124,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the type has changed by another ability", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.REFRIGERATE); await game.startBattle([Species.MAGIKARP]); @@ -147,7 +147,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move calls another move", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.NATURE_POWER]); + game.override.moveset([Moves.NATURE_POWER]); await game.startBattle([Species.MAGIKARP]); @@ -166,7 +166,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move is delayed / charging", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DIG]); + game.override.moveset([Moves.DIG]); await game.startBattle([Species.MAGIKARP]); @@ -184,7 +184,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move misses", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemyMoveset(SPLASH_ONLY); await game.startBattle([Species.MAGIKARP]); @@ -207,7 +207,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move is protected against", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); await game.startBattle([Species.MAGIKARP]); @@ -226,7 +226,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move fails because of type immunity", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemySpecies(Species.GASTLY); await game.startBattle([Species.MAGIKARP]); @@ -245,7 +245,7 @@ describe("Abilities - Protean", () => { test( "ability is not applied if pokemon's type is the same as the move's type", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); await game.startBattle([Species.MAGIKARP]); @@ -264,7 +264,7 @@ describe("Abilities - Protean", () => { test( "ability is not applied if pokemon is terastallized", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); await game.startBattle([Species.MAGIKARP]); @@ -284,7 +284,7 @@ describe("Abilities - Protean", () => { test( "ability is not applied if pokemon uses struggle", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STRUGGLE]); + game.override.moveset([Moves.STRUGGLE]); await game.startBattle([Species.MAGIKARP]); @@ -302,7 +302,7 @@ describe("Abilities - Protean", () => { test( "ability is not applied if the pokemon's move fails", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BURN_UP]); + game.override.moveset([Moves.BURN_UP]); await game.startBattle([Species.MAGIKARP]); @@ -320,7 +320,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TRICK_OR_TREAT]); + game.override.moveset([Moves.TRICK_OR_TREAT]); game.override.enemySpecies(Species.GASTLY); await game.startBattle([Species.MAGIKARP]); @@ -339,7 +339,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly and the pokemon curses itself", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.CURSE]); + game.override.moveset([Moves.CURSE]); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/moxie.test.ts b/src/test/abilities/moxie.test.ts index 0ad48bbaad9..469a4e2947f 100644 --- a/src/test/abilities/moxie.test.ts +++ b/src/test/abilities/moxie.test.ts @@ -1,20 +1,19 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattleStat } from "#app/data/battle-stat"; +import { Stat } from "#app/data/pokemon-stat"; import { CommandPhase, EnemyCommandPhase, VictoryPhase } from "#app/phases"; -import {Mode} from "#app/ui/ui"; -import {Stat} from "#app/data/pokemon-stat"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {Command} from "#app/ui/command-ui-handler"; -import {BattleStat} from "#app/data/battle-stat"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; +import { Mode } from "#app/ui/ui"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Abilities - Moxie", () => { @@ -39,7 +38,7 @@ describe("Abilities - Moxie", () => { game.override.enemyAbility(Abilities.MOXIE); game.override.ability(Abilities.MOXIE); game.override.startingLevel(2000); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index c6de23432e6..334ab12d46e 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -44,7 +44,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should add second strike to attack move", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); await game.startBattle([Species.CHARIZARD]); @@ -76,7 +76,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should apply secondary effects to both strikes", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.POWER_UP_PUNCH]); + game.override.moveset([Moves.POWER_UP_PUNCH]); game.override.enemySpecies(Species.AMOONGUSS); await game.startBattle([Species.CHARIZARD]); @@ -99,7 +99,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not apply to Status moves", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BABY_DOLL_EYES]); + game.override.moveset([Moves.BABY_DOLL_EYES]); await game.startBattle([Species.CHARIZARD]); @@ -119,7 +119,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not apply to multi-hit moves", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DOUBLE_HIT]); + game.override.moveset([Moves.DOUBLE_HIT]); await game.startBattle([Species.CHARIZARD]); @@ -144,7 +144,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not apply to self-sacrifice moves", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SELF_DESTRUCT]); + game.override.moveset([Moves.SELF_DESTRUCT]); await game.startBattle([Species.CHARIZARD]); @@ -165,7 +165,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not apply to Rollout", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ROLLOUT]); + game.override.moveset([Moves.ROLLOUT]); await game.startBattle([Species.CHARIZARD]); @@ -189,7 +189,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not apply multiplier to fixed-damage moves", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_RAGE]); + game.override.moveset([Moves.DRAGON_RAGE]); await game.startBattle([Species.CHARIZARD]); @@ -211,7 +211,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not apply multiplier to counter moves", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.COUNTER]); + game.override.moveset([Moves.COUNTER]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle([Species.CHARIZARD]); @@ -240,7 +240,7 @@ describe("Abilities - Parental Bond", () => { "ability should not apply to multi-target moves", async () => { game.override.battleType("double"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE]); + game.override.moveset([Moves.EARTHQUAKE]); await game.startBattle([Species.CHARIZARD, Species.PIDGEOT]); @@ -265,7 +265,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should apply to multi-target moves when hitting only one target", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE]); + game.override.moveset([Moves.EARTHQUAKE]); await game.startBattle([Species.CHARIZARD]); @@ -285,7 +285,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should only trigger post-target move effects once", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MIND_BLOWN]); + game.override.moveset([Moves.MIND_BLOWN]); await game.startBattle([Species.PIDGEOT]); @@ -311,7 +311,7 @@ describe("Abilities - Parental Bond", () => { test( "Burn Up only removes type after second strike with this ability", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BURN_UP]); + game.override.moveset([Moves.BURN_UP]); await game.startBattle([Species.CHARIZARD]); @@ -338,7 +338,7 @@ describe("Abilities - Parental Bond", () => { test( "Moves boosted by this ability and Multi-Lens should strike 4 times", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]); await game.startBattle([Species.CHARIZARD]); @@ -360,7 +360,7 @@ describe("Abilities - Parental Bond", () => { test( "Super Fang boosted by this ability and Multi-Lens should strike twice", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SUPER_FANG]); + game.override.moveset([Moves.SUPER_FANG]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]); await game.startBattle([Species.CHARIZARD]); @@ -391,7 +391,7 @@ describe("Abilities - Parental Bond", () => { test( "Seismic Toss boosted by this ability and Multi-Lens should strike twice", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SEISMIC_TOSS]); + game.override.moveset([Moves.SEISMIC_TOSS]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]); await game.startBattle([Species.CHARIZARD]); @@ -422,7 +422,7 @@ describe("Abilities - Parental Bond", () => { test( "Hyper Beam boosted by this ability should strike twice, then recharge", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HYPER_BEAM]); + game.override.moveset([Moves.HYPER_BEAM]); await game.startBattle([Species.CHARIZARD]); @@ -452,7 +452,7 @@ describe("Abilities - Parental Bond", () => { test( "Anchor Shot boosted by this ability should only trap the target after the second hit", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ANCHOR_SHOT]); + game.override.moveset([Moves.ANCHOR_SHOT]); await game.startBattle([Species.CHARIZARD]); @@ -484,7 +484,7 @@ describe("Abilities - Parental Bond", () => { test( "Smack Down boosted by this ability should only ground the target after the second hit", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SMACK_DOWN]); + game.override.moveset([Moves.SMACK_DOWN]); await game.startBattle([Species.CHARIZARD]); @@ -513,7 +513,7 @@ describe("Abilities - Parental Bond", () => { test( "U-turn boosted by this ability should strike twice before forcing a switch", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.U_TURN]); + game.override.moveset([Moves.U_TURN]); await game.startBattle([Species.CHARIZARD, Species.BLASTOISE]); @@ -539,7 +539,7 @@ describe("Abilities - Parental Bond", () => { test( "Wake-Up Slap boosted by this ability should only wake up the target after the second hit", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WAKE_UP_SLAP]); + game.override.moveset([Moves.WAKE_UP_SLAP]); vi.spyOn(Overrides, "OPP_STATUS_OVERRIDE", "get").mockReturnValue(StatusEffect.SLEEP); await game.startBattle([Species.CHARIZARD]); @@ -569,7 +569,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not cause user to hit into King's Shield more than once", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemyMoveset([Moves.KINGS_SHIELD,Moves.KINGS_SHIELD,Moves.KINGS_SHIELD,Moves.KINGS_SHIELD]); await game.startBattle([Species.CHARIZARD]); @@ -591,7 +591,7 @@ describe("Abilities - Parental Bond", () => { test( "ability should not cause user to hit into Storm Drain more than once", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WATER_GUN]); + game.override.moveset([Moves.WATER_GUN]); game.override.enemyAbility(Abilities.STORM_DRAIN); await game.startBattle([Species.CHARIZARD]); @@ -614,7 +614,7 @@ describe("Abilities - Parental Bond", () => { "ability should not apply to multi-target moves with Multi-Lens", async () => { game.override.battleType("double"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE, Moves.SPLASH]); + game.override.moveset([Moves.EARTHQUAKE, Moves.SPLASH]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]); await game.startBattle([Species.CHARIZARD, Species.PIDGEOT]); diff --git a/src/test/abilities/power_construct.test.ts b/src/test/abilities/power_construct.test.ts index 803be7e8147..4128cf7b5d2 100644 --- a/src/test/abilities/power_construct.test.ts +++ b/src/test/abilities/power_construct.test.ts @@ -30,7 +30,7 @@ describe("Abilities - POWER CONSTRUCT", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); game.override.ability(Abilities.POWER_CONSTRUCT); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/power_spot.test.ts b/src/test/abilities/power_spot.test.ts index f47f977046e..018002fe541 100644 --- a/src/test/abilities/power_spot.test.ts +++ b/src/test/abilities/power_spot.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Moves } from "#enums/moves"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { allMoves } from "#app/data/move.js"; -import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; import { Abilities } from "#app/enums/abilities.js"; +import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Power Spot", () => { @@ -29,7 +28,7 @@ describe("Abilities - Power Spot", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); + game.override.moveset([Moves.TACKLE, Moves.BREAKING_SWIPE, Moves.SPLASH, Moves.DAZZLING_GLEAM]); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); diff --git a/src/test/abilities/protean.test.ts b/src/test/abilities/protean.test.ts index 4889bc99b5c..65858ec947d 100644 --- a/src/test/abilities/protean.test.ts +++ b/src/test/abilities/protean.test.ts @@ -43,7 +43,7 @@ describe("Abilities - Protean", () => { test( "ability applies and changes a pokemon's type", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); await game.startBattle([Species.MAGIKARP]); @@ -61,7 +61,7 @@ describe("Abilities - Protean", () => { test.skip( "ability applies only once per switch in", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.AGILITY]); + game.override.moveset([Moves.SPLASH, Moves.AGILITY]); await game.startBattle([Species.MAGIKARP, Species.BULBASAUR]); @@ -101,7 +101,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move has a variable type", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WEATHER_BALL]); + game.override.moveset([Moves.WEATHER_BALL]); await game.startBattle([Species.MAGIKARP]); @@ -124,7 +124,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the type has changed by another ability", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.REFRIGERATE); await game.startBattle([Species.MAGIKARP]); @@ -147,7 +147,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move calls another move", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.NATURE_POWER]); + game.override.moveset([Moves.NATURE_POWER]); await game.startBattle([Species.MAGIKARP]); @@ -166,7 +166,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move is delayed / charging", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DIG]); + game.override.moveset([Moves.DIG]); await game.startBattle([Species.MAGIKARP]); @@ -184,7 +184,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move misses", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemyMoveset(SPLASH_ONLY); await game.startBattle([Species.MAGIKARP]); @@ -207,7 +207,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move is protected against", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); await game.startBattle([Species.MAGIKARP]); @@ -226,7 +226,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's move fails because of type immunity", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemySpecies(Species.GASTLY); await game.startBattle([Species.MAGIKARP]); @@ -245,7 +245,7 @@ describe("Abilities - Protean", () => { test( "ability is not applied if pokemon's type is the same as the move's type", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); await game.startBattle([Species.MAGIKARP]); @@ -264,7 +264,7 @@ describe("Abilities - Protean", () => { test( "ability is not applied if pokemon is terastallized", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); await game.startBattle([Species.MAGIKARP]); @@ -284,7 +284,7 @@ describe("Abilities - Protean", () => { test( "ability is not applied if pokemon uses struggle", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STRUGGLE]); + game.override.moveset([Moves.STRUGGLE]); await game.startBattle([Species.MAGIKARP]); @@ -302,7 +302,7 @@ describe("Abilities - Protean", () => { test( "ability is not applied if the pokemon's move fails", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BURN_UP]); + game.override.moveset([Moves.BURN_UP]); await game.startBattle([Species.MAGIKARP]); @@ -320,7 +320,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly even if the pokemon's Trick-or-Treat fails", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TRICK_OR_TREAT]); + game.override.moveset([Moves.TRICK_OR_TREAT]); game.override.enemySpecies(Species.GASTLY); await game.startBattle([Species.MAGIKARP]); @@ -339,7 +339,7 @@ describe("Abilities - Protean", () => { test( "ability applies correctly and the pokemon curses itself", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.CURSE]); + game.override.moveset([Moves.CURSE]); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/quick_draw.test.ts b/src/test/abilities/quick_draw.test.ts index f94a8c55a6c..444b6bb2470 100644 --- a/src/test/abilities/quick_draw.test.ts +++ b/src/test/abilities/quick_draw.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Quick Draw", () => { game.override.starterSpecies(Species.MAGIKARP); game.override.ability(Abilities.QUICK_DRAW); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TAIL_WHIP]); + game.override.moveset([Moves.TACKLE, Moves.TAIL_WHIP]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); diff --git a/src/test/abilities/sand_veil.test.ts b/src/test/abilities/sand_veil.test.ts index e87398e05c2..a43c554dfdd 100644 --- a/src/test/abilities/sand_veil.test.ts +++ b/src/test/abilities/sand_veil.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Sand Veil", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); game.override.enemySpecies(Species.MEOWSCARADA); game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); diff --git a/src/test/abilities/sap_sipper.test.ts b/src/test/abilities/sap_sipper.test.ts index 4ffab7792d1..57848de61a7 100644 --- a/src/test/abilities/sap_sipper.test.ts +++ b/src/test/abilities/sap_sipper.test.ts @@ -38,7 +38,7 @@ describe("Abilities - Sap Sipper", () => { const moveToUse = Moves.LEAFAGE; const enemyAbility = Abilities.SAP_SIPPER; - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.DUSKULL); game.override.enemyAbility(enemyAbility); @@ -59,7 +59,7 @@ describe("Abilities - Sap Sipper", () => { const moveToUse = Moves.SPORE; const enemyAbility = Abilities.SAP_SIPPER; - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(enemyAbility); @@ -78,7 +78,7 @@ describe("Abilities - Sap Sipper", () => { const moveToUse = Moves.GRASSY_TERRAIN; const enemyAbility = Abilities.SAP_SIPPER; - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(enemyAbility); @@ -98,7 +98,7 @@ describe("Abilities - Sap Sipper", () => { const moveToUse = Moves.BULLET_SEED; const enemyAbility = Abilities.SAP_SIPPER; - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(enemyAbility); @@ -119,7 +119,7 @@ describe("Abilities - Sap Sipper", () => { const moveToUse = Moves.SPIKY_SHIELD; const ability = Abilities.SAP_SIPPER; - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.ability(ability); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); @@ -145,7 +145,7 @@ describe("Abilities - Sap Sipper", () => { const moveToUse = Moves.METRONOME; const enemyAbility = Abilities.SAP_SIPPER; - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(enemyAbility); diff --git a/src/test/abilities/schooling.test.ts b/src/test/abilities/schooling.test.ts index f3e95d987f2..38d8cfd74f2 100644 --- a/src/test/abilities/schooling.test.ts +++ b/src/test/abilities/schooling.test.ts @@ -30,7 +30,7 @@ describe("Abilities - SCHOOLING", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); game.override.ability(Abilities.SCHOOLING); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/screen_cleaner.test.ts b/src/test/abilities/screen_cleaner.test.ts index 04fc2e47f14..2d2dc70b907 100644 --- a/src/test/abilities/screen_cleaner.test.ts +++ b/src/test/abilities/screen_cleaner.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { PostSummonPhase, TurnEndPhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { ArenaTagType } from "#app/enums/arena-tag-type.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Abilities - Screen Cleaner", () => { let phaserGame: Phaser.Game; @@ -31,7 +30,7 @@ describe("Abilities - Screen Cleaner", () => { }); it("removes Aurora Veil", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HAIL]); + game.override.moveset([Moves.HAIL]); game.override.enemyMoveset([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]); diff --git a/src/test/abilities/serene_grace.test.ts b/src/test/abilities/serene_grace.test.ts index f46e1bbff62..13da444454e 100644 --- a/src/test/abilities/serene_grace.test.ts +++ b/src/test/abilities/serene_grace.test.ts @@ -1,20 +1,19 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import {Abilities} from "#enums/abilities"; -import {applyAbAttrs ,MoveEffectChanceMultiplierAbAttr} from "#app/data/ability"; -import {Species} from "#enums/species"; +import { applyAbAttrs, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability"; +import { Stat } from "#app/data/pokemon-stat"; import { CommandPhase, MoveEffectPhase, } from "#app/phases"; -import {Mode} from "#app/ui/ui"; -import {Stat} from "#app/data/pokemon-stat"; -import {Moves} from "#enums/moves"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {Command} from "#app/ui/command-ui-handler"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; +import { Mode } from "#app/ui/ui"; import * as Utils from "#app/utils"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Abilities - Serene Grace", () => { @@ -37,7 +36,7 @@ describe("Abilities - Serene Grace", () => { game.override.battleType("single"); game.override.enemySpecies(Species.ONIX); game.override.startingLevel(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); + game.override.moveset(movesToUse); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/abilities/sheer_force.test.ts b/src/test/abilities/sheer_force.test.ts index e4df5920a04..850a2d97c9f 100644 --- a/src/test/abilities/sheer_force.test.ts +++ b/src/test/abilities/sheer_force.test.ts @@ -37,7 +37,7 @@ describe("Abilities - Sheer Force", () => { game.override.battleType("single"); game.override.enemySpecies(Species.ONIX); game.override.startingLevel(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); + game.override.moveset(movesToUse); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/abilities/shield_dust.test.ts b/src/test/abilities/shield_dust.test.ts index a9d5dbe3209..35e4015e8bc 100644 --- a/src/test/abilities/shield_dust.test.ts +++ b/src/test/abilities/shield_dust.test.ts @@ -1,20 +1,19 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Abilities } from "#enums/abilities"; -import {applyAbAttrs ,applyPreDefendAbAttrs,IgnoreMoveEffectsAbAttr,MoveEffectChanceMultiplierAbAttr} from "#app/data/ability"; -import {Species} from "#enums/species"; +import { applyAbAttrs, applyPreDefendAbAttrs, IgnoreMoveEffectsAbAttr, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability"; +import { Stat } from "#app/data/pokemon-stat"; import { CommandPhase, MoveEffectPhase, } from "#app/phases"; -import {Mode} from "#app/ui/ui"; -import {Stat} from "#app/data/pokemon-stat"; -import {Moves} from "#enums/moves"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {Command} from "#app/ui/command-ui-handler"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; +import { Mode } from "#app/ui/ui"; import * as Utils from "#app/utils"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Abilities - Shield Dust", () => { @@ -38,7 +37,7 @@ describe("Abilities - Shield Dust", () => { game.override.enemySpecies(Species.ONIX); game.override.enemyAbility(Abilities.SHIELD_DUST); game.override.startingLevel(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); + game.override.moveset(movesToUse); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/abilities/shields_down.test.ts b/src/test/abilities/shields_down.test.ts index 4b3b49d0ff0..1b5582d44a7 100644 --- a/src/test/abilities/shields_down.test.ts +++ b/src/test/abilities/shields_down.test.ts @@ -30,7 +30,7 @@ describe("Abilities - SHIELDS DOWN", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); game.override.ability(Abilities.SHIELDS_DOWN); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/steely_spirit.test.ts b/src/test/abilities/steely_spirit.test.ts index 3b276b6ad4a..7ac78eb11fa 100644 --- a/src/test/abilities/steely_spirit.test.ts +++ b/src/test/abilities/steely_spirit.test.ts @@ -1,14 +1,13 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Moves } from "#enums/moves"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; -import { allMoves } from "#app/data/move.js"; import { allAbilities } from "#app/data/ability.js"; +import { allMoves } from "#app/data/move.js"; import { Abilities } from "#app/enums/abilities.js"; import { MoveEffectPhase, SelectTargetPhase } from "#app/phases.js"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Steely Spirit", () => { @@ -33,7 +32,7 @@ describe("Abilities - Steely Spirit", () => { game.override.battleType("double"); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.IRON_HEAD, Moves.SPLASH]); + game.override.moveset([Moves.IRON_HEAD, Moves.SPLASH]); game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(allMoves[moveToCheck], "calculateBattlePower"); }); diff --git a/src/test/abilities/sturdy.test.ts b/src/test/abilities/sturdy.test.ts index 34f7c16d542..33c3de2fb28 100644 --- a/src/test/abilities/sturdy.test.ts +++ b/src/test/abilities/sturdy.test.ts @@ -34,7 +34,7 @@ describe("Abilities - Sturdy", () => { game.override.starterSpecies(Species.LUCARIO); game.override.startingLevel(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.CLOSE_COMBAT, Moves.FISSURE]); + game.override.moveset([Moves.CLOSE_COMBAT, Moves.FISSURE]); game.override.enemySpecies(Species.ARON); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); diff --git a/src/test/abilities/unseen_fist.test.ts b/src/test/abilities/unseen_fist.test.ts index f955f7c4ed4..715236025be 100644 --- a/src/test/abilities/unseen_fist.test.ts +++ b/src/test/abilities/unseen_fist.test.ts @@ -68,7 +68,7 @@ describe("Abilities - Unseen Fist", () => { }); async function testUnseenFistHitResult(game: GameManager, attackMove: Moves, protectMove: Moves, shouldSucceed: boolean = true): Promise { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([attackMove]); + game.override.moveset([attackMove]); game.override.enemyMoveset([protectMove, protectMove, protectMove, protectMove]); await game.startBattle(); diff --git a/src/test/abilities/volt_absorb.test.ts b/src/test/abilities/volt_absorb.test.ts index 32e96c91fd0..b1bf638fc77 100644 --- a/src/test/abilities/volt_absorb.test.ts +++ b/src/test/abilities/volt_absorb.test.ts @@ -37,7 +37,7 @@ describe("Abilities - Volt Absorb", () => { const moveToUse = Moves.CHARGE; const ability = Abilities.VOLT_ABSORB; - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.ability(ability); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); game.override.enemySpecies(Species.DUSKULL); diff --git a/src/test/abilities/wind_power.test.ts b/src/test/abilities/wind_power.test.ts index 36109f81c33..cfdb2e745fe 100644 --- a/src/test/abilities/wind_power.test.ts +++ b/src/test/abilities/wind_power.test.ts @@ -1,15 +1,14 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import { TurnEndPhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Wind Power", () => { @@ -31,7 +30,7 @@ describe("Abilities - Wind Power", () => { game.override.battleType("single"); game.override.enemySpecies(Species.SHIFTRY); game.override.enemyAbility(Abilities.WIND_POWER); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); + game.override.moveset([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/abilities/wind_rider.test.ts b/src/test/abilities/wind_rider.test.ts index a3d1ae44d44..88da929fbf1 100644 --- a/src/test/abilities/wind_rider.test.ts +++ b/src/test/abilities/wind_rider.test.ts @@ -1,15 +1,14 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { BattleStat } from "#app/data/battle-stat.js"; import { TurnEndPhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { BattleStat } from "#app/data/battle-stat.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Wind Rider", () => { @@ -31,7 +30,7 @@ describe("Abilities - Wind Rider", () => { game.override.battleType("single"); game.override.enemySpecies(Species.SHIFTRY); game.override.enemyAbility(Abilities.WIND_RIDER); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); + game.override.moveset([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/abilities/wonder_skin.test.ts b/src/test/abilities/wonder_skin.test.ts index c62a4eaed66..bc964134e45 100644 --- a/src/test/abilities/wonder_skin.test.ts +++ b/src/test/abilities/wonder_skin.test.ts @@ -1,14 +1,13 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { allAbilities } from "#app/data/ability.js"; +import { allMoves } from "#app/data/move.js"; import { MoveEffectPhase } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { allMoves } from "#app/data/move.js"; -import { allAbilities } from "#app/data/ability.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Wonder Skin", () => { @@ -28,7 +27,7 @@ describe("Abilities - Wonder Skin", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.CHARM]); + game.override.moveset([Moves.TACKLE, Moves.CHARM]); game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.WONDER_SKIN); diff --git a/src/test/abilities/zen_mode.test.ts b/src/test/abilities/zen_mode.test.ts index b620431d288..dfb96c7d336 100644 --- a/src/test/abilities/zen_mode.test.ts +++ b/src/test/abilities/zen_mode.test.ts @@ -48,7 +48,7 @@ describe("Abilities - ZEN MODE", () => { game.override.enemyAbility(Abilities.HYDRATION); game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/abilities/zero_to_hero.test.ts b/src/test/abilities/zero_to_hero.test.ts index cb930382592..29e07078dfc 100644 --- a/src/test/abilities/zero_to_hero.test.ts +++ b/src/test/abilities/zero_to_hero.test.ts @@ -30,7 +30,7 @@ describe("Abilities - ZERO TO HERO", () => { const moveToUse = Moves.SPLASH; game.override.battleType("single"); game.override.ability(Abilities.ZERO_TO_HERO); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); }); diff --git a/src/test/achievements/achievement.test.ts b/src/test/achievements/achievement.test.ts index 57c18c43708..83d24d1f0ee 100644 --- a/src/test/achievements/achievement.test.ts +++ b/src/test/achievements/achievement.test.ts @@ -1,11 +1,10 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import {MoneyAchv, Achv, AchvTier, RibbonAchv, DamageAchv, HealAchv, LevelAchv, ModifierAchv, achvs} from "#app/system/achv"; -import BattleScene from "../../battle-scene"; -import { IntegerHolder, NumberHolder } from "#app/utils.js"; import { TurnHeldItemTransferModifier } from "#app/modifier/modifier.js"; -import Phaser from "phaser"; +import { Achv, AchvTier, DamageAchv, HealAchv, LevelAchv, ModifierAchv, MoneyAchv, RibbonAchv, achvs } from "#app/system/achv"; import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { IntegerHolder, NumberHolder } from "#app/utils.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; +import BattleScene from "../../battle-scene"; describe("check some Achievement related stuff", () => { it ("should check Achievement creation", () => { @@ -103,8 +102,8 @@ describe("RibbonAchv", () => { }); beforeEach(() => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([]); game = new GameManager(phaserGame); + game.override.moveset([]); game.override.startingLevel(0); game.override.starterSpecies(0); game.override.enemyMoveset([]); diff --git a/src/test/arena/arena_gravity.test.ts b/src/test/arena/arena_gravity.test.ts index 916a4542924..b96b3940245 100644 --- a/src/test/arena/arena_gravity.test.ts +++ b/src/test/arena/arena_gravity.test.ts @@ -30,7 +30,7 @@ describe("Arena - Gravity", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.GRAVITY, Moves.FISSURE]); + game.override.moveset([Moves.TACKLE, Moves.GRAVITY, Moves.FISSURE]); game.override.ability(Abilities.UNNERVE); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); diff --git a/src/test/arena/weather_fog.test.ts b/src/test/arena/weather_fog.test.ts index e0dcf8450d1..9b0630f5c2b 100644 --- a/src/test/arena/weather_fog.test.ts +++ b/src/test/arena/weather_fog.test.ts @@ -1,16 +1,15 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { - MoveEffectPhase, -} from "#app/phases"; -import { Moves } from "#enums/moves"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { allMoves } from "#app/data/move.js"; import { WeatherType } from "#app/data/weather.js"; import { Abilities } from "#app/enums/abilities.js"; +import { + MoveEffectPhase, +} from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Weather - Fog", () => { let phaserGame: Phaser.Game; @@ -31,7 +30,7 @@ describe("Weather - Fog", () => { game.override .weather(WeatherType.FOG) .battleType("single"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.ability(Abilities.BALL_FETCH); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemySpecies(Species.MAGIKARP); diff --git a/src/test/arena/weather_strong_winds.test.ts b/src/test/arena/weather_strong_winds.test.ts index cc85d7a0866..6c977401f20 100644 --- a/src/test/arena/weather_strong_winds.test.ts +++ b/src/test/arena/weather_strong_winds.test.ts @@ -1,15 +1,14 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { allMoves } from "#app/data/move.js"; import { TurnStartPhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { allMoves } from "#app/data/move.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Weather - Strong Winds", () => { let phaserGame: Phaser.Game; @@ -31,7 +30,7 @@ describe("Weather - Strong Winds", () => { game.override.startingLevel(10); game.override.enemySpecies(Species.TAILLOW); game.override.enemyAbility(Abilities.DELTA_STREAM); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.THUNDERBOLT, Moves.ICE_BEAM, Moves.ROCK_SLIDE]); + game.override.moveset([Moves.THUNDERBOLT, Moves.ICE_BEAM, Moves.ROCK_SLIDE]); }); it("electric type move is not very effective on Rayquaza", async () => { diff --git a/src/test/battle/battle-order.test.ts b/src/test/battle/battle-order.test.ts index 77368d74d32..14ff1bcec0d 100644 --- a/src/test/battle/battle-order.test.ts +++ b/src/test/battle/battle-order.test.ts @@ -1,20 +1,19 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { Stat } from "#app/data/pokemon-stat"; import { CommandPhase, EnemyCommandPhase, SelectTargetPhase, TurnStartPhase } from "#app/phases"; -import {Mode} from "#app/ui/ui"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {Command} from "#app/ui/command-ui-handler"; -import {Stat} from "#app/data/pokemon-stat"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; import TargetSelectUiHandler from "#app/ui/target-select-ui-handler"; +import { Mode } from "#app/ui/ui"; import { Abilities } from "#enums/abilities"; +import { Button } from "#enums/buttons"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import {Button} from "#enums/buttons"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Battle order", () => { @@ -37,7 +36,7 @@ describe("Battle order", () => { game.override.enemySpecies(Species.MEWTWO); game.override.enemyAbility(Abilities.INSOMNIA); game.override.ability(Abilities.INSOMNIA); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); }); it("opponent faster than player 50 vs 150", async() => { diff --git a/src/test/battle/battle.test.ts b/src/test/battle/battle.test.ts index 2eba8f3d93e..a91cd1e8352 100644 --- a/src/test/battle/battle.test.ts +++ b/src/test/battle/battle.test.ts @@ -1,9 +1,6 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import {generateStarter, getMovePosition,} from "#app/test/utils/gameManagerUtils"; -import {Mode} from "#app/ui/ui"; -import {GameModes} from "#app/game-mode"; -import Overrides from "#app/overrides"; -import {Command} from "#app/ui/command-ui-handler"; +import { allSpecies } from "#app/data/pokemon-species"; +import { GameModes } from "#app/game-mode"; +import { getGameMode } from "#app/game-mode.js"; import { CommandPhase, DamagePhase, EncounterPhase, @@ -17,13 +14,15 @@ import { TurnInitPhase, VictoryPhase, } from "#app/phases"; import GameManager from "#app/test/utils/gameManager"; -import Phaser from "phaser"; -import {allSpecies} from "#app/data/pokemon-species"; -import { getGameMode } from "#app/game-mode.js"; +import { generateStarter, getMovePosition, } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; +import { Mode } from "#app/ui/ui"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { PlayerGender } from "#enums/player-gender"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Test Battle Phase", () => { let phaserGame: Phaser.Game; @@ -96,7 +95,7 @@ describe("Test Battle Phase", () => { game.override .startingWave(3) .battleType("single"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); await game.startBattle(); @@ -115,7 +114,7 @@ describe("Test Battle Phase", () => { game.override.enemySpecies(Species.RATTATA); game.override.startingLevel(5); game.override.startingWave(3); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); game.override.enemyMoveset([Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP, Moves.TAIL_WHIP]); game.override.battleType("single"); @@ -268,7 +267,7 @@ describe("Test Battle Phase", () => { game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(2000); game.override.startingWave(3); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle([ Species.DARMANITAN, @@ -297,7 +296,7 @@ describe("Test Battle Phase", () => { game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(2000); game.override.startingWave(3); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle(); const turn = game.scene.currentBattle.turn; @@ -315,7 +314,7 @@ describe("Test Battle Phase", () => { game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(2000); game.override.startingWave(3); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); await game.startBattle(); const waveIndex = game.scene.currentBattle.waveIndex; diff --git a/src/test/battle/error-handling.test.ts b/src/test/battle/error-handling.test.ts index 6998972cd35..a823887b4f8 100644 --- a/src/test/battle/error-handling.test.ts +++ b/src/test/battle/error-handling.test.ts @@ -1,10 +1,9 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import GameManager from "#app/test/utils/gameManager"; -import Phaser from "phaser"; -import Overrides from "#app/overrides"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Test Battle Phase", () => { let phaserGame: Phaser.Game; @@ -31,7 +30,7 @@ describe("Test Battle Phase", () => { game.override.enemyAbility(Abilities.HYDRATION); game.override.ability(Abilities.ZEN_MODE); game.override.startingLevel(2000); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/battle/special_battle.test.ts b/src/test/battle/special_battle.test.ts index 1d6ce09e70c..e4243ea1418 100644 --- a/src/test/battle/special_battle.test.ts +++ b/src/test/battle/special_battle.test.ts @@ -1,14 +1,13 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import {Mode} from "#app/ui/ui"; -import Overrides from "#app/overrides"; import { CommandPhase, } from "#app/phases"; import GameManager from "#app/test/utils/gameManager"; -import Phaser from "phaser"; +import { Mode } from "#app/ui/ui"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Test Battle Phase", () => { let phaserGame: Phaser.Game; @@ -28,7 +27,7 @@ describe("Test Battle Phase", () => { game = new GameManager(phaserGame); game.override.enemySpecies(Species.RATTATA); game.override.startingLevel(2000); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); + game.override.moveset([Moves.TACKLE]); game.override.enemyAbility(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/items/grip_claw.test.ts b/src/test/items/grip_claw.test.ts index 951e34fae2c..edd9c34655c 100644 --- a/src/test/items/grip_claw.test.ts +++ b/src/test/items/grip_claw.test.ts @@ -31,7 +31,7 @@ describe("Items - Grip Claw", () => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POPULATION_BOMB, Moves.SPLASH ]); + game.override.moveset([ Moves.POPULATION_BOMB, Moves.SPLASH ]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]); game.override.enemySpecies(Species.SNORLAX); game.override.ability(Abilities.KLUTZ); diff --git a/src/test/items/leek.test.ts b/src/test/items/leek.test.ts index e03caec36d9..5dfd75d6cb5 100644 --- a/src/test/items/leek.test.ts +++ b/src/test/items/leek.test.ts @@ -36,7 +36,7 @@ describe("Items - Leek", () => { it("LEEK activates in battle correctly", async() => { vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "LEEK" }]); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POUND ]); + game.override.moveset([ Moves.POUND ]); const consoleSpy = vi.spyOn(console, "log"); await game.startBattle([ Species.FARFETCHD diff --git a/src/test/items/leftovers.test.ts b/src/test/items/leftovers.test.ts index ee2ead08234..7c89e1e299d 100644 --- a/src/test/items/leftovers.test.ts +++ b/src/test/items/leftovers.test.ts @@ -28,7 +28,7 @@ describe("Items - Leftovers", () => { game.override.battleType("single"); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); - vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); + game.override.moveset([Moves.SPLASH]); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.UNNERVE); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/items/scope_lens.test.ts b/src/test/items/scope_lens.test.ts index 4ddb4177cd9..d0e556fab79 100644 --- a/src/test/items/scope_lens.test.ts +++ b/src/test/items/scope_lens.test.ts @@ -36,7 +36,7 @@ describe("Items - Scope Lens", () => { it("SCOPE_LENS activates in battle correctly", async() => { vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SCOPE_LENS" }]); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POUND ]); + game.override.moveset([ Moves.POUND ]); const consoleSpy = vi.spyOn(console, "log"); await game.startBattle([ Species.GASTLY diff --git a/src/test/items/toxic_orb.test.ts b/src/test/items/toxic_orb.test.ts index f5ef6a62c60..bdef05fec2f 100644 --- a/src/test/items/toxic_orb.test.ts +++ b/src/test/items/toxic_orb.test.ts @@ -41,7 +41,7 @@ describe("Items - Toxic orb", () => { game.override.ability(Abilities.INSOMNIA); game.override.enemyAbility(Abilities.INSOMNIA); game.override.startingLevel(2000); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([oppMoveToUse, oppMoveToUse, oppMoveToUse, oppMoveToUse]); vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "TOXIC_ORB", diff --git a/src/test/moves/astonish.test.ts b/src/test/moves/astonish.test.ts index ac5ef3fde76..66bed1e5333 100644 --- a/src/test/moves/astonish.test.ts +++ b/src/test/moves/astonish.test.ts @@ -29,7 +29,7 @@ describe("Moves - Astonish", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ASTONISH, Moves.SPLASH]); + game.override.moveset([Moves.ASTONISH, Moves.SPLASH]); game.override.enemySpecies(Species.BLASTOISE); game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); diff --git a/src/test/moves/aurora_veil.test.ts b/src/test/moves/aurora_veil.test.ts index 5ca56c4d243..4f5022db4ae 100644 --- a/src/test/moves/aurora_veil.test.ts +++ b/src/test/moves/aurora_veil.test.ts @@ -37,7 +37,7 @@ describe("Moves - Aurora Veil", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.ability(Abilities.NONE); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); + game.override.moveset([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index dafa1be3049..5998f67549c 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -38,7 +38,7 @@ describe("Moves - Ceaseless Edge", () => { vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.CEASELESS_EDGE, Moves.SPLASH, Moves.ROAR ]); + game.override.moveset([ Moves.CEASELESS_EDGE, Moves.SPLASH, Moves.ROAR ]); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); vi.spyOn(allMoves[Moves.CEASELESS_EDGE], "accuracy", "get").mockReturnValue(100); diff --git a/src/test/moves/double_team.test.ts b/src/test/moves/double_team.test.ts index 637f0f39fc6..2c42e1651ba 100644 --- a/src/test/moves/double_team.test.ts +++ b/src/test/moves/double_team.test.ts @@ -28,7 +28,7 @@ describe("Moves - Double Team", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DOUBLE_TEAM]); + game.override.moveset([Moves.DOUBLE_TEAM]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index a1e8a18540e..330b8ab22a4 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -39,7 +39,7 @@ describe("Moves - Dragon Rage", () => { vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.starterSpecies(Species.SNORLAX); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_RAGE]); + game.override.moveset([Moves.DRAGON_RAGE]); game.override.ability(Abilities.BALL_FETCH); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.startingLevel(100); diff --git a/src/test/moves/dynamax_cannon.test.ts b/src/test/moves/dynamax_cannon.test.ts index 88251b74115..3e1ba2f609e 100644 --- a/src/test/moves/dynamax_cannon.test.ts +++ b/src/test/moves/dynamax_cannon.test.ts @@ -28,7 +28,7 @@ describe("Moves - Dynamax Cannon", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ dynamaxCannon.id ]); + game.override.moveset([ dynamaxCannon.id ]); game.override.startingLevel(200); // Note that, for Waves 1-10, the level cap is 10 diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index f67b275a8ba..cfc5c2b76f7 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -34,7 +34,7 @@ describe("Moves - Fissure", () => { vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.starterSpecies(Species.SNORLAX); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FISSURE]); + game.override.moveset([Moves.FISSURE]); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.startingLevel(100); diff --git a/src/test/moves/flower_shield.test.ts b/src/test/moves/flower_shield.test.ts index 95a2736aa32..fb6708726e5 100644 --- a/src/test/moves/flower_shield.test.ts +++ b/src/test/moves/flower_shield.test.ts @@ -34,7 +34,7 @@ describe("Moves - Flower Shield", () => { game.override.ability(Abilities.NONE); game.override.enemyAbility(Abilities.NONE); game.override.battleType("single"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.FLOWER_SHIELD, Moves.SPLASH]); + game.override.moveset([Moves.FLOWER_SHIELD, Moves.SPLASH]); game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/moves/follow_me.test.ts b/src/test/moves/follow_me.test.ts index bdc09605c0c..5ee4ee02ba2 100644 --- a/src/test/moves/follow_me.test.ts +++ b/src/test/moves/follow_me.test.ts @@ -37,7 +37,7 @@ describe("Moves - Follow Me", () => { game.override.enemySpecies(Species.SNORLAX); game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); + game.override.moveset([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); @@ -102,7 +102,7 @@ describe("Moves - Follow Me", () => { "move effect should be bypassed by Stalwart", async () => { game.override.ability(Abilities.STALWART); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.QUICK_ATTACK ]); + game.override.moveset([ Moves.QUICK_ATTACK ]); game.override.enemyMoveset([ Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME ]); await game.startBattle([ Species.AMOONGUSS, Species.CHARIZARD ]); @@ -136,7 +136,7 @@ describe("Moves - Follow Me", () => { test( "move effect should be bypassed by Snipe Shot", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SNIPE_SHOT ]); + game.override.moveset([ Moves.SNIPE_SHOT ]); game.override.enemyMoveset([ Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME, Moves.FOLLOW_ME ]); await game.startBattle([ Species.AMOONGUSS, Species.CHARIZARD ]); diff --git a/src/test/moves/gastro_acid.test.ts b/src/test/moves/gastro_acid.test.ts index 161eab37183..35bb345c756 100644 --- a/src/test/moves/gastro_acid.test.ts +++ b/src/test/moves/gastro_acid.test.ts @@ -34,7 +34,7 @@ describe("Moves - Gastro Acid", () => { game.override.startingLevel(1); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.ability(Abilities.NONE); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER]); + game.override.moveset([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER]); game.override.enemySpecies(Species.BIDOOF); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.WATER_ABSORB); diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index 15e81b489d6..42265568cc6 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -34,7 +34,7 @@ describe("Moves - Glaive Rush", () => { game.override.starterSpecies(Species.KLINK); game.override.ability(Abilities.UNNERVE); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FUR_COAT); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SHADOW_SNEAK, Moves.AVALANCHE, Moves.SPLASH, Moves.GLAIVE_RUSH]); + game.override.moveset([Moves.SHADOW_SNEAK, Moves.AVALANCHE, Moves.SPLASH, Moves.GLAIVE_RUSH]); }); it("takes double damage from attacks", async() => { diff --git a/src/test/moves/growth.test.ts b/src/test/moves/growth.test.ts index 6b9abd8da59..3d4a37fda73 100644 --- a/src/test/moves/growth.test.ts +++ b/src/test/moves/growth.test.ts @@ -1,20 +1,19 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattleStat } from "#app/data/battle-stat"; +import { Stat } from "#app/data/pokemon-stat"; import { CommandPhase, EnemyCommandPhase, TurnInitPhase, } from "#app/phases"; -import {Mode} from "#app/ui/ui"; -import {Stat} from "#app/data/pokemon-stat"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {Command} from "#app/ui/command-ui-handler"; -import {BattleStat} from "#app/data/battle-stat"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; +import { Mode } from "#app/ui/ui"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Growth", () => { @@ -39,7 +38,7 @@ describe("Moves - Growth", () => { game.override.enemyAbility(Abilities.MOXIE); game.override.ability(Abilities.INSOMNIA); game.override.startingLevel(2000); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/moves/hard_press.test.ts b/src/test/moves/hard_press.test.ts index 27c4af71004..89f8e14169f 100644 --- a/src/test/moves/hard_press.test.ts +++ b/src/test/moves/hard_press.test.ts @@ -1,15 +1,14 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { allMoves } from "#app/data/move.js"; import { MoveEffectPhase } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { allMoves } from "#app/data/move.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Hard Press", () => { @@ -35,7 +34,7 @@ describe("Moves - Hard Press", () => { game.override.enemySpecies(Species.MUNCHLAX); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(SPLASH_ONLY); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HARD_PRESS]); + game.override.moveset([Moves.HARD_PRESS]); vi.spyOn(moveToCheck, "calculateBattlePower"); }); diff --git a/src/test/moves/hyper_beam.test.ts b/src/test/moves/hyper_beam.test.ts index b6c6c08f089..4cd9d0600a8 100644 --- a/src/test/moves/hyper_beam.test.ts +++ b/src/test/moves/hyper_beam.test.ts @@ -35,7 +35,7 @@ describe("Moves - Hyper Beam", () => { game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(Array(4).fill(Moves.SPLASH)); - vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HYPER_BEAM, Moves.TACKLE]); + game.override.moveset([Moves.HYPER_BEAM, Moves.TACKLE]); vi.spyOn(allMoves[Moves.HYPER_BEAM], "accuracy", "get").mockReturnValue(100); }); diff --git a/src/test/moves/light_screen.test.ts b/src/test/moves/light_screen.test.ts index c8543c2faed..d06e0b7804f 100644 --- a/src/test/moves/light_screen.test.ts +++ b/src/test/moves/light_screen.test.ts @@ -36,7 +36,7 @@ describe("Moves - Light Screen", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.ability(Abilities.NONE); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.DAZZLING_GLEAM, Moves.TACKLE]); + game.override.moveset([Moves.ABSORB, Moves.DAZZLING_GLEAM, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN]); diff --git a/src/test/moves/magnet_rise.test.ts b/src/test/moves/magnet_rise.test.ts index a321499d11f..de87ae81a79 100644 --- a/src/test/moves/magnet_rise.test.ts +++ b/src/test/moves/magnet_rise.test.ts @@ -29,7 +29,7 @@ describe("Moves - Magnet Rise", () => { game.override.enemyMoveset([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse, Moves.SPLASH, Moves.GRAVITY, Moves.BATON_PASS]); + game.override.moveset([moveToUse, Moves.SPLASH, Moves.GRAVITY, Moves.BATON_PASS]); }); it("MAGNET RISE", async () => { diff --git a/src/test/moves/make_it_rain.test.ts b/src/test/moves/make_it_rain.test.ts index ca207a63c3f..7d431b60a27 100644 --- a/src/test/moves/make_it_rain.test.ts +++ b/src/test/moves/make_it_rain.test.ts @@ -33,7 +33,7 @@ describe("Moves - Make It Rain", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MAKE_IT_RAIN, Moves.SPLASH]); + game.override.moveset([Moves.MAKE_IT_RAIN, Moves.SPLASH]); game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset(SPLASH_ONLY); diff --git a/src/test/moves/multi_target.test.ts b/src/test/moves/multi_target.test.ts index f60429909db..229732fe0ac 100644 --- a/src/test/moves/multi_target.test.ts +++ b/src/test/moves/multi_target.test.ts @@ -166,7 +166,7 @@ function leaveOneEnemyPokemon(game: GameManager) { function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) { const game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE, Moves.HYPER_VOICE, Moves.SURF, Moves.SPLASH]); + game.override.moveset([Moves.EARTHQUAKE, Moves.HYPER_VOICE, Moves.SURF, Moves.SPLASH]); game.override.ability(Abilities.BALL_FETCH); game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/moves/octolock.test.ts b/src/test/moves/octolock.test.ts index 061aaff5d48..6d5f404d2f4 100644 --- a/src/test/moves/octolock.test.ts +++ b/src/test/moves/octolock.test.ts @@ -1,14 +1,13 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattleStat } from "#app/data/battle-stat"; +import { TrappedTag } from "#app/data/battler-tags.js"; import { CommandPhase, MoveEndPhase, TurnInitPhase } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {BattleStat} from "#app/data/battle-stat"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { TrappedTag } from "#app/data/battler-tags.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Octolock", () => { @@ -36,7 +35,7 @@ describe("Moves - Octolock", () => { game.override.enemyAbility(Abilities.NONE); game.override.startingLevel(2000); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.OCTOLOCK, Moves.SPLASH]); + game.override.moveset([Moves.OCTOLOCK, Moves.SPLASH]); game.override.ability(Abilities.NONE); }); diff --git a/src/test/moves/purify.test.ts b/src/test/moves/purify.test.ts index 0a5419f7288..513f3f891ee 100644 --- a/src/test/moves/purify.test.ts +++ b/src/test/moves/purify.test.ts @@ -33,7 +33,7 @@ describe("Moves - Purify", () => { game.override.starterSpecies(Species.PYUKUMUKU); game.override.startingLevel(10); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.PURIFY, Moves.SIZZLY_SLIDE]); + game.override.moveset([Moves.PURIFY, Moves.SIZZLY_SLIDE]); game.override.enemySpecies(Species.MAGIKARP); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(10); diff --git a/src/test/moves/rage_powder.test.ts b/src/test/moves/rage_powder.test.ts index 768d3580026..60c0897c102 100644 --- a/src/test/moves/rage_powder.test.ts +++ b/src/test/moves/rage_powder.test.ts @@ -36,7 +36,7 @@ describe("Moves - Rage Powder", () => { game.override.enemySpecies(Species.SNORLAX); game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); + game.override.moveset([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/moves/reflect.test.ts b/src/test/moves/reflect.test.ts index 35f9599c5f7..3ee78d3d6d1 100644 --- a/src/test/moves/reflect.test.ts +++ b/src/test/moves/reflect.test.ts @@ -36,7 +36,7 @@ describe("Moves - Reflect", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.ability(Abilities.NONE); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); + game.override.moveset([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.REFLECT, Moves.REFLECT, Moves.REFLECT, Moves.REFLECT]); diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index 90a3fe065d8..d2520c91180 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -38,7 +38,7 @@ describe("Moves - Rollout", () => { }); it("should double it's dmg on sequential uses but reset after 5", async () => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ROLLOUT]); + game.override.moveset([Moves.ROLLOUT]); vi.spyOn(allMoves[Moves.ROLLOUT], "accuracy", "get").mockReturnValue(100); //always hit const variance = 5; diff --git a/src/test/moves/roost.test.ts b/src/test/moves/roost.test.ts index e29056ff443..3802cdbb6ee 100644 --- a/src/test/moves/roost.test.ts +++ b/src/test/moves/roost.test.ts @@ -32,7 +32,7 @@ describe("Moves - Roost", () => { game.override.enemyAbility(Abilities.INSOMNIA); game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.STOMPING_TANTRUM ]); + game.override.moveset([ Moves.STOMPING_TANTRUM ]); game.override.enemyMoveset([Moves.ROOST,Moves.ROOST,Moves.ROOST,Moves.ROOST]); }); diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index 4240c06d10a..b2f711d406a 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -35,7 +35,7 @@ describe("Moves - Spikes", () => { vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.startingWave(3); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPIKES,Moves.SPLASH, Moves.ROAR]); + game.override.moveset([Moves.SPIKES,Moves.SPLASH, Moves.ROAR]); }); it("single - wild - stay on field - no damage", async() => { diff --git a/src/test/moves/spit_up.test.ts b/src/test/moves/spit_up.test.ts index 4b58e9f73a0..9eb114847d2 100644 --- a/src/test/moves/spit_up.test.ts +++ b/src/test/moves/spit_up.test.ts @@ -35,7 +35,7 @@ describe("Moves - Spit Up", () => { game.override.enemyAbility(Abilities.NONE); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP]); + game.override.moveset([Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP]); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); }); diff --git a/src/test/moves/spotlight.test.ts b/src/test/moves/spotlight.test.ts index 5790214ceb1..63b66008235 100644 --- a/src/test/moves/spotlight.test.ts +++ b/src/test/moves/spotlight.test.ts @@ -36,7 +36,7 @@ describe("Moves - Spotlight", () => { game.override.enemySpecies(Species.SNORLAX); game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); + game.override.moveset([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/moves/stockpile.test.ts b/src/test/moves/stockpile.test.ts index 760bbdf7381..30e2bb9d642 100644 --- a/src/test/moves/stockpile.test.ts +++ b/src/test/moves/stockpile.test.ts @@ -35,7 +35,7 @@ describe("Moves - Stockpile", () => { game.override.enemyAbility(Abilities.NONE); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STOCKPILE, Moves.SPLASH]); + game.override.moveset([Moves.STOCKPILE, Moves.SPLASH]); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); }); diff --git a/src/test/moves/swallow.test.ts b/src/test/moves/swallow.test.ts index 70826c02c5d..05ea6678d05 100644 --- a/src/test/moves/swallow.test.ts +++ b/src/test/moves/swallow.test.ts @@ -34,7 +34,7 @@ describe("Moves - Swallow", () => { game.override.enemyAbility(Abilities.NONE); vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW]); + game.override.moveset([Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW]); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); }); diff --git a/src/test/moves/tackle.test.ts b/src/test/moves/tackle.test.ts index 7f58aa8e23b..e58b5d48c8f 100644 --- a/src/test/moves/tackle.test.ts +++ b/src/test/moves/tackle.test.ts @@ -35,7 +35,7 @@ describe("Moves - Tackle", () => { game.override.enemySpecies(Species.MAGIKARP); game.override.startingLevel(1); game.override.startingWave(97); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.GROWTH,Moves.GROWTH,Moves.GROWTH,Moves.GROWTH]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); }); diff --git a/src/test/moves/tail_whip.test.ts b/src/test/moves/tail_whip.test.ts index be1e8614c86..539829f4003 100644 --- a/src/test/moves/tail_whip.test.ts +++ b/src/test/moves/tail_whip.test.ts @@ -1,19 +1,18 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattleStat } from "#app/data/battle-stat"; import { CommandPhase, EnemyCommandPhase, TurnInitPhase, } from "#app/phases"; -import {Mode} from "#app/ui/ui"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {Command} from "#app/ui/command-ui-handler"; -import {BattleStat} from "#app/data/battle-stat"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; +import { Mode } from "#app/ui/ui"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Tail whip", () => { @@ -38,7 +37,7 @@ describe("Moves - Tail whip", () => { game.override.enemyAbility(Abilities.INSOMNIA); game.override.ability(Abilities.INSOMNIA); game.override.startingLevel(2000); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); + game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/moves/tailwind.test.ts b/src/test/moves/tailwind.test.ts index 02924d429f3..d2a90dd2ed5 100644 --- a/src/test/moves/tailwind.test.ts +++ b/src/test/moves/tailwind.test.ts @@ -1,16 +1,15 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { ArenaTagSide } from "#app/data/arena-tag.js"; +import { Stat } from "#app/data/pokemon-stat.js"; +import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { TurnEndPhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; -import { Stat } from "#app/data/pokemon-stat.js"; -import { ArenaTagType } from "#app/enums/arena-tag-type.js"; -import { ArenaTagSide } from "#app/data/arena-tag.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Wind Rider", () => { @@ -30,7 +29,7 @@ describe("Abilities - Wind Rider", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("double"); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); + game.override.moveset([Moves.TAILWIND, Moves.SPLASH, Moves.PETAL_BLIZZARD, Moves.SANDSTORM]); game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/moves/thousand_arrows.test.ts b/src/test/moves/thousand_arrows.test.ts index e0121c6ece2..f4a9db08b8e 100644 --- a/src/test/moves/thousand_arrows.test.ts +++ b/src/test/moves/thousand_arrows.test.ts @@ -34,7 +34,7 @@ describe("Moves - Thousand Arrows", () => { game.override.enemySpecies(Species.TOGETIC); game.override.startingLevel(100); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.THOUSAND_ARROWS ]); + game.override.moveset([ Moves.THOUSAND_ARROWS ]); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); }); diff --git a/src/test/moves/tidy_up.test.ts b/src/test/moves/tidy_up.test.ts index 0fd17baac60..b1292de0d27 100644 --- a/src/test/moves/tidy_up.test.ts +++ b/src/test/moves/tidy_up.test.ts @@ -1,14 +1,13 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattleStat } from "#app/data/battle-stat.js"; +import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { MoveEndPhase, TurnEndPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; -import { ArenaTagType } from "#app/enums/arena-tag-type.js"; -import { BattleStat } from "#app/data/battle-stat.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; @@ -34,12 +33,12 @@ describe("Moves - Tidy Up", () => { game.override.enemyMoveset(SPLASH_ONLY); game.override.starterSpecies(Species.FEEBAS); game.override.ability(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TIDY_UP]); + game.override.moveset([Moves.TIDY_UP]); game.override.startingLevel(50); }); it("spikes are cleared", async() => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPIKES, Moves.TIDY_UP]); + game.override.moveset([Moves.SPIKES, Moves.TIDY_UP]); game.override.enemyMoveset([Moves.SPIKES, Moves.SPIKES, Moves.SPIKES, Moves.SPIKES]); await game.startBattle(); @@ -52,7 +51,7 @@ describe("Moves - Tidy Up", () => { }, 20000); it("stealth rocks are cleared", async() => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STEALTH_ROCK, Moves.TIDY_UP]); + game.override.moveset([Moves.STEALTH_ROCK, Moves.TIDY_UP]); game.override.enemyMoveset([Moves.STEALTH_ROCK, Moves.STEALTH_ROCK, Moves.STEALTH_ROCK, Moves.STEALTH_ROCK]); await game.startBattle(); @@ -65,7 +64,7 @@ describe("Moves - Tidy Up", () => { }, 20000); it("toxic spikes are cleared", async() => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TOXIC_SPIKES, Moves.TIDY_UP]); + game.override.moveset([Moves.TOXIC_SPIKES, Moves.TIDY_UP]); game.override.enemyMoveset([Moves.TOXIC_SPIKES, Moves.TOXIC_SPIKES, Moves.TOXIC_SPIKES, Moves.TOXIC_SPIKES]); await game.startBattle(); @@ -78,7 +77,7 @@ describe("Moves - Tidy Up", () => { }, 20000); it("sticky webs are cleared", async() => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STICKY_WEB, Moves.TIDY_UP]); + game.override.moveset([Moves.STICKY_WEB, Moves.TIDY_UP]); game.override.enemyMoveset([Moves.STICKY_WEB, Moves.STICKY_WEB, Moves.STICKY_WEB, Moves.STICKY_WEB]); await game.startBattle(); @@ -92,7 +91,7 @@ describe("Moves - Tidy Up", () => { }, 20000); it.skip("substitutes are cleared", async() => { - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SUBSTITUTE, Moves.TIDY_UP]); + game.override.moveset([Moves.SUBSTITUTE, Moves.TIDY_UP]); game.override.enemyMoveset([Moves.SUBSTITUTE, Moves.SUBSTITUTE, Moves.SUBSTITUTE, Moves.SUBSTITUTE]); await game.startBattle(); diff --git a/src/test/ui/transfer-item.test.ts b/src/test/ui/transfer-item.test.ts index 9007b1dabe2..3a787fa462d 100644 --- a/src/test/ui/transfer-item.test.ts +++ b/src/test/ui/transfer-item.test.ts @@ -41,7 +41,7 @@ describe("UI - Transfer Items", () => { { name: "BERRY", count: 2, type: BerryType.APICOT }, { name: "BERRY", count: 2, type: BerryType.LUM }, ]); - vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_CLAW]); + game.override.moveset([Moves.DRAGON_CLAW]); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.SPLASH]); From 97376d5c70e54d9edb32da153793f96a6988e30f Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 15:54:48 -0700 Subject: [PATCH 23/42] add OverridesHelper.starterForms --- src/test/utils/overridesHelper.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index 5767cac4914..ad19547b992 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -63,6 +63,20 @@ export class OverridesHelper { return this; } + /** + * Override the player (pokemons) forms + * @param forms the (pokemon) forms to set + * @returns this + */ + starterForms(forms: Partial>): this { + vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue(forms); + const formsStr = Object.entries(forms) + .map(([speciesId, formIndex]) => `${Species[speciesId]}=${formIndex}`) + .join(", "); + this.log(`Player Pokemon form set to: ${formsStr}!`); + return this; + } + /** * Override the player (pokemon) {@linkcode Abilities | ability} * @param ability the (pokemon) {@linkcode Abilities | ability} to set From 4c15fd86b0cf6f566c3f037be038bc141a051d39 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:03:26 -0700 Subject: [PATCH 24/42] apply game.override.starterForms --- src/test/abilities/battle_bond.test.ts | 21 ++++++++++----------- src/test/abilities/disguise.test.ts | 4 ++-- src/test/abilities/ice_face.test.ts | 2 +- src/test/abilities/power_construct.test.ts | 17 ++++++++--------- src/test/abilities/schooling.test.ts | 17 ++++++++--------- src/test/abilities/shields_down.test.ts | 17 ++++++++--------- src/test/abilities/zen_mode.test.ts | 17 ++++++++--------- src/test/abilities/zero_to_hero.test.ts | 17 ++++++++--------- 8 files changed, 53 insertions(+), 59 deletions(-) diff --git a/src/test/abilities/battle_bond.test.ts b/src/test/abilities/battle_bond.test.ts index 2129bcd24e4..ce41f9b6603 100644 --- a/src/test/abilities/battle_bond.test.ts +++ b/src/test/abilities/battle_bond.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; +import { Status, StatusEffect } from "#app/data/status-effect.js"; +import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import GameManager from "#test/utils/gameManager"; import { getMovePosition } from "#test/utils/gameManagerUtils"; -import Overrides from "#app/overrides"; -import { Moves } from "#enums/moves"; -import { Abilities } from "#enums/abilities"; -import { Species } from "#enums/species"; -import { Status, StatusEffect } from "#app/data/status-effect.js"; -import { TurnEndPhase } from "#app/phases.js"; -import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -37,10 +36,10 @@ describe("Abilities - BATTLE BOND", () => { test( "check if fainted pokemon switches to base form on arena reset", async () => { - const baseForm = 1, - ashForm = 2; + const baseForm = 1; + const ashForm = 2; game.override.startingWave(4); - vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ + game.override.starterForms({ [Species.GRENINJA]: ashForm, }); diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index cdc5852e8c7..6a2027a44d6 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -40,7 +40,7 @@ describe("Abilities - DISGUISE", () => { const baseForm = 0, bustedForm = 1; game.override.startingWave(4); - vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ + game.override.starterForms({ [Species.MIMIKYU]: bustedForm, }); @@ -75,7 +75,7 @@ describe("Abilities - DISGUISE", () => { game.override.startingLevel(20); vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(20); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ + game.override.starterForms({ [Species.MIMIKYU]: baseForm, }); diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index 65d9fe1e489..b5dec492721 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -205,7 +205,7 @@ describe("Abilities - Ice Face", () => { game.override.startingWave(4); game.override.startingLevel(4); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ + game.override.starterForms({ [Species.EISCUE]: noiceForm, }); diff --git a/src/test/abilities/power_construct.test.ts b/src/test/abilities/power_construct.test.ts index 4128cf7b5d2..769499c0e53 100644 --- a/src/test/abilities/power_construct.test.ts +++ b/src/test/abilities/power_construct.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; +import { Status, StatusEffect } from "#app/data/status-effect.js"; +import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import GameManager from "#test/utils/gameManager"; import { getMovePosition } from "#test/utils/gameManagerUtils"; -import Overrides from "#app/overrides"; -import { Moves } from "#enums/moves"; -import { Abilities } from "#enums/abilities"; -import { Species } from "#enums/species"; -import { Status, StatusEffect } from "#app/data/status-effect.js"; -import { TurnEndPhase } from "#app/phases.js"; -import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -40,7 +39,7 @@ describe("Abilities - POWER CONSTRUCT", () => { const baseForm = 2, completeForm = 4; game.override.startingWave(4); - vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ + game.override.starterForms({ [Species.ZYGARDE]: completeForm, }); diff --git a/src/test/abilities/schooling.test.ts b/src/test/abilities/schooling.test.ts index 38d8cfd74f2..7671534a549 100644 --- a/src/test/abilities/schooling.test.ts +++ b/src/test/abilities/schooling.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; +import { Status, StatusEffect } from "#app/data/status-effect.js"; +import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import GameManager from "#test/utils/gameManager"; import { getMovePosition } from "#test/utils/gameManagerUtils"; -import Overrides from "#app/overrides"; -import { Moves } from "#enums/moves"; -import { Abilities } from "#enums/abilities"; -import { Species } from "#enums/species"; -import { Status, StatusEffect } from "#app/data/status-effect.js"; -import { TurnEndPhase } from "#app/phases.js"; -import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -40,7 +39,7 @@ describe("Abilities - SCHOOLING", () => { const soloForm = 0, schoolForm = 1; game.override.startingWave(4); - vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ + game.override.starterForms({ [Species.WISHIWASHI]: schoolForm, }); diff --git a/src/test/abilities/shields_down.test.ts b/src/test/abilities/shields_down.test.ts index 1b5582d44a7..64904c80032 100644 --- a/src/test/abilities/shields_down.test.ts +++ b/src/test/abilities/shields_down.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; +import { Status, StatusEffect } from "#app/data/status-effect.js"; +import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import GameManager from "#test/utils/gameManager"; import { getMovePosition } from "#test/utils/gameManagerUtils"; -import Overrides from "#app/overrides"; -import { Moves } from "#enums/moves"; -import { Abilities } from "#enums/abilities"; -import { Species } from "#enums/species"; -import { Status, StatusEffect } from "#app/data/status-effect.js"; -import { TurnEndPhase } from "#app/phases.js"; -import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -40,7 +39,7 @@ describe("Abilities - SHIELDS DOWN", () => { const meteorForm = 0, coreForm = 7; game.override.startingWave(4); - vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ + game.override.starterForms({ [Species.MINIOR]: coreForm, }); diff --git a/src/test/abilities/zen_mode.test.ts b/src/test/abilities/zen_mode.test.ts index dfb96c7d336..8f4c8b42af5 100644 --- a/src/test/abilities/zen_mode.test.ts +++ b/src/test/abilities/zen_mode.test.ts @@ -1,7 +1,6 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { Stat } from "#app/data/pokemon-stat"; +import { Status, StatusEffect } from "#app/data/status-effect.js"; +import { QuietFormChangePhase } from "#app/form-change-phase"; import { CommandPhase, DamagePhase, @@ -14,15 +13,15 @@ import { TurnInitPhase, TurnStartPhase, } from "#app/phases"; -import { Mode } from "#app/ui/ui"; -import { Stat } from "#app/data/pokemon-stat"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Command } from "#app/ui/command-ui-handler"; -import { QuietFormChangePhase } from "#app/form-change-phase"; -import { Status, StatusEffect } from "#app/data/status-effect.js"; +import { Mode } from "#app/ui/ui"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -154,7 +153,7 @@ describe("Abilities - ZEN MODE", () => { const baseForm = 0, zenForm = 1; game.override.startingWave(4); - vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ + game.override.starterForms({ [Species.DARMANITAN]: zenForm, }); diff --git a/src/test/abilities/zero_to_hero.test.ts b/src/test/abilities/zero_to_hero.test.ts index 29e07078dfc..409fb35a78c 100644 --- a/src/test/abilities/zero_to_hero.test.ts +++ b/src/test/abilities/zero_to_hero.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; +import { Status, StatusEffect } from "#app/data/status-effect.js"; +import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import GameManager from "#test/utils/gameManager"; import { getMovePosition } from "#test/utils/gameManagerUtils"; -import Overrides from "#app/overrides"; -import { Moves } from "#enums/moves"; -import { Abilities } from "#enums/abilities"; -import { Species } from "#enums/species"; -import { Status, StatusEffect } from "#app/data/status-effect.js"; -import { TurnEndPhase } from "#app/phases.js"; -import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -40,7 +39,7 @@ describe("Abilities - ZERO TO HERO", () => { const baseForm = 0, heroForm = 1; game.override.startingWave(4); - vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ + game.override.starterForms({ [Species.PALAFIN]: heroForm, }); From a9031a3215e4d6bc25803fbad459a4fb3ad8bd8c Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:04:46 -0700 Subject: [PATCH 25/42] add OverridesHelper.enemyLevel --- src/test/utils/overridesHelper.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index ad19547b992..42600318a0f 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -188,6 +188,17 @@ export class OverridesHelper { return this; } + /** + * Override the enemy (pokemon) level + * @param level the level to set + * @returns this + */ + enemyLevel(level: number): this { + vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(level); + this.log(`Enemy Pokemon level set to ${level}!`); + return this; + } + private log(...params: any[]) { console.log("Overrides:", ...params); } From 5350f3a9f55c500aed74e4f06923617b201ecfd7 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:10:38 -0700 Subject: [PATCH 26/42] apply game.override.enemyLevel --- src/test/abilities/disguise.test.ts | 17 ++++++++--------- src/test/abilities/hustle.test.ts | 4 ++-- src/test/abilities/ice_face.test.ts | 15 +++++++-------- src/test/abilities/parental_bond.test.ts | 2 +- src/test/abilities/quick_draw.test.ts | 17 ++++++++--------- src/test/abilities/sand_veil.test.ts | 17 ++++++++--------- src/test/abilities/sturdy.test.ts | 13 ++++++------- src/test/abilities/unseen_fist.test.ts | 2 +- src/test/arena/arena_gravity.test.ts | 19 +++++++++---------- src/test/items/grip_claw.test.ts | 2 +- src/test/moves/astonish.test.ts | 15 +++++++-------- src/test/moves/aurora_veil.test.ts | 2 +- src/test/moves/ceaseless_edge.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 2 +- src/test/moves/dynamax_cannon.test.ts | 16 ++++++++-------- src/test/moves/fissure.test.ts | 2 +- src/test/moves/flower_shield.test.ts | 2 +- src/test/moves/follow_me.test.ts | 17 ++++++++--------- src/test/moves/gastro_acid.test.ts | 17 ++++++++--------- src/test/moves/light_screen.test.ts | 2 +- src/test/moves/magnet_rise.test.ts | 2 +- src/test/moves/make_it_rain.test.ts | 19 +++++++++---------- src/test/moves/multi_target.test.ts | 2 +- src/test/moves/purify.test.ts | 15 +++++++-------- src/test/moves/rage_powder.test.ts | 13 ++++++------- src/test/moves/reflect.test.ts | 2 +- src/test/moves/rollout.test.ts | 2 +- src/test/moves/roost.test.ts | 19 +++++++++---------- src/test/moves/spit_up.test.ts | 2 +- src/test/moves/spotlight.test.ts | 15 +++++++-------- src/test/moves/swallow.test.ts | 2 +- src/test/moves/thousand_arrows.test.ts | 15 +++++++-------- 32 files changed, 139 insertions(+), 154 deletions(-) diff --git a/src/test/abilities/disguise.test.ts b/src/test/abilities/disguise.test.ts index 6a2027a44d6..3a6fd540d27 100644 --- a/src/test/abilities/disguise.test.ts +++ b/src/test/abilities/disguise.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; +import { Status, StatusEffect } from "#app/data/status-effect.js"; +import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import GameManager from "#test/utils/gameManager"; import { getMovePosition } from "#test/utils/gameManagerUtils"; -import Overrides from "#app/overrides"; -import { Moves } from "#enums/moves"; -import { Abilities } from "#enums/abilities"; -import { Species } from "#enums/species"; -import { Status, StatusEffect } from "#app/data/status-effect.js"; -import { TurnEndPhase } from "#app/phases.js"; -import { QuietFormChangePhase } from "#app/form-change-phase.js"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -73,7 +72,7 @@ describe("Abilities - DISGUISE", () => { game.override.enemyMoveset([Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE, Moves.DARK_PULSE]); game.override.startingLevel(20); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(20); + game.override.enemyLevel(20); game.override.enemySpecies(Species.MAGIKARP); game.override.starterForms({ [Species.MIMIKYU]: baseForm, diff --git a/src/test/abilities/hustle.test.ts b/src/test/abilities/hustle.test.ts index 165169bb66e..c29787705fb 100644 --- a/src/test/abilities/hustle.test.ts +++ b/src/test/abilities/hustle.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Hustle", () => { game.override.moveset([Moves.TACKLE, Moves.GIGA_DRAIN, Moves.FISSURE]); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); + game.override.enemyLevel(5); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); @@ -81,7 +81,7 @@ describe("Abilities - Hustle", () => { it("does not affect OHKO moves", async () => { vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); - vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(30); + game.override.enemyLevel(30); await game.startBattle([Species.PIKACHU]); const pikachu = game.scene.getPlayerPokemon(); diff --git a/src/test/abilities/ice_face.test.ts b/src/test/abilities/ice_face.test.ts index b5dec492721..ed04aa8bac2 100644 --- a/src/test/abilities/ice_face.test.ts +++ b/src/test/abilities/ice_face.test.ts @@ -1,19 +1,18 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { QuietFormChangePhase } from "#app/form-change-phase"; import { MoveEffectPhase, MoveEndPhase, TurnEndPhase, TurnInitPhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { BattlerTagType } from "#enums/battler-tag-type"; -import { QuietFormChangePhase } from "#app/form-change-phase"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Abilities - Ice Face", () => { let phaserGame: Phaser.Game; @@ -55,7 +54,7 @@ describe("Abilities - Ice Face", () => { it("takes no damage from the first hit of multihit physical move and transforms to Noice", async () => { game.override.moveset([Moves.SURGING_STRIKES]); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); + game.override.enemyLevel(1); await game.startBattle([Species.HITMONLEE]); game.doAttack(getMovePosition(game.scene, 0, Moves.SURGING_STRIKES)); diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index 334ab12d46e..d74200edb11 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -38,7 +38,7 @@ describe("Abilities - Parental Bond", () => { game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset(SPLASH_ONLY); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); }); test( diff --git a/src/test/abilities/quick_draw.test.ts b/src/test/abilities/quick_draw.test.ts index 444b6bb2470..e6177639bac 100644 --- a/src/test/abilities/quick_draw.test.ts +++ b/src/test/abilities/quick_draw.test.ts @@ -1,12 +1,11 @@ -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Abilities } from "#enums/abilities"; -import { Species } from "#enums/species"; -import { FaintPhase } from "#app/phases"; -import { Moves } from "#enums/moves"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { allAbilities, BypassSpeedChanceAbAttr } from "#app/data/ability"; +import { FaintPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; describe("Abilities - Quick Draw", () => { @@ -31,7 +30,7 @@ describe("Abilities - Quick Draw", () => { game.override.ability(Abilities.QUICK_DRAW); game.override.moveset([Moves.TACKLE, Moves.TAIL_WHIP]); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(Array(4).fill(Moves.TACKLE)); diff --git a/src/test/abilities/sand_veil.test.ts b/src/test/abilities/sand_veil.test.ts index a43c554dfdd..4394df3ce97 100644 --- a/src/test/abilities/sand_veil.test.ts +++ b/src/test/abilities/sand_veil.test.ts @@ -1,15 +1,14 @@ +import { BattleStatMultiplierAbAttr, allAbilities } from "#app/data/ability.js"; +import { BattleStat } from "#app/data/battle-stat.js"; +import { WeatherType } from "#app/data/weather.js"; +import { CommandPhase, MoveEffectPhase, MoveEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import GameManager from "../utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Abilities } from "#enums/abilities"; -import { Moves } from "#enums/moves"; import { getMovePosition } from "../utils/gameManagerUtils"; -import { CommandPhase, MoveEffectPhase, MoveEndPhase } from "#app/phases.js"; -import { BattleStat } from "#app/data/battle-stat.js"; -import { WeatherType } from "#app/data/weather.js"; -import { BattleStatMultiplierAbAttr, allAbilities } from "#app/data/ability.js"; const TIMEOUT = 20 * 1000; @@ -34,7 +33,7 @@ describe("Abilities - Sand Veil", () => { game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override .weather(WeatherType.SANDSTORM) .battleType("double"); diff --git a/src/test/abilities/sturdy.test.ts b/src/test/abilities/sturdy.test.ts index 33c3de2fb28..9bfb3bd0085 100644 --- a/src/test/abilities/sturdy.test.ts +++ b/src/test/abilities/sturdy.test.ts @@ -1,16 +1,15 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { EnemyPokemon } from "#app/field/pokemon.js"; import { DamagePhase, MoveEndPhase, } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { EnemyPokemon } from "#app/field/pokemon.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -37,7 +36,7 @@ describe("Abilities - Sturdy", () => { game.override.moveset([Moves.CLOSE_COMBAT, Moves.FISSURE]); game.override.enemySpecies(Species.ARON); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); + game.override.enemyLevel(5); game.override.enemyAbility(Abilities.STURDY); }); diff --git a/src/test/abilities/unseen_fist.test.ts b/src/test/abilities/unseen_fist.test.ts index 715236025be..e1e16584bd9 100644 --- a/src/test/abilities/unseen_fist.test.ts +++ b/src/test/abilities/unseen_fist.test.ts @@ -31,7 +31,7 @@ describe("Abilities - Unseen Fist", () => { game.override.enemySpecies(Species.SNORLAX); game.override.enemyMoveset([Moves.PROTECT, Moves.PROTECT, Moves.PROTECT, Moves.PROTECT]); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); }); test( diff --git a/src/test/arena/arena_gravity.test.ts b/src/test/arena/arena_gravity.test.ts index b96b3940245..f89846dd999 100644 --- a/src/test/arena/arena_gravity.test.ts +++ b/src/test/arena/arena_gravity.test.ts @@ -1,17 +1,16 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { allMoves } from "#app/data/move.js"; +import { Abilities } from "#app/enums/abilities.js"; +import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { MoveEffectPhase, TurnEndPhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; -import { allMoves } from "#app/data/move.js"; -import { ArenaTagType } from "#app/enums/arena-tag-type.js"; -import { Abilities } from "#app/enums/abilities.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Arena - Gravity", () => { let phaserGame: Phaser.Game; @@ -59,7 +58,7 @@ describe("Arena - Gravity", () => { it("OHKO move accuracy is not affected", async () => { game.override.startingLevel(5); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); + game.override.enemyLevel(5); /** See Fissure {@link https://bulbapedia.bulbagarden.net/wiki/Fissure_(move)} */ const moveToCheck = allMoves[Moves.FISSURE]; diff --git a/src/test/items/grip_claw.test.ts b/src/test/items/grip_claw.test.ts index edd9c34655c..fdf18454812 100644 --- a/src/test/items/grip_claw.test.ts +++ b/src/test/items/grip_claw.test.ts @@ -41,7 +41,7 @@ describe("Items - Grip Claw", () => { {name: "BERRY", type: BerryType.LUM, count: 2} ]); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); vi.spyOn(allMoves[Moves.POPULATION_BOMB], "accuracy", "get").mockReturnValue(100); }); diff --git a/src/test/moves/astonish.test.ts b/src/test/moves/astonish.test.ts index 66bed1e5333..c8c013026b3 100644 --- a/src/test/moves/astonish.test.ts +++ b/src/test/moves/astonish.test.ts @@ -1,14 +1,13 @@ +import { allMoves } from "#app/data/move.js"; +import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { BerryPhase, CommandPhase, MoveEndPhase, TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import GameManager from "../utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Abilities } from "#enums/abilities"; -import { Moves } from "#enums/moves"; import { getMovePosition } from "../utils/gameManagerUtils"; -import { BerryPhase, CommandPhase, MoveEndPhase, TurnEndPhase } from "#app/phases.js"; -import { BattlerTagType } from "#app/enums/battler-tag-type.js"; -import { allMoves } from "#app/data/move.js"; const TIMEOUT = 20 * 1000; @@ -34,7 +33,7 @@ describe("Moves - Astonish", () => { game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); vi.spyOn(allMoves[Moves.ASTONISH], "chance", "get").mockReturnValue(100); }); diff --git a/src/test/moves/aurora_veil.test.ts b/src/test/moves/aurora_veil.test.ts index 4f5022db4ae..fe256bc1777 100644 --- a/src/test/moves/aurora_veil.test.ts +++ b/src/test/moves/aurora_veil.test.ts @@ -38,7 +38,7 @@ describe("Moves - Aurora Veil", () => { game.override.battleType("single"); game.override.ability(Abilities.NONE); game.override.moveset([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index 5998f67549c..54a0a0da099 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -37,7 +37,7 @@ describe("Moves - Ceaseless Edge", () => { game.override.enemyAbility(Abilities.RUN_AWAY); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.moveset([ Moves.CEASELESS_EDGE, Moves.SPLASH, Moves.ROAR ]); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); vi.spyOn(allMoves[Moves.CEASELESS_EDGE], "accuracy", "get").mockReturnValue(100); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index 330b8ab22a4..e0873a215f8 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -48,7 +48,7 @@ describe("Moves - Dragon Rage", () => { game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.BALL_FETCH); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); await game.startBattle(); diff --git a/src/test/moves/dynamax_cannon.test.ts b/src/test/moves/dynamax_cannon.test.ts index 3e1ba2f609e..a0747f21ffe 100644 --- a/src/test/moves/dynamax_cannon.test.ts +++ b/src/test/moves/dynamax_cannon.test.ts @@ -43,7 +43,7 @@ describe("Moves - Dynamax Cannon", () => { }); it("should return 100 power against an enemy below level cap", async() => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); + game.override.enemyLevel(1); await game.startBattle([ Species.ETERNATUS, ]); @@ -57,7 +57,7 @@ describe("Moves - Dynamax Cannon", () => { }, 20000); it("should return 100 power against an enemy at level cap", async() => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(10); + game.override.enemyLevel(10); await game.startBattle([ Species.ETERNATUS, ]); @@ -71,7 +71,7 @@ describe("Moves - Dynamax Cannon", () => { }, 20000); it("should return 120 power against an enemy 1% above level cap", async() => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(101); + game.override.enemyLevel(101); await game.startBattle([ Species.ETERNATUS, ]); @@ -88,7 +88,7 @@ describe("Moves - Dynamax Cannon", () => { }, 20000); it("should return 140 power against an enemy 2% above level capp", async() => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(102); + game.override.enemyLevel(102); await game.startBattle([ Species.ETERNATUS, ]); @@ -105,7 +105,7 @@ describe("Moves - Dynamax Cannon", () => { }, 20000); it("should return 160 power against an enemy 3% above level cap", async() => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(103); + game.override.enemyLevel(103); await game.startBattle([ Species.ETERNATUS, ]); @@ -122,7 +122,7 @@ describe("Moves - Dynamax Cannon", () => { }, 20000); it("should return 180 power against an enemy 4% above level cap", async() => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(104); + game.override.enemyLevel(104); await game.startBattle([ Species.ETERNATUS, ]); @@ -139,7 +139,7 @@ describe("Moves - Dynamax Cannon", () => { }, 20000); it("should return 200 power against an enemy 5% above level cap", async() => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(105); + game.override.enemyLevel(105); await game.startBattle([ Species.ETERNATUS, ]); @@ -156,7 +156,7 @@ describe("Moves - Dynamax Cannon", () => { }, 20000); it("should return 200 power against an enemy way above level cap", async() => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(999); + game.override.enemyLevel(999); await game.startBattle([ Species.ETERNATUS, ]); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index cfc5c2b76f7..b68f31a8823 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -41,7 +41,7 @@ describe("Moves - Fissure", () => { game.override.enemySpecies(Species.SNORLAX); game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); await game.startBattle(); diff --git a/src/test/moves/flower_shield.test.ts b/src/test/moves/flower_shield.test.ts index fb6708726e5..25394992b6d 100644 --- a/src/test/moves/flower_shield.test.ts +++ b/src/test/moves/flower_shield.test.ts @@ -83,7 +83,7 @@ describe("Moves - Flower Shield", () => { it("does not increase defense of a pokemon in semi-vulnerable state", async () => { game.override.enemySpecies(Species.PARAS); game.override.enemyMoveset([Moves.DIG, Moves.DIG, Moves.DIG, Moves.DIG]); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(50); + game.override.enemyLevel(50); await game.startBattle([Species.CHERRIM]); const paras = game.scene.getEnemyPokemon(); diff --git a/src/test/moves/follow_me.test.ts b/src/test/moves/follow_me.test.ts index 5ee4ee02ba2..eb41bf55a02 100644 --- a/src/test/moves/follow_me.test.ts +++ b/src/test/moves/follow_me.test.ts @@ -1,18 +1,17 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattlerIndex } from "#app/battle.js"; +import { Stat } from "#app/data/pokemon-stat"; +import { Abilities } from "#app/enums/abilities.js"; import { CommandPhase, SelectTargetPhase, TurnEndPhase, } from "#app/phases"; -import {Stat} from "#app/data/pokemon-stat"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { BattlerIndex } from "#app/battle.js"; -import { Abilities } from "#app/enums/abilities.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -36,7 +35,7 @@ describe("Moves - Follow Me", () => { game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.moveset([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/moves/gastro_acid.test.ts b/src/test/moves/gastro_acid.test.ts index 35bb345c756..0ffa8d9180b 100644 --- a/src/test/moves/gastro_acid.test.ts +++ b/src/test/moves/gastro_acid.test.ts @@ -1,15 +1,14 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import GameManager from "../utils/gameManager"; +import { BattlerIndex } from "#app/battle.js"; +import { Stat } from "#app/data/pokemon-stat.js"; +import { Abilities } from "#app/enums/abilities.js"; import { Moves } from "#app/enums/moves.js"; -import Overrides from "#app/overrides"; -import { Abilities } from "#app/enums/abilities.js"; -import { BattlerIndex } from "#app/battle.js"; -import { getMovePosition } from "../utils/gameManagerUtils"; -import { MoveResult } from "#app/field/pokemon.js"; -import { Stat } from "#app/data/pokemon-stat.js"; import { Species } from "#app/enums/species.js"; +import { MoveResult } from "#app/field/pokemon.js"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; +import GameManager from "../utils/gameManager"; +import { getMovePosition } from "../utils/gameManagerUtils"; import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -32,7 +31,7 @@ describe("Moves - Gastro Acid", () => { game = new GameManager(phaserGame); game.override.battleType("double"); game.override.startingLevel(1); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.ability(Abilities.NONE); game.override.moveset([Moves.GASTRO_ACID, Moves.WATER_GUN, Moves.SPLASH, Moves.CORE_ENFORCER]); game.override.enemySpecies(Species.BIDOOF); diff --git a/src/test/moves/light_screen.test.ts b/src/test/moves/light_screen.test.ts index d06e0b7804f..18bae6993b8 100644 --- a/src/test/moves/light_screen.test.ts +++ b/src/test/moves/light_screen.test.ts @@ -37,7 +37,7 @@ describe("Moves - Light Screen", () => { game.override.battleType("single"); game.override.ability(Abilities.NONE); game.override.moveset([Moves.ABSORB, Moves.DAZZLING_GLEAM, Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/moves/magnet_rise.test.ts b/src/test/moves/magnet_rise.test.ts index de87ae81a79..9986921e0d5 100644 --- a/src/test/moves/magnet_rise.test.ts +++ b/src/test/moves/magnet_rise.test.ts @@ -28,7 +28,7 @@ describe("Moves - Magnet Rise", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); + game.override.enemyLevel(1); game.override.moveset([moveToUse, Moves.SPLASH, Moves.GRAVITY, Moves.BATON_PASS]); }); diff --git a/src/test/moves/make_it_rain.test.ts b/src/test/moves/make_it_rain.test.ts index 7d431b60a27..83543c4e530 100644 --- a/src/test/moves/make_it_rain.test.ts +++ b/src/test/moves/make_it_rain.test.ts @@ -1,17 +1,16 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { BattleStat } from "#app/data/battle-stat.js"; import { CommandPhase, MoveEndPhase, StatChangePhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { BattleStat } from "#app/data/battle-stat.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -38,7 +37,7 @@ describe("Moves - Make It Rain", () => { game.override.enemyAbility(Abilities.INSOMNIA); game.override.enemyMoveset(SPLASH_ONLY); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); }); it("should only reduce Sp. Atk. once in a double battle", async () => { @@ -63,7 +62,7 @@ describe("Moves - Make It Rain", () => { }, TIMEOUT); it("should apply effects even if the target faints", async () => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); // ensures the enemy will faint + game.override.enemyLevel(1); // ensures the enemy will faint game.override.battleType("single"); await game.startBattle([Species.CHARIZARD]); @@ -83,7 +82,7 @@ describe("Moves - Make It Rain", () => { }, TIMEOUT); it("should reduce Sp. Atk. once after KOing two enemies", async () => { - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); // ensures the enemy will faint + game.override.enemyLevel(1); // ensures the enemy will faint await game.startBattle([Species.CHARIZARD, Species.BLASTOISE]); diff --git a/src/test/moves/multi_target.test.ts b/src/test/moves/multi_target.test.ts index 229732fe0ac..a67ee11eb31 100644 --- a/src/test/moves/multi_target.test.ts +++ b/src/test/moves/multi_target.test.ts @@ -171,7 +171,7 @@ function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) { game.override.enemyMoveset(SPLASH_ONLY); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.startingLevel(50); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(40); + game.override.enemyLevel(40); game.override.enemySpecies(Species.EEVEE); return game; } diff --git a/src/test/moves/purify.test.ts b/src/test/moves/purify.test.ts index 513f3f891ee..cbc107a3def 100644 --- a/src/test/moves/purify.test.ts +++ b/src/test/moves/purify.test.ts @@ -1,15 +1,14 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { Status, StatusEffect } from "#app/data/status-effect.js"; +import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon.js"; import { MoveEndPhase, } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon.js"; -import { Status, StatusEffect } from "#app/data/status-effect.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -36,7 +35,7 @@ describe("Moves - Purify", () => { game.override.moveset([Moves.PURIFY, Moves.SIZZLY_SLIDE]); game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(10); + game.override.enemyLevel(10); game.override.enemyMoveset([Moves.SPLASH, Moves.NONE, Moves.NONE, Moves.NONE]); }); diff --git a/src/test/moves/rage_powder.test.ts b/src/test/moves/rage_powder.test.ts index 60c0897c102..bc533e1313e 100644 --- a/src/test/moves/rage_powder.test.ts +++ b/src/test/moves/rage_powder.test.ts @@ -1,17 +1,16 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattlerIndex } from "#app/battle.js"; import { CommandPhase, SelectTargetPhase, TurnEndPhase, } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { BattlerIndex } from "#app/battle.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -35,7 +34,7 @@ describe("Moves - Rage Powder", () => { game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.moveset([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/moves/reflect.test.ts b/src/test/moves/reflect.test.ts index 3ee78d3d6d1..7365ab01cd8 100644 --- a/src/test/moves/reflect.test.ts +++ b/src/test/moves/reflect.test.ts @@ -37,7 +37,7 @@ describe("Moves - Reflect", () => { game.override.battleType("single"); game.override.ability(Abilities.NONE); game.override.moveset([Moves.ABSORB, Moves.ROCK_SLIDE, Moves.TACKLE]); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.REFLECT, Moves.REFLECT, Moves.REFLECT, Moves.REFLECT]); vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index d2520c91180..3e79005de61 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -33,7 +33,7 @@ describe("Moves - Rollout", () => { game.override.enemySpecies(Species.BIDOOF); game.override.enemyAbility(Abilities.NONE); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.enemyMoveset(SPLASH_ONLY); }); diff --git a/src/test/moves/roost.test.ts b/src/test/moves/roost.test.ts index 3802cdbb6ee..fe89a0a0a10 100644 --- a/src/test/moves/roost.test.ts +++ b/src/test/moves/roost.test.ts @@ -1,13 +1,12 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#app/enums/species.js"; -import { Moves } from "#app/enums/moves.js"; -import { getMovePosition } from "../utils/gameManagerUtils"; -import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; -import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import { Abilities } from "#app/enums/abilities.js"; +import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { Moves } from "#app/enums/moves.js"; +import { Species } from "#app/enums/species.js"; +import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; +import GameManager from "#app/test/utils/gameManager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; +import { getMovePosition } from "../utils/gameManagerUtils"; const TIMEOUT = 20 * 1000; @@ -31,7 +30,7 @@ describe("Moves - Roost", () => { game.override.enemySpecies(Species.STARAPTOR); game.override.enemyAbility(Abilities.INSOMNIA); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.moveset([ Moves.STOMPING_TANTRUM ]); game.override.enemyMoveset([Moves.ROOST,Moves.ROOST,Moves.ROOST,Moves.ROOST]); }); diff --git a/src/test/moves/spit_up.test.ts b/src/test/moves/spit_up.test.ts index 9eb114847d2..0d637f05355 100644 --- a/src/test/moves/spit_up.test.ts +++ b/src/test/moves/spit_up.test.ts @@ -33,7 +33,7 @@ describe("Moves - Spit Up", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.NONE); - vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.enemyLevel(2000); game.override.moveset([Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP]); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); diff --git a/src/test/moves/spotlight.test.ts b/src/test/moves/spotlight.test.ts index 63b66008235..8170c42dfec 100644 --- a/src/test/moves/spotlight.test.ts +++ b/src/test/moves/spotlight.test.ts @@ -1,17 +1,16 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattlerIndex } from "#app/battle.js"; +import { Stat } from "#app/data/pokemon-stat"; import { CommandPhase, SelectTargetPhase, TurnEndPhase, } from "#app/phases"; -import {Stat} from "#app/data/pokemon-stat"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { BattlerIndex } from "#app/battle.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; const TIMEOUT = 20 * 1000; @@ -35,7 +34,7 @@ describe("Moves - Spotlight", () => { game.override.starterSpecies(Species.AMOONGUSS); game.override.enemySpecies(Species.SNORLAX); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.moveset([ Moves.FOLLOW_ME, Moves.RAGE_POWDER, Moves.SPOTLIGHT, Moves.QUICK_ATTACK ]); game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); }); diff --git a/src/test/moves/swallow.test.ts b/src/test/moves/swallow.test.ts index 05ea6678d05..28f6b73ee7d 100644 --- a/src/test/moves/swallow.test.ts +++ b/src/test/moves/swallow.test.ts @@ -32,7 +32,7 @@ describe("Moves - Swallow", () => { game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.NONE); - vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.enemyLevel(2000); game.override.moveset([Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW]); vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); diff --git a/src/test/moves/thousand_arrows.test.ts b/src/test/moves/thousand_arrows.test.ts index f4a9db08b8e..a7fbee3bebd 100644 --- a/src/test/moves/thousand_arrows.test.ts +++ b/src/test/moves/thousand_arrows.test.ts @@ -1,16 +1,15 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { Abilities } from "#app/enums/abilities.js"; +import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import { BerryPhase, MoveEffectPhase } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { BattlerTagType } from "#app/enums/battler-tag-type.js"; -import { Abilities } from "#app/enums/abilities.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; const TIMEOUT = 20 * 1000; @@ -33,7 +32,7 @@ describe("Moves - Thousand Arrows", () => { game.override.battleType("single"); game.override.enemySpecies(Species.TOGETIC); game.override.startingLevel(100); - vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.enemyLevel(100); game.override.moveset([ Moves.THOUSAND_ARROWS ]); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); }); From e8859d2b62eb6ecb66d994366e6f9d17998e52e1 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:12:00 -0700 Subject: [PATCH 27/42] apply missing game.override.ability --- src/test/abilities/hustle.test.ts | 2 +- src/test/items/leftovers.test.ts | 2 +- src/test/moves/hyper_beam.test.ts | 19 +++++++++---------- src/test/moves/spit_up.test.ts | 19 +++++++++---------- src/test/moves/stockpile.test.ts | 2 +- src/test/moves/swallow.test.ts | 17 ++++++++--------- 6 files changed, 29 insertions(+), 32 deletions(-) diff --git a/src/test/abilities/hustle.test.ts b/src/test/abilities/hustle.test.ts index c29787705fb..a99415d6954 100644 --- a/src/test/abilities/hustle.test.ts +++ b/src/test/abilities/hustle.test.ts @@ -27,7 +27,7 @@ describe("Abilities - Hustle", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HUSTLE); + game.override.ability(Abilities.HUSTLE); game.override.moveset([Moves.TACKLE, Moves.GIGA_DRAIN, Moves.FISSURE]); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); diff --git a/src/test/items/leftovers.test.ts b/src/test/items/leftovers.test.ts index 7c89e1e299d..aff1596ad9e 100644 --- a/src/test/items/leftovers.test.ts +++ b/src/test/items/leftovers.test.ts @@ -27,7 +27,7 @@ describe("Items - Leftovers", () => { game = new GameManager(phaserGame); game.override.battleType("single"); vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); - vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); + game.override.ability(Abilities.UNNERVE); game.override.moveset([Moves.SPLASH]); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.UNNERVE); diff --git a/src/test/moves/hyper_beam.test.ts b/src/test/moves/hyper_beam.test.ts index 4cd9d0600a8..623b24dbb3c 100644 --- a/src/test/moves/hyper_beam.test.ts +++ b/src/test/moves/hyper_beam.test.ts @@ -1,14 +1,13 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import overrides from "#app/overrides"; -import { Abilities } from "#app/enums/abilities.js"; -import { Species } from "#app/enums/species.js"; -import { Moves } from "#app/enums/moves.js"; import { allMoves } from "#app/data/move.js"; -import { getMovePosition } from "../utils/gameManagerUtils"; -import { BerryPhase, TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#app/enums/abilities.js"; import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { Moves } from "#app/enums/moves.js"; +import { Species } from "#app/enums/species.js"; +import { BerryPhase, TurnEndPhase } from "#app/phases.js"; +import GameManager from "#app/test/utils/gameManager"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { getMovePosition } from "../utils/gameManagerUtils"; const TIMEOUT = 20 * 1000; // 20 sec timeout for all tests @@ -30,7 +29,7 @@ describe("Moves - Hyper Beam", () => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(Array(4).fill(Moves.SPLASH)); diff --git a/src/test/moves/spit_up.test.ts b/src/test/moves/spit_up.test.ts index 0d637f05355..0fc01821838 100644 --- a/src/test/moves/spit_up.test.ts +++ b/src/test/moves/spit_up.test.ts @@ -1,16 +1,15 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import overrides from "#app/overrides"; -import { MovePhase, TurnInitPhase } from "#app/phases"; import { BattleStat } from "#app/data/battle-stat"; +import { StockpilingTag } from "#app/data/battler-tags.js"; +import { allMoves } from "#app/data/move.js"; +import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { MoveResult, TurnMove } from "#app/field/pokemon.js"; +import { MovePhase, TurnInitPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { StockpilingTag } from "#app/data/battler-tags.js"; -import { MoveResult, TurnMove } from "#app/field/pokemon.js"; -import { BattlerTagType } from "#app/enums/battler-tag-type.js"; -import { allMoves } from "#app/data/move.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Spit Up", () => { @@ -36,7 +35,7 @@ describe("Moves - Spit Up", () => { game.override.enemyLevel(2000); game.override.moveset([Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP, Moves.SPIT_UP]); - vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); }); describe("consumes all stockpile stacks to deal damage (scaling with stacks)", () => { diff --git a/src/test/moves/stockpile.test.ts b/src/test/moves/stockpile.test.ts index 30e2bb9d642..9157cf247be 100644 --- a/src/test/moves/stockpile.test.ts +++ b/src/test/moves/stockpile.test.ts @@ -36,7 +36,7 @@ describe("Moves - Stockpile", () => { vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.moveset([Moves.STOCKPILE, Moves.SPLASH]); - vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); }); it("Gains a stockpile stack and increases DEF and SPDEF by 1 on each use, fails at max stacks (3)", { timeout: 10000 }, async () => { diff --git a/src/test/moves/swallow.test.ts b/src/test/moves/swallow.test.ts index 28f6b73ee7d..7c3d3ae1613 100644 --- a/src/test/moves/swallow.test.ts +++ b/src/test/moves/swallow.test.ts @@ -1,15 +1,14 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import overrides from "#app/overrides"; -import { MovePhase, TurnInitPhase } from "#app/phases"; import { BattleStat } from "#app/data/battle-stat"; +import { StockpilingTag } from "#app/data/battler-tags.js"; +import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { MoveResult, TurnMove } from "#app/field/pokemon.js"; +import { MovePhase, TurnInitPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { StockpilingTag } from "#app/data/battler-tags.js"; -import { MoveResult, TurnMove } from "#app/field/pokemon.js"; -import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Swallow", () => { @@ -35,7 +34,7 @@ describe("Moves - Swallow", () => { game.override.enemyLevel(2000); game.override.moveset([Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW, Moves.SWALLOW]); - vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); + game.override.ability(Abilities.NONE); }); describe("consumes all stockpile stacks to heal (scaling with stacks)", () => { From a025e30200329850fee8185915a6f9927c114ceb Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:12:56 -0700 Subject: [PATCH 28/42] apply missing game.override.startingLevel --- src/test/abilities/hustle.test.ts | 4 ++-- src/test/items/leftovers.test.ts | 2 +- src/test/moves/stockpile.test.ts | 17 ++++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/test/abilities/hustle.test.ts b/src/test/abilities/hustle.test.ts index a99415d6954..5a9bfe88be6 100644 --- a/src/test/abilities/hustle.test.ts +++ b/src/test/abilities/hustle.test.ts @@ -29,7 +29,7 @@ describe("Abilities - Hustle", () => { game = new GameManager(phaserGame); game.override.ability(Abilities.HUSTLE); game.override.moveset([Moves.TACKLE, Moves.GIGA_DRAIN, Moves.FISSURE]); - vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(5); + game.override.startingLevel(5); vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.enemyLevel(5); game.override.enemyMoveset(SPLASH_ONLY); @@ -80,7 +80,7 @@ describe("Abilities - Hustle", () => { }); it("does not affect OHKO moves", async () => { - vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); + game.override.startingLevel(100); game.override.enemyLevel(30); await game.startBattle([Species.PIKACHU]); diff --git a/src/test/items/leftovers.test.ts b/src/test/items/leftovers.test.ts index aff1596ad9e..ad7cb6b07e6 100644 --- a/src/test/items/leftovers.test.ts +++ b/src/test/items/leftovers.test.ts @@ -26,7 +26,7 @@ describe("Items - Leftovers", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); game.override.ability(Abilities.UNNERVE); game.override.moveset([Moves.SPLASH]); game.override.enemySpecies(Species.SHUCKLE); diff --git a/src/test/moves/stockpile.test.ts b/src/test/moves/stockpile.test.ts index 9157cf247be..81bd65ce582 100644 --- a/src/test/moves/stockpile.test.ts +++ b/src/test/moves/stockpile.test.ts @@ -1,15 +1,14 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import overrides from "#app/overrides"; -import { CommandPhase, TurnInitPhase } from "#app/phases"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { BattleStat } from "#app/data/battle-stat"; +import { StockpilingTag } from "#app/data/battler-tags.js"; +import { MoveResult, TurnMove } from "#app/field/pokemon.js"; +import { CommandPhase, TurnInitPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { StockpilingTag } from "#app/data/battler-tags.js"; -import { MoveResult, TurnMove } from "#app/field/pokemon.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Stockpile", () => { @@ -34,7 +33,7 @@ describe("Moves - Stockpile", () => { game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.NONE); - vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); + game.override.startingLevel(2000); game.override.moveset([Moves.STOCKPILE, Moves.SPLASH]); game.override.ability(Abilities.NONE); }); From a87aec4f279fa0b181aeda00e46a568d44f5864e Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:15:06 -0700 Subject: [PATCH 29/42] add OverridesHelper.disableCrits() --- src/test/utils/overridesHelper.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index 42600318a0f..caaef1a2c0e 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -101,18 +101,27 @@ export class OverridesHelper { } /** - * Override each wave to have or not have standard trainer battles + * Override each wave to not have standard trainer battles * @returns this - * @param disable true */ - disableTrainerWaves(disable: boolean): this { + disableTrainerWaves(): this { const realFn = getGameMode; vi.spyOn(GameMode, "getGameMode").mockImplementation((gameMode: GameModes) => { const mode = realFn(gameMode); - mode.hasTrainers = !disable; + mode.hasTrainers = false; return mode; }); - this.log(`Standard trainer waves are ${disable ? "disabled" : "enabled"}!`); + this.log("Standard trainer waves are disabled!"); + return this; + } + + /** + * Override each wave to not have critical hits + * @returns this + */ + disableCrits() { + vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + this.log("Critical hits are disabled!"); return this; } From 6d14915f5f35159748d347ee07d553f20c886b0e Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:18:47 -0700 Subject: [PATCH 30/42] apply game.override.disableCrits() --- src/test/abilities/dry_skin.test.ts | 13 ++++++------ src/test/abilities/hustle.test.ts | 19 +++++++++--------- src/test/abilities/parental_bond.test.ts | 2 +- src/test/abilities/sap_sipper.test.ts | 15 +++++++------- src/test/abilities/volt_absorb.test.ts | 13 ++++++------ src/test/items/leek.test.ts | 2 +- src/test/items/scope_lens.test.ts | 2 +- src/test/moves/aurora_veil.test.ts | 25 ++++++++++++------------ src/test/moves/double_team.test.ts | 17 ++++++++-------- src/test/moves/dragon_rage.test.ts | 2 +- src/test/moves/dynamax_cannon.test.ts | 15 +++++++------- src/test/moves/fissure.test.ts | 2 +- src/test/moves/glaive_rush.test.ts | 2 +- src/test/moves/light_screen.test.ts | 23 +++++++++++----------- src/test/moves/magnet_rise.test.ts | 13 ++++++------ src/test/moves/multi_target.test.ts | 13 ++++++------ src/test/moves/reflect.test.ts | 23 +++++++++++----------- src/test/moves/rollout.test.ts | 3 +-- src/test/moves/tackle.test.ts | 17 ++++++++-------- 19 files changed, 104 insertions(+), 117 deletions(-) diff --git a/src/test/abilities/dry_skin.test.ts b/src/test/abilities/dry_skin.test.ts index 135acbf88f7..5434974c583 100644 --- a/src/test/abilities/dry_skin.test.ts +++ b/src/test/abilities/dry_skin.test.ts @@ -1,12 +1,11 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { Species } from "#app/enums/species.js"; import { TurnEndPhase } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { Species } from "#app/enums/species.js"; +import { Moves } from "#enums/moves"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Dry Skin", () => { @@ -26,7 +25,7 @@ describe("Abilities - Dry Skin", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.enemyAbility(Abilities.DRY_SKIN); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemySpecies(Species.CHARMANDER); diff --git a/src/test/abilities/hustle.test.ts b/src/test/abilities/hustle.test.ts index 5a9bfe88be6..6d78846071d 100644 --- a/src/test/abilities/hustle.test.ts +++ b/src/test/abilities/hustle.test.ts @@ -1,14 +1,13 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Moves } from "#enums/moves"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; -import { DamagePhase, MoveEffectPhase } from "#app/phases.js"; +import { allMoves } from "#app/data/move.js"; import { Abilities } from "#app/enums/abilities.js"; import { Stat } from "#app/enums/stat.js"; -import { allMoves } from "#app/data/move.js"; +import { DamagePhase, MoveEffectPhase } from "#app/phases.js"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Abilities - Hustle", () => { @@ -30,7 +29,7 @@ describe("Abilities - Hustle", () => { game.override.ability(Abilities.HUSTLE); game.override.moveset([Moves.TACKLE, Moves.GIGA_DRAIN, Moves.FISSURE]); game.override.startingLevel(5); - vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.enemyLevel(5); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemySpecies(Species.SHUCKLE); diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index d74200edb11..843d8a8c3e8 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -32,7 +32,7 @@ describe("Abilities - Parental Bond", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.ability(Abilities.PARENTAL_BOND); game.override.enemySpecies(Species.SNORLAX); game.override.enemyAbility(Abilities.INSOMNIA); diff --git a/src/test/abilities/sap_sipper.test.ts b/src/test/abilities/sap_sipper.test.ts index 57848de61a7..2ed1df05652 100644 --- a/src/test/abilities/sap_sipper.test.ts +++ b/src/test/abilities/sap_sipper.test.ts @@ -1,17 +1,16 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattleStat } from "#app/data/battle-stat.js"; +import { TerrainType } from "#app/data/terrain.js"; import { MoveEndPhase, TurnEndPhase, } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import { BattleStat } from "#app/data/battle-stat.js"; -import { TerrainType } from "#app/data/terrain.js"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { BattlerTagType } from "#enums/battler-tag-type"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; // See also: TypeImmunityAbAttr describe("Abilities - Sap Sipper", () => { @@ -31,7 +30,7 @@ describe("Abilities - Sap Sipper", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); }); it("raise attack 1 level and block effects when activated against a grass attack", async() => { diff --git a/src/test/abilities/volt_absorb.test.ts b/src/test/abilities/volt_absorb.test.ts index b1bf638fc77..419c3a612d5 100644 --- a/src/test/abilities/volt_absorb.test.ts +++ b/src/test/abilities/volt_absorb.test.ts @@ -1,16 +1,15 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { BattleStat } from "#app/data/battle-stat.js"; import { TurnEndPhase, } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import { BattleStat } from "#app/data/battle-stat.js"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { BattlerTagType } from "#enums/battler-tag-type"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; // See also: TypeImmunityAbAttr describe("Abilities - Volt Absorb", () => { @@ -30,7 +29,7 @@ describe("Abilities - Volt Absorb", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); }); it("does not activate when CHARGE is used", async () => { diff --git a/src/test/items/leek.test.ts b/src/test/items/leek.test.ts index 5dfd75d6cb5..bee60f3303b 100644 --- a/src/test/items/leek.test.ts +++ b/src/test/items/leek.test.ts @@ -29,7 +29,7 @@ describe("Items - Leek", () => { game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.battleType("single"); }); diff --git a/src/test/items/scope_lens.test.ts b/src/test/items/scope_lens.test.ts index d0e556fab79..b1c34b8d042 100644 --- a/src/test/items/scope_lens.test.ts +++ b/src/test/items/scope_lens.test.ts @@ -29,7 +29,7 @@ describe("Items - Scope Lens", () => { game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.battleType("single"); }, 20000); diff --git a/src/test/moves/aurora_veil.test.ts b/src/test/moves/aurora_veil.test.ts index fe256bc1777..80da8087576 100644 --- a/src/test/moves/aurora_veil.test.ts +++ b/src/test/moves/aurora_veil.test.ts @@ -1,20 +1,19 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { ArenaTagSide } from "#app/data/arena-tag.js"; +import Move, { allMoves } from "#app/data/move.js"; +import { WeatherType } from "#app/data/weather.js"; +import { Abilities } from "#app/enums/abilities.js"; +import { ArenaTagType } from "#app/enums/arena-tag-type.js"; +import Pokemon from "#app/field/pokemon.js"; import { TurnEndPhase, } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { NumberHolder } from "#app/utils.js"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { Abilities } from "#app/enums/abilities.js"; -import Pokemon from "#app/field/pokemon.js"; -import Move, { allMoves } from "#app/data/move.js"; -import { NumberHolder } from "#app/utils.js"; -import { ArenaTagSide } from "#app/data/arena-tag.js"; -import { WeatherType } from "#app/data/weather.js"; -import { ArenaTagType } from "#app/enums/arena-tag-type.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Aurora Veil", () => { @@ -41,7 +40,7 @@ describe("Moves - Aurora Veil", () => { game.override.enemyLevel(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL, Moves.AURORA_VEIL]); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.weather(WeatherType.HAIL); }); diff --git a/src/test/moves/double_team.test.ts b/src/test/moves/double_team.test.ts index 2c42e1651ba..55820ee957b 100644 --- a/src/test/moves/double_team.test.ts +++ b/src/test/moves/double_team.test.ts @@ -1,15 +1,14 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { BattleStat } from "#app/data/battle-stat.js"; +import { Abilities } from "#app/enums/abilities.js"; import { TurnEndPhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; -import { BattleStat } from "#app/data/battle-stat.js"; -import { Abilities } from "#app/enums/abilities.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Moves - Double Team", () => { let phaserGame: Phaser.Game; @@ -29,7 +28,7 @@ describe("Moves - Double Team", () => { game = new GameManager(phaserGame); game.override.battleType("single"); game.override.moveset([Moves.DOUBLE_TEAM]); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.ability(Abilities.BALL_FETCH); game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.BALL_FETCH); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index e0873a215f8..a9637248e68 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -36,7 +36,7 @@ describe("Moves - Dragon Rage", () => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.starterSpecies(Species.SNORLAX); game.override.moveset([Moves.DRAGON_RAGE]); diff --git a/src/test/moves/dynamax_cannon.test.ts b/src/test/moves/dynamax_cannon.test.ts index a0747f21ffe..4c010484c78 100644 --- a/src/test/moves/dynamax_cannon.test.ts +++ b/src/test/moves/dynamax_cannon.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { MoveEffectPhase, DamagePhase, TurnStartPhase } from "#app/phases"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { BattlerIndex } from "#app/battle"; import { allMoves } from "#app/data/move"; +import { DamagePhase, MoveEffectPhase, TurnStartPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { BattlerIndex } from "#app/battle"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Moves - Dynamax Cannon", () => { let phaserGame: Phaser.Game; @@ -34,7 +33,7 @@ describe("Moves - Dynamax Cannon", () => { // Note that, for Waves 1-10, the level cap is 10 game.override.startingWave(1); game.override.battleType("single"); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index b68f31a8823..73713f93f14 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -31,7 +31,7 @@ describe("Moves - Fissure", () => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.starterSpecies(Species.SNORLAX); game.override.moveset([Moves.FISSURE]); diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index 42265568cc6..937573ded15 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -27,7 +27,7 @@ describe("Moves - Glaive Rush", () => { beforeEach(() => { game = new GameManager(phaserGame); game.override.battleType("single"); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH); game.override.enemyMoveset(Array(4).fill(Moves.GLAIVE_RUSH)); diff --git a/src/test/moves/light_screen.test.ts b/src/test/moves/light_screen.test.ts index 18bae6993b8..52c1b85fa7a 100644 --- a/src/test/moves/light_screen.test.ts +++ b/src/test/moves/light_screen.test.ts @@ -1,19 +1,18 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { ArenaTagSide } from "#app/data/arena-tag.js"; +import Move, { allMoves } from "#app/data/move.js"; +import { Abilities } from "#app/enums/abilities.js"; +import { ArenaTagType } from "#app/enums/arena-tag-type.js"; +import Pokemon from "#app/field/pokemon.js"; import { TurnEndPhase, } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { NumberHolder } from "#app/utils.js"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { Abilities } from "#app/enums/abilities.js"; -import Pokemon from "#app/field/pokemon.js"; -import Move, { allMoves } from "#app/data/move.js"; -import { NumberHolder } from "#app/utils.js"; -import { ArenaTagSide } from "#app/data/arena-tag.js"; -import { ArenaTagType } from "#app/enums/arena-tag-type.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Light Screen", () => { @@ -40,7 +39,7 @@ describe("Moves - Light Screen", () => { game.override.enemyLevel(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN, Moves.LIGHT_SCREEN]); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); }); it("reduces damage of special attacks by half in a single battle", async() => { diff --git a/src/test/moves/magnet_rise.test.ts b/src/test/moves/magnet_rise.test.ts index 9986921e0d5..e5dfb94468e 100644 --- a/src/test/moves/magnet_rise.test.ts +++ b/src/test/moves/magnet_rise.test.ts @@ -1,10 +1,9 @@ -import {beforeAll, afterEach, beforeEach, describe, vi, it, expect} from "vitest"; -import Phaser from "phaser"; +import { CommandPhase, TurnEndPhase } from "#app/phases.js"; import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import {Moves} from "#enums/moves"; -import {Species} from "#enums/species"; -import {CommandPhase, TurnEndPhase} from "#app/phases.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Magnet Rise", () => { let phaserGame: Phaser.Game; @@ -27,7 +26,7 @@ describe("Moves - Magnet Rise", () => { game.override.starterSpecies(Species.MAGNEZONE); game.override.enemySpecies(Species.RATTATA); game.override.enemyMoveset([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.enemyLevel(1); game.override.moveset([moveToUse, Moves.SPLASH, Moves.GRAVITY, Moves.BATON_PASS]); }); diff --git a/src/test/moves/multi_target.test.ts b/src/test/moves/multi_target.test.ts index a67ee11eb31..ca303bff84e 100644 --- a/src/test/moves/multi_target.test.ts +++ b/src/test/moves/multi_target.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Moves } from "#enums/moves"; import { getMoveTargets } from "#app/data/move.js"; import { Abilities } from "#app/enums/abilities.js"; import { Species } from "#app/enums/species.js"; -import { getMovePosition } from "../utils/gameManagerUtils"; import { TurnEndPhase } from "#app/phases.js"; +import GameManager from "#app/test/utils/gameManager"; +import { Moves } from "#enums/moves"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; +import { getMovePosition } from "../utils/gameManagerUtils"; import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -169,7 +168,7 @@ function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) { game.override.moveset([Moves.EARTHQUAKE, Moves.HYPER_VOICE, Moves.SURF, Moves.SPLASH]); game.override.ability(Abilities.BALL_FETCH); game.override.enemyMoveset(SPLASH_ONLY); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.startingLevel(50); game.override.enemyLevel(40); game.override.enemySpecies(Species.EEVEE); diff --git a/src/test/moves/reflect.test.ts b/src/test/moves/reflect.test.ts index 7365ab01cd8..6fcd2268d12 100644 --- a/src/test/moves/reflect.test.ts +++ b/src/test/moves/reflect.test.ts @@ -1,19 +1,18 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { ArenaTagSide } from "#app/data/arena-tag.js"; +import Move, { allMoves } from "#app/data/move.js"; +import { Abilities } from "#app/enums/abilities.js"; +import { ArenaTagType } from "#app/enums/arena-tag-type.js"; +import Pokemon from "#app/field/pokemon.js"; import { TurnEndPhase, } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { NumberHolder } from "#app/utils.js"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { Abilities } from "#app/enums/abilities.js"; -import Pokemon from "#app/field/pokemon.js"; -import Move, { allMoves } from "#app/data/move.js"; -import { NumberHolder } from "#app/utils.js"; -import { ArenaTagSide } from "#app/data/arena-tag.js"; -import { ArenaTagType } from "#app/enums/arena-tag-type.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Reflect", () => { @@ -40,7 +39,7 @@ describe("Moves - Reflect", () => { game.override.enemyLevel(100); game.override.enemySpecies(Species.MAGIKARP); game.override.enemyMoveset([Moves.REFLECT, Moves.REFLECT, Moves.REFLECT, Moves.REFLECT]); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); }); it("reduces damage of physical attacks by half in a single battle", async() => { diff --git a/src/test/moves/rollout.test.ts b/src/test/moves/rollout.test.ts index 3e79005de61..73457c9dcce 100644 --- a/src/test/moves/rollout.test.ts +++ b/src/test/moves/rollout.test.ts @@ -1,5 +1,4 @@ import { allMoves } from "#app/data/move.js"; -import Overrides from "#app/overrides"; import { CommandPhase } from "#app/phases"; import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; @@ -26,7 +25,7 @@ describe("Moves - Rollout", () => { beforeEach(() => { game = new GameManager(phaserGame); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); game.override.battleType("single"); game.override.starterSpecies(Species.RATTATA); game.override.ability(Abilities.NONE); diff --git a/src/test/moves/tackle.test.ts b/src/test/moves/tackle.test.ts index e58b5d48c8f..94eee4f20fa 100644 --- a/src/test/moves/tackle.test.ts +++ b/src/test/moves/tackle.test.ts @@ -1,17 +1,16 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { Stat } from "#app/data/pokemon-stat"; import { CommandPhase, EnemyCommandPhase, TurnEndPhase, } from "#app/phases"; -import {Mode} from "#app/ui/ui"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {Command} from "#app/ui/command-ui-handler"; -import {Stat} from "#app/data/pokemon-stat"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; +import { Mode } from "#app/ui/ui"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Tackle", () => { @@ -37,7 +36,7 @@ describe("Moves - Tackle", () => { game.override.startingWave(97); game.override.moveset([moveToUse]); game.override.enemyMoveset([Moves.GROWTH,Moves.GROWTH,Moves.GROWTH,Moves.GROWTH]); - vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); + game.override.disableCrits(); }); it("TACKLE against ghost", async() => { From e0e37314ce4ebfb0336f2a5857547490f4c995b3 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:27:02 -0700 Subject: [PATCH 31/42] add OverridesHelper.enemyPassiveAbility --- src/test/utils/overridesHelper.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index caaef1a2c0e..8f4e0f54834 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -185,6 +185,17 @@ export class OverridesHelper { return this; } + /** + * Override the enemy (pokemon) **passive** {@linkcode Abilities | ability} + * @param passiveAbility the (pokemon) **passive** {@linkcode Abilities | ability} to set + * @returns this + */ + enemyPassiveAbility(passiveAbility: Abilities): this { + vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(passiveAbility); + this.log(`Enemy Pokemon PASSIVE ability set to ${Abilities[passiveAbility]} (=${passiveAbility})!`); + return this; + } + /** * Override the enemy (pokemon) {@linkcode Moves | moves}set * @param moveset the {@linkcode Moves | moves}set to set From dfdba05439a4db2cec11d8f11214873495815506 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:29:31 -0700 Subject: [PATCH 32/42] apply game.override.enemyPassiveAbility --- src/test/abilities/intimidate.test.ts | 8 ++++++-- src/test/moves/ceaseless_edge.test.ts | 2 +- src/test/moves/dragon_rage.test.ts | 2 +- src/test/moves/fissure.test.ts | 2 +- src/test/moves/spikes.test.ts | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/test/abilities/intimidate.test.ts b/src/test/abilities/intimidate.test.ts index c42af129227..5537eee37a8 100644 --- a/src/test/abilities/intimidate.test.ts +++ b/src/test/abilities/intimidate.test.ts @@ -2,13 +2,17 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite import Phaser from "phaser"; import GameManager from "#app/test/utils/gameManager"; import Overrides from "#app/overrides"; -import { CommandPhase, DamagePhase, EncounterPhase, EnemyCommandPhase, SelectStarterPhase, TurnInitPhase } from "#app/phases"; import { Mode } from "#app/ui/ui"; import { BattleStat } from "#app/data/battle-stat"; import { generateStarter, getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Command } from "#app/ui/command-ui-handler"; import { Status, StatusEffect } from "#app/data/status-effect"; import { GameModes, getGameMode } from "#app/game-mode"; +import { + CommandPhase, DamagePhase, EncounterPhase, + EnemyCommandPhase, SelectStarterPhase, + TurnInitPhase, +} from "#app/phases"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; @@ -32,7 +36,7 @@ describe("Abilities - Intimidate", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.INTIMIDATE); - vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyPassiveAbility(Abilities.HYDRATION); game.override.ability(Abilities.INTIMIDATE); game.override.startingWave(3); game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index 54a0a0da099..7164a6f4720 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -35,7 +35,7 @@ describe("Moves - Ceaseless Edge", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.RUN_AWAY); - vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.RUN_AWAY); + game.override.enemyPassiveAbility(Abilities.RUN_AWAY); game.override.startingLevel(100); game.override.enemyLevel(100); game.override.moveset([ Moves.CEASELESS_EDGE, Moves.SPLASH, Moves.ROAR ]); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index a9637248e68..0ad5776009d 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -47,7 +47,7 @@ describe("Moves - Dragon Rage", () => { game.override.enemySpecies(Species.SNORLAX); game.override.enemyMoveset(SPLASH_ONLY); game.override.enemyAbility(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyPassiveAbility(Abilities.BALL_FETCH); game.override.enemyLevel(100); await game.startBattle(); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index 73713f93f14..9f6bfa81cf7 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -40,7 +40,7 @@ describe("Moves - Fissure", () => { game.override.enemySpecies(Species.SNORLAX); game.override.enemyMoveset(SPLASH_ONLY); - vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.enemyPassiveAbility(Abilities.BALL_FETCH); game.override.enemyLevel(100); await game.startBattle(); diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index b2f711d406a..b227132a1d5 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -30,7 +30,7 @@ describe("Moves - Spikes", () => { game.override.battleType("single"); game.override.enemySpecies(Species.RATTATA); game.override.enemyAbility(Abilities.HYDRATION); - vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.enemyPassiveAbility(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION); vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.startingWave(3); From b72a1347b28ef6520b7372959dbdc576afc2ba26 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:30:28 -0700 Subject: [PATCH 33/42] add OverridesHelper.passiveAbility --- src/test/utils/overridesHelper.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index 8f4e0f54834..d6bb0169540 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -88,6 +88,17 @@ export class OverridesHelper { return this; } + /** + * Override the player (pokemon) **passive** {@linkcode Abilities | ability} + * @param passiveAbility the (pokemon) **passive** {@linkcode Abilities | ability} to set + * @returns this + */ + passiveAbility(passiveAbility: Abilities): this { + vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(passiveAbility); + this.log(`Player Pokemon PASSIVE ability set to ${Abilities[passiveAbility]} (=${passiveAbility})!`); + return this; + } + /** * Override the player (pokemon) {@linkcode Moves | moves}set * @param moveset the {@linkcode Moves | moves}set to set From a7b26355b0b8e27091888c8948ed10b941015e8b Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:36:39 -0700 Subject: [PATCH 34/42] apply game.override.passiveAbility --- src/test/abilities/libero.test.ts | 23 +++++++++++------------ src/test/abilities/protean.test.ts | 23 +++++++++++------------ src/test/abilities/unseen_fist.test.ts | 13 ++++++------- src/test/moves/dragon_rage.test.ts | 23 +++++++++++------------ src/test/moves/fissure.test.ts | 19 +++++++++---------- src/test/moves/glaive_rush.test.ts | 2 +- src/test/moves/spikes.test.ts | 9 ++++----- 7 files changed, 53 insertions(+), 59 deletions(-) diff --git a/src/test/abilities/libero.test.ts b/src/test/abilities/libero.test.ts index cc69334b805..58e67a6ebe6 100644 --- a/src/test/abilities/libero.test.ts +++ b/src/test/abilities/libero.test.ts @@ -1,18 +1,17 @@ +import { allMoves } from "#app/data/move.js"; +import { Type } from "#app/data/type.js"; +import { Weather, WeatherType } from "#app/data/weather.js"; +import { PlayerPokemon } from "#app/field/pokemon.js"; +import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { BattlerTagType } from "#enums/battler-tag-type"; +import { Biome } from "#enums/biome"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import GameManager from "../utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Abilities } from "#enums/abilities"; -import { Moves } from "#enums/moves"; import { getMovePosition } from "../utils/gameManagerUtils"; -import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; -import { allMoves } from "#app/data/move.js"; -import { BattlerTagType } from "#enums/battler-tag-type"; -import { Weather, WeatherType } from "#app/data/weather.js"; -import { Type } from "#app/data/type.js"; -import { Biome } from "#enums/biome"; -import { PlayerPokemon } from "#app/field/pokemon.js"; import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -125,7 +124,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the type has changed by another ability", async () => { game.override.moveset([Moves.TACKLE]); - vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.REFRIGERATE); + game.override.passiveAbility(Abilities.REFRIGERATE); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/protean.test.ts b/src/test/abilities/protean.test.ts index 65858ec947d..d02c87662cf 100644 --- a/src/test/abilities/protean.test.ts +++ b/src/test/abilities/protean.test.ts @@ -1,18 +1,17 @@ +import { allMoves } from "#app/data/move.js"; +import { Type } from "#app/data/type.js"; +import { Weather, WeatherType } from "#app/data/weather.js"; +import { PlayerPokemon } from "#app/field/pokemon.js"; +import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { BattlerTagType } from "#enums/battler-tag-type"; +import { Biome } from "#enums/biome"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import GameManager from "../utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Abilities } from "#enums/abilities"; -import { Moves } from "#enums/moves"; import { getMovePosition } from "../utils/gameManagerUtils"; -import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; -import { allMoves } from "#app/data/move.js"; -import { BattlerTagType } from "#enums/battler-tag-type"; -import { Weather, WeatherType } from "#app/data/weather.js"; -import { Type } from "#app/data/type.js"; -import { Biome } from "#enums/biome"; -import { PlayerPokemon } from "#app/field/pokemon.js"; import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -125,7 +124,7 @@ describe("Abilities - Protean", () => { "ability applies correctly even if the type has changed by another ability", async () => { game.override.moveset([Moves.TACKLE]); - vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.REFRIGERATE); + game.override.passiveAbility(Abilities.REFRIGERATE); await game.startBattle([Species.MAGIKARP]); diff --git a/src/test/abilities/unseen_fist.test.ts b/src/test/abilities/unseen_fist.test.ts index e1e16584bd9..2156c5eb588 100644 --- a/src/test/abilities/unseen_fist.test.ts +++ b/src/test/abilities/unseen_fist.test.ts @@ -1,12 +1,11 @@ -import Phaser from "phaser"; -import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; -import GameManager from "../utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { TurnEndPhase } from "#app/phases.js"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest"; +import GameManager from "../utils/gameManager"; import { getMovePosition } from "../utils/gameManagerUtils"; -import { TurnEndPhase } from "#app/phases.js"; const TIMEOUT = 20 * 1000; @@ -49,7 +48,7 @@ describe("Abilities - Unseen Fist", () => { test( "ability does not apply if the source has Long Reach", () => { - vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.LONG_REACH); + game.override.passiveAbility(Abilities.LONG_REACH); testUnseenFistHitResult(game, Moves.QUICK_ATTACK, Moves.PROTECT, false); }, TIMEOUT ); diff --git a/src/test/moves/dragon_rage.test.ts b/src/test/moves/dragon_rage.test.ts index 0ad5776009d..b38a6f16513 100644 --- a/src/test/moves/dragon_rage.test.ts +++ b/src/test/moves/dragon_rage.test.ts @@ -1,17 +1,16 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { TurnEndPhase } from "#app/phases"; -import { Moves } from "#enums/moves"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; -import { Abilities } from "#enums/abilities"; -import { Species } from "#app/enums/species.js"; -import { Type } from "#app/data/type"; import { BattleStat } from "#app/data/battle-stat"; -import { BattlerTagType } from "#enums/battler-tag-type"; +import { Type } from "#app/data/type"; +import { Species } from "#app/enums/species.js"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; import { modifierTypes } from "#app/modifier/modifier-type"; +import { TurnEndPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Abilities } from "#enums/abilities"; +import { BattlerTagType } from "#enums/battler-tag-type"; +import { Moves } from "#enums/moves"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Dragon Rage", () => { @@ -41,7 +40,7 @@ describe("Moves - Dragon Rage", () => { game.override.starterSpecies(Species.SNORLAX); game.override.moveset([Moves.DRAGON_RAGE]); game.override.ability(Abilities.BALL_FETCH); - vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.passiveAbility(Abilities.BALL_FETCH); game.override.startingLevel(100); game.override.enemySpecies(Species.SNORLAX); diff --git a/src/test/moves/fissure.test.ts b/src/test/moves/fissure.test.ts index 9f6bfa81cf7..940c32e975a 100644 --- a/src/test/moves/fissure.test.ts +++ b/src/test/moves/fissure.test.ts @@ -1,14 +1,13 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { DamagePhase, TurnEndPhase } from "#app/phases"; -import { Moves } from "#enums/moves"; -import { getMovePosition } from "#app/test/utils/gameManagerUtils"; -import { Abilities } from "#enums/abilities"; +import { BattleStat } from "#app/data/battle-stat"; import { Species } from "#app/enums/species.js"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; -import { BattleStat } from "#app/data/battle-stat"; +import { DamagePhase, TurnEndPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Fissure", () => { @@ -35,7 +34,7 @@ describe("Moves - Fissure", () => { game.override.starterSpecies(Species.SNORLAX); game.override.moveset([Moves.FISSURE]); - vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); + game.override.passiveAbility(Abilities.BALL_FETCH); game.override.startingLevel(100); game.override.enemySpecies(Species.SNORLAX); diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index 937573ded15..c6ead0ff372 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -33,7 +33,7 @@ describe("Moves - Glaive Rush", () => { game.override.enemyMoveset(Array(4).fill(Moves.GLAIVE_RUSH)); game.override.starterSpecies(Species.KLINK); game.override.ability(Abilities.UNNERVE); - vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FUR_COAT); + game.override.passiveAbility(Abilities.FUR_COAT); game.override.moveset([Moves.SHADOW_SNEAK, Moves.AVALANCHE, Moves.SPLASH, Moves.GLAIVE_RUSH]); }); diff --git a/src/test/moves/spikes.test.ts b/src/test/moves/spikes.test.ts index b227132a1d5..a19c28b2c1e 100644 --- a/src/test/moves/spikes.test.ts +++ b/src/test/moves/spikes.test.ts @@ -1,13 +1,12 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; import { CommandPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Moves - Spikes", () => { @@ -32,7 +31,7 @@ describe("Moves - Spikes", () => { game.override.enemyAbility(Abilities.HYDRATION); game.override.enemyPassiveAbility(Abilities.HYDRATION); game.override.ability(Abilities.HYDRATION); - vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); + game.override.passiveAbility(Abilities.HYDRATION); game.override.startingWave(3); game.override.enemyMoveset([Moves.SPLASH,Moves.SPLASH,Moves.SPLASH,Moves.SPLASH]); game.override.moveset([Moves.SPIKES,Moves.SPLASH, Moves.ROAR]); From 05a3142c135d27de3a40a243fb984926fe651666 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:38:56 -0700 Subject: [PATCH 35/42] add OverridesHelper.startingHeldItems --- src/test/utils/overridesHelper.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index d6bb0169540..00de71240b4 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -5,6 +5,7 @@ import { Moves } from "#app/enums/moves.js"; import { Species } from "#app/enums/species.js"; import * as GameMode from "#app/game-mode"; import { GameModes, getGameMode } from "#app/game-mode"; +import { ModifierOverride } from "#app/modifier/modifier-type.js"; import Overrides from "#app/overrides"; import GameManager from "#test/utils/gameManager"; import { vi } from "vitest"; @@ -52,6 +53,17 @@ export class OverridesHelper { return this; } + /** + * Override the player (pokemon) starting held items + * @param items the items to hold + * @returns this + */ + startingHeldItems(items: ModifierOverride[]) { + vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue(items); + this.log("Player Pokemon starting held items set to:", items); + return this; + } + /** * Override the player (pokemon) {@linkcode Species | species} * @param species the (pokemon) {@linkcode Species | species} to set From 4338f7b927591c9bbc4f5a1d33aeea6b74df2a29 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:43:48 -0700 Subject: [PATCH 36/42] apply game.override.startingHeldItems --- src/test/abilities/parental_bond.test.ts | 8 ++++---- src/test/abilities/sheer_force.test.ts | 25 ++++++++++++------------ src/test/items/eviolite.test.ts | 11 +++++------ src/test/items/exp_booster.test.ts | 9 ++++----- src/test/items/grip_claw.test.ts | 2 +- src/test/items/leek.test.ts | 17 ++++++++-------- src/test/items/leftovers.test.ts | 9 ++++----- src/test/items/light_ball.test.ts | 13 ++++++------ src/test/items/metal_powder.test.ts | 13 ++++++------ src/test/items/quick_powder.test.ts | 13 ++++++------ src/test/items/scope_lens.test.ts | 17 ++++++++-------- src/test/items/thick_club.test.ts | 13 ++++++------ src/test/items/toxic_orb.test.ts | 19 +++++++++--------- src/test/moves/ceaseless_edge.test.ts | 21 ++++++++++---------- src/test/moves/glaive_rush.test.ts | 13 ++++++------ src/test/ui/transfer-item.test.ts | 7 +++---- 16 files changed, 98 insertions(+), 112 deletions(-) diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index 843d8a8c3e8..87f15ce480b 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -339,7 +339,7 @@ describe("Abilities - Parental Bond", () => { "Moves boosted by this ability and Multi-Lens should strike 4 times", async () => { game.override.moveset([Moves.TACKLE]); - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]); + game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]); await game.startBattle([Species.CHARIZARD]); @@ -361,7 +361,7 @@ describe("Abilities - Parental Bond", () => { "Super Fang boosted by this ability and Multi-Lens should strike twice", async () => { game.override.moveset([Moves.SUPER_FANG]); - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]); + game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]); await game.startBattle([Species.CHARIZARD]); @@ -392,7 +392,7 @@ describe("Abilities - Parental Bond", () => { "Seismic Toss boosted by this ability and Multi-Lens should strike twice", async () => { game.override.moveset([Moves.SEISMIC_TOSS]); - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]); + game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]); await game.startBattle([Species.CHARIZARD]); @@ -615,7 +615,7 @@ describe("Abilities - Parental Bond", () => { async () => { game.override.battleType("double"); game.override.moveset([Moves.EARTHQUAKE, Moves.SPLASH]); - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 1}]); + game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]); await game.startBattle([Species.CHARIZARD, Species.PIDGEOT]); diff --git a/src/test/abilities/sheer_force.test.ts b/src/test/abilities/sheer_force.test.ts index 850a2d97c9f..1e7657611a1 100644 --- a/src/test/abilities/sheer_force.test.ts +++ b/src/test/abilities/sheer_force.test.ts @@ -1,20 +1,19 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import {Abilities} from "#enums/abilities"; -import {applyAbAttrs ,applyPreAttackAbAttrs,applyPostDefendAbAttrs, MoveEffectChanceMultiplierAbAttr, MovePowerBoostAbAttr, PostDefendTypeChangeAbAttr} from "#app/data/ability"; -import {Species} from "#enums/species"; +import { applyAbAttrs, applyPostDefendAbAttrs, applyPreAttackAbAttrs, MoveEffectChanceMultiplierAbAttr, MovePowerBoostAbAttr, PostDefendTypeChangeAbAttr } from "#app/data/ability"; +import { Stat } from "#app/data/pokemon-stat"; import { CommandPhase, MoveEffectPhase, } from "#app/phases"; -import {Mode} from "#app/ui/ui"; -import {Stat} from "#app/data/pokemon-stat"; -import {Moves} from "#enums/moves"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {Command} from "#app/ui/command-ui-handler"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; +import { Mode } from "#app/ui/ui"; import * as Utils from "#app/utils"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Abilities - Sheer Force", () => { @@ -161,7 +160,7 @@ describe("Abilities - Sheer Force", () => { it("Sheer Force Disabling Specific Abilities", async() => { const moveToUse = Moves.CRUSH_CLAW; game.override.enemyAbility(Abilities.COLOR_CHANGE); - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "KINGS_ROCK", count: 1}]); + game.override.startingHeldItems([{name: "KINGS_ROCK", count: 1}]); game.override.ability(Abilities.SHEER_FORCE); await game.startBattle([ Species.PIDGEOT diff --git a/src/test/items/eviolite.test.ts b/src/test/items/eviolite.test.ts index 2a0ee64a172..5b18cc3a249 100644 --- a/src/test/items/eviolite.test.ts +++ b/src/test/items/eviolite.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phase from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; import { Stat } from "#app/data/pokemon-stat"; import { EvolutionStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; -import * as Utils from "#app/utils"; import i18next from "#app/plugins/i18n"; +import GameManager from "#app/test/utils/gameManager"; +import * as Utils from "#app/utils"; import { Species } from "#enums/species"; +import Phase from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Items - Eviolite", () => { let phaserGame: Phaser.Game; @@ -30,7 +29,7 @@ describe("Items - Eviolite", () => { }); it("EVIOLITE activates in battle correctly", async() => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "EVIOLITE" }]); + game.override.startingHeldItems([{ name: "EVIOLITE" }]); const consoleSpy = vi.spyOn(console, "log"); await game.startBattle([ Species.PICHU diff --git a/src/test/items/exp_booster.test.ts b/src/test/items/exp_booster.test.ts index 8e61d8decda..e80b12d7fc9 100644 --- a/src/test/items/exp_booster.test.ts +++ b/src/test/items/exp_booster.test.ts @@ -1,10 +1,9 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phase from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; import { Abilities } from "#app/enums/abilities.js"; import { PokemonExpBoosterModifier } from "#app/modifier/modifier.js"; +import GameManager from "#app/test/utils/gameManager"; import * as Utils from "#app/utils"; +import Phase from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("EXP Modifier Items", () => { let phaserGame: Phaser.Game; @@ -29,7 +28,7 @@ describe("EXP Modifier Items", () => { }); it("EXP booster items stack additively", async() => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "LUCKY_EGG"}, {name: "GOLDEN_EGG"}]); + game.override.startingHeldItems([{name: "LUCKY_EGG"}, {name: "GOLDEN_EGG"}]); await game.startBattle(); const partyMember = game.scene.getPlayerPokemon(); diff --git a/src/test/items/grip_claw.test.ts b/src/test/items/grip_claw.test.ts index fdf18454812..b2c89065b91 100644 --- a/src/test/items/grip_claw.test.ts +++ b/src/test/items/grip_claw.test.ts @@ -32,7 +32,7 @@ describe("Items - Grip Claw", () => { game.override.battleType("double"); game.override.moveset([ Moves.POPULATION_BOMB, Moves.SPLASH ]); - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]); + game.override.startingHeldItems([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]); game.override.enemySpecies(Species.SNORLAX); game.override.ability(Abilities.KLUTZ); game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); diff --git a/src/test/items/leek.test.ts b/src/test/items/leek.test.ts index bee60f3303b..73444a54c30 100644 --- a/src/test/items/leek.test.ts +++ b/src/test/items/leek.test.ts @@ -1,14 +1,13 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phase from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Moves } from "#enums/moves"; +import { BattlerIndex } from "#app/battle"; import { CritBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; -import * as Utils from "#app/utils"; import { MoveEffectPhase, TurnStartPhase } from "#app/phases"; -import { BattlerIndex } from "#app/battle"; +import GameManager from "#app/test/utils/gameManager"; +import * as Utils from "#app/utils"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phase from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Items - Leek", () => { let phaserGame: Phaser.Game; @@ -35,7 +34,7 @@ describe("Items - Leek", () => { }); it("LEEK activates in battle correctly", async() => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "LEEK" }]); + game.override.startingHeldItems([{ name: "LEEK" }]); game.override.moveset([ Moves.POUND ]); const consoleSpy = vi.spyOn(console, "log"); await game.startBattle([ diff --git a/src/test/items/leftovers.test.ts b/src/test/items/leftovers.test.ts index ad7cb6b07e6..8c9195b07af 100644 --- a/src/test/items/leftovers.test.ts +++ b/src/test/items/leftovers.test.ts @@ -1,12 +1,11 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import overrides from "#app/overrides"; import { DamagePhase, TurnEndPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Items - Leftovers", () => { @@ -32,7 +31,7 @@ describe("Items - Leftovers", () => { game.override.enemySpecies(Species.SHUCKLE); game.override.enemyAbility(Abilities.UNNERVE); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); - vi.spyOn(overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "LEFTOVERS", count: 1}]); + game.override.startingHeldItems([{name: "LEFTOVERS", count: 1}]); }); it("leftovers works", async() => { diff --git a/src/test/items/light_ball.test.ts b/src/test/items/light_ball.test.ts index ed6ed8a4934..eb0c6cc044f 100644 --- a/src/test/items/light_ball.test.ts +++ b/src/test/items/light_ball.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phase from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; import { Stat } from "#app/data/pokemon-stat"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; -import * as Utils from "#app/utils"; import i18next from "#app/plugins/i18n"; +import GameManager from "#app/test/utils/gameManager"; +import * as Utils from "#app/utils"; +import { Species } from "#enums/species"; +import Phase from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Items - Light Ball", () => { let phaserGame: Phaser.Game; @@ -30,7 +29,7 @@ describe("Items - Light Ball", () => { }); it("LIGHT_BALL activates in battle correctly", async() => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SPECIES_STAT_BOOSTER", type: "LIGHT_BALL" }]); + game.override.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "LIGHT_BALL" }]); const consoleSpy = vi.spyOn(console, "log"); await game.startBattle([ Species.PIKACHU diff --git a/src/test/items/metal_powder.test.ts b/src/test/items/metal_powder.test.ts index f106b344f44..937fd8feb62 100644 --- a/src/test/items/metal_powder.test.ts +++ b/src/test/items/metal_powder.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phase from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; import { Stat } from "#app/data/pokemon-stat"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; -import * as Utils from "#app/utils"; import i18next from "#app/plugins/i18n"; +import GameManager from "#app/test/utils/gameManager"; +import * as Utils from "#app/utils"; +import { Species } from "#enums/species"; +import Phase from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Items - Metal Powder", () => { let phaserGame: Phaser.Game; @@ -30,7 +29,7 @@ describe("Items - Metal Powder", () => { }); it("METAL_POWDER activates in battle correctly", async() => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SPECIES_STAT_BOOSTER", type: "METAL_POWDER" }]); + game.override.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "METAL_POWDER" }]); const consoleSpy = vi.spyOn(console, "log"); await game.startBattle([ Species.DITTO diff --git a/src/test/items/quick_powder.test.ts b/src/test/items/quick_powder.test.ts index 0c71ec39ee4..e662b398cd4 100644 --- a/src/test/items/quick_powder.test.ts +++ b/src/test/items/quick_powder.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phase from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; import { Stat } from "#app/data/pokemon-stat"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; -import * as Utils from "#app/utils"; import i18next from "#app/plugins/i18n"; +import GameManager from "#app/test/utils/gameManager"; +import * as Utils from "#app/utils"; +import { Species } from "#enums/species"; +import Phase from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Items - Quick Powder", () => { let phaserGame: Phaser.Game; @@ -30,7 +29,7 @@ describe("Items - Quick Powder", () => { }); it("QUICK_POWDER activates in battle correctly", async() => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SPECIES_STAT_BOOSTER", type: "QUICK_POWDER" }]); + game.override.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "QUICK_POWDER" }]); const consoleSpy = vi.spyOn(console, "log"); await game.startBattle([ Species.DITTO diff --git a/src/test/items/scope_lens.test.ts b/src/test/items/scope_lens.test.ts index b1c34b8d042..c9fb3ba52d3 100644 --- a/src/test/items/scope_lens.test.ts +++ b/src/test/items/scope_lens.test.ts @@ -1,14 +1,13 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phase from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Moves } from "#enums/moves"; +import { BattlerIndex } from "#app/battle"; import { CritBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; -import * as Utils from "#app/utils"; import { MoveEffectPhase, TurnStartPhase } from "#app/phases"; -import { BattlerIndex } from "#app/battle"; +import GameManager from "#app/test/utils/gameManager"; +import * as Utils from "#app/utils"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phase from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Items - Scope Lens", () => { let phaserGame: Phaser.Game; @@ -35,7 +34,7 @@ describe("Items - Scope Lens", () => { }, 20000); it("SCOPE_LENS activates in battle correctly", async() => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SCOPE_LENS" }]); + game.override.startingHeldItems([{ name: "SCOPE_LENS" }]); game.override.moveset([ Moves.POUND ]); const consoleSpy = vi.spyOn(console, "log"); await game.startBattle([ diff --git a/src/test/items/thick_club.test.ts b/src/test/items/thick_club.test.ts index 9cb608b7e89..13714c441c0 100644 --- a/src/test/items/thick_club.test.ts +++ b/src/test/items/thick_club.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phase from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; import { Stat } from "#app/data/pokemon-stat"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { modifierTypes } from "#app/modifier/modifier-type"; -import * as Utils from "#app/utils"; import i18next from "#app/plugins/i18n"; +import GameManager from "#app/test/utils/gameManager"; +import * as Utils from "#app/utils"; +import { Species } from "#enums/species"; +import Phase from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Items - Thick Club", () => { let phaserGame: Phaser.Game; @@ -30,7 +29,7 @@ describe("Items - Thick Club", () => { }); it("THICK_CLUB activates in battle correctly", async() => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "SPECIES_STAT_BOOSTER", type: "THICK_CLUB" }]); + game.override.startingHeldItems([{ name: "SPECIES_STAT_BOOSTER", type: "THICK_CLUB" }]); const consoleSpy = vi.spyOn(console, "log"); await game.startBattle([ Species.CUBONE diff --git a/src/test/items/toxic_orb.test.ts b/src/test/items/toxic_orb.test.ts index bdef05fec2f..3ba32055fcd 100644 --- a/src/test/items/toxic_orb.test.ts +++ b/src/test/items/toxic_orb.test.ts @@ -1,21 +1,20 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { StatusEffect } from "#app/data/status-effect"; import { CommandPhase, EnemyCommandPhase, MessagePhase, TurnEndPhase, } from "#app/phases"; -import {Mode} from "#app/ui/ui"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; -import {Command} from "#app/ui/command-ui-handler"; -import {StatusEffect} from "#app/data/status-effect"; +import i18next, { initI18n } from "#app/plugins/i18n"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; +import { Command } from "#app/ui/command-ui-handler"; +import { Mode } from "#app/ui/ui"; import { Abilities } from "#enums/abilities"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import i18next, { initI18n } from "#app/plugins/i18n"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; describe("Items - Toxic orb", () => { @@ -43,7 +42,7 @@ describe("Items - Toxic orb", () => { game.override.startingLevel(2000); game.override.moveset([moveToUse]); game.override.enemyMoveset([oppMoveToUse, oppMoveToUse, oppMoveToUse, oppMoveToUse]); - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ + game.override.startingHeldItems([{ name: "TOXIC_ORB", }]); }); diff --git a/src/test/moves/ceaseless_edge.test.ts b/src/test/moves/ceaseless_edge.test.ts index 7164a6f4720..ab3da3d51b8 100644 --- a/src/test/moves/ceaseless_edge.test.ts +++ b/src/test/moves/ceaseless_edge.test.ts @@ -1,18 +1,17 @@ -import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag"; +import { allMoves } from "#app/data/move"; +import { Abilities } from "#app/enums/abilities"; +import { ArenaTagType } from "#app/enums/arena-tag-type"; import { MoveEffectPhase, TurnEndPhase } from "#app/phases"; -import {getMovePosition} from "#app/test/utils/gameManagerUtils"; +import GameManager from "#app/test/utils/gameManager"; +import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { ArenaTagType } from "#app/enums/arena-tag-type"; -import { allMoves } from "#app/data/move"; -import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag"; -import { Abilities } from "#app/enums/abilities"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; const TIMEOUT = 20 * 1000; @@ -75,7 +74,7 @@ describe("Moves - Ceaseless Edge", () => { test( "move should hit twice with multi lens and apply two layers of spikes", async () => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS"}]); + game.override.startingHeldItems([{name: "MULTI_LENS"}]); await game.startBattle([ Species.ILLUMISE ]); const leadPokemon = game.scene.getPlayerPokemon(); @@ -104,7 +103,7 @@ describe("Moves - Ceaseless Edge", () => { test( "trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage", async () => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS"}]); + game.override.startingHeldItems([{name: "MULTI_LENS"}]); game.override.startingWave(5); await game.startBattle([ Species.ILLUMISE ]); diff --git a/src/test/moves/glaive_rush.test.ts b/src/test/moves/glaive_rush.test.ts index c6ead0ff372..9548694183c 100644 --- a/src/test/moves/glaive_rush.test.ts +++ b/src/test/moves/glaive_rush.test.ts @@ -1,13 +1,12 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; +import { allMoves } from "#app/data/move.js"; +import { Abilities } from "#app/enums/abilities.js"; import { DamagePhase, TurnEndPhase } from "#app/phases"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Moves } from "#enums/moves"; import { Species } from "#enums/species"; -import { Abilities } from "#app/enums/abilities.js"; -import { allMoves } from "#app/data/move.js"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; describe("Moves - Glaive Rush", () => { @@ -66,7 +65,7 @@ describe("Moves - Glaive Rush", () => { }, 20000); it("interacts properly with multi-lens", async() => { - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS", count: 2}]); + game.override.startingHeldItems([{name: "MULTI_LENS", count: 2}]); game.override.enemyMoveset(Array(4).fill(Moves.AVALANCHE)); await game.startBattle(); const player = game.scene.getPlayerPokemon(); diff --git a/src/test/ui/transfer-item.test.ts b/src/test/ui/transfer-item.test.ts index 3a787fa462d..c00e40b8ebd 100644 --- a/src/test/ui/transfer-item.test.ts +++ b/src/test/ui/transfer-item.test.ts @@ -1,8 +1,7 @@ import { BerryType } from "#app/enums/berry-type"; +import { Button } from "#app/enums/buttons"; import { Moves } from "#app/enums/moves"; import { Species } from "#app/enums/species"; -import { Button } from "#app/enums/buttons"; -import Overrides from "#app/overrides"; import { BattleEndPhase, SelectModifierPhase @@ -13,7 +12,7 @@ import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler"; import { Mode } from "#app/ui/ui"; import Phaser from "phaser"; import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { getMovePosition } from "../utils/gameManagerUtils"; @@ -36,7 +35,7 @@ describe("UI - Transfer Items", () => { game.override.battleType("single"); game.override.startingLevel(100); game.override.startingWave(1); - vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([ + game.override.startingHeldItems([ { name: "BERRY", count: 1, type: BerryType.SITRUS }, { name: "BERRY", count: 2, type: BerryType.APICOT }, { name: "BERRY", count: 2, type: BerryType.LUM }, From fa8e9c38bc02856f17a4acef8f701a23e7f17716 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:45:58 -0700 Subject: [PATCH 37/42] add OverridesHelper.enemyStatusEffect() --- src/test/utils/overridesHelper.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index 00de71240b4..689f6e86be6 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -1,3 +1,4 @@ +import { StatusEffect } from "#app/data/status-effect.js"; import { Weather, WeatherType } from "#app/data/weather"; import { Abilities } from "#app/enums/abilities.js"; import { Biome } from "#app/enums/biome"; @@ -242,6 +243,17 @@ export class OverridesHelper { return this; } + /** + * Override the enemy (pokemon) {@linkcode StatusEffect | status-effect} + * @param statusEffect the {@linkcode StatusEffect | status-effect} to set + * @returns + */ + enemyStatusEffect(statusEffect: StatusEffect): this { + vi.spyOn(Overrides, "OPP_STATUS_OVERRIDE", "get").mockReturnValue(statusEffect); + this.log(`Enemy Pokemon status-effect set to ${StatusEffect[statusEffect]} (=${statusEffect})!`); + return this; + } + private log(...params: any[]) { console.log("Overrides:", ...params); } From a22db0df99f75a00e84eef67f22ab18c6cac11ed Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:47:50 -0700 Subject: [PATCH 38/42] apply game.override.enemyStatusEffect --- src/test/abilities/parental_bond.test.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/test/abilities/parental_bond.test.ts b/src/test/abilities/parental_bond.test.ts index 87f15ce480b..bc7be2fae96 100644 --- a/src/test/abilities/parental_bond.test.ts +++ b/src/test/abilities/parental_bond.test.ts @@ -1,16 +1,15 @@ +import { BattleStat } from "#app/data/battle-stat.js"; +import { StatusEffect } from "#app/data/status-effect.js"; +import { Type } from "#app/data/type.js"; +import { BattlerTagType } from "#app/enums/battler-tag-type.js"; +import { BerryPhase, CommandPhase, DamagePhase, MoveEffectPhase, MoveEndPhase, TurnEndPhase } from "#app/phases.js"; +import { Abilities } from "#enums/abilities"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; import Phaser from "phaser"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import GameManager from "../utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; -import { Abilities } from "#enums/abilities"; -import { Moves } from "#enums/moves"; import { getMovePosition } from "../utils/gameManagerUtils"; -import { BerryPhase, CommandPhase, DamagePhase, MoveEffectPhase, MoveEndPhase, TurnEndPhase } from "#app/phases.js"; -import { BattleStat } from "#app/data/battle-stat.js"; -import { Type } from "#app/data/type.js"; -import { BattlerTagType } from "#app/enums/battler-tag-type.js"; -import { StatusEffect } from "#app/data/status-effect.js"; import { SPLASH_ONLY } from "../utils/testUtils"; const TIMEOUT = 20 * 1000; @@ -539,8 +538,7 @@ describe("Abilities - Parental Bond", () => { test( "Wake-Up Slap boosted by this ability should only wake up the target after the second hit", async () => { - game.override.moveset([Moves.WAKE_UP_SLAP]); - vi.spyOn(Overrides, "OPP_STATUS_OVERRIDE", "get").mockReturnValue(StatusEffect.SLEEP); + game.override.moveset([Moves.WAKE_UP_SLAP]).enemyStatusEffect(StatusEffect.SLEEP); await game.startBattle([Species.CHARIZARD]); From 8e09714904dc9d133a6b0348612742721bb6d160 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:48:49 -0700 Subject: [PATCH 39/42] add OverridesHelper.enemyHeldItems --- src/test/utils/overridesHelper.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/utils/overridesHelper.ts b/src/test/utils/overridesHelper.ts index 689f6e86be6..2858076e3b6 100644 --- a/src/test/utils/overridesHelper.ts +++ b/src/test/utils/overridesHelper.ts @@ -254,6 +254,17 @@ export class OverridesHelper { return this; } + /** + * Override the enemy (pokemon) held items + * @param items the items to hold + * @returns this + */ + enemyHeldItems(items: ModifierOverride[]) { + vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue(items); + this.log("Enemy Pokemon held items set to:", items); + return this; + } + private log(...params: any[]) { console.log("Overrides:", ...params); } From 133af2fc325e9e64f3c41bb0cb0278f61684f63e Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:50:33 -0700 Subject: [PATCH 40/42] apply game.override.enemyHeldItems --- src/test/items/grip_claw.test.ts | 47 +++++++++++++++++--------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/test/items/grip_claw.test.ts b/src/test/items/grip_claw.test.ts index b2c89065b91..495bc5de223 100644 --- a/src/test/items/grip_claw.test.ts +++ b/src/test/items/grip_claw.test.ts @@ -1,15 +1,14 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phase from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Moves } from "#app/enums/moves.js"; -import { Species } from "#app/enums/species.js"; -import { BerryType } from "#app/enums/berry-type.js"; -import { Abilities } from "#app/enums/abilities.js"; -import { getMovePosition } from "../utils/gameManagerUtils"; -import { CommandPhase, MoveEndPhase, SelectTargetPhase } from "#app/phases.js"; import { BattlerIndex } from "#app/battle.js"; import { allMoves } from "#app/data/move.js"; +import { Abilities } from "#app/enums/abilities.js"; +import { BerryType } from "#app/enums/berry-type.js"; +import { Moves } from "#app/enums/moves.js"; +import { Species } from "#app/enums/species.js"; +import { CommandPhase, MoveEndPhase, SelectTargetPhase } from "#app/phases.js"; +import GameManager from "#app/test/utils/gameManager"; +import Phase from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; +import { getMovePosition } from "../utils/gameManagerUtils"; const TIMEOUT = 20 * 1000; // 20 seconds @@ -30,18 +29,22 @@ describe("Items - Grip Claw", () => { beforeEach(() => { game = new GameManager(phaserGame); - game.override.battleType("double"); - game.override.moveset([ Moves.POPULATION_BOMB, Moves.SPLASH ]); - game.override.startingHeldItems([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]); - game.override.enemySpecies(Species.SNORLAX); - game.override.ability(Abilities.KLUTZ); - game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); - vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([ - {name: "BERRY", type: BerryType.SITRUS, count: 2}, - {name: "BERRY", type: BerryType.LUM, count: 2} - ]); - game.override.startingLevel(100); - game.override.enemyLevel(100); + game.override + .battleType("double") + .moveset([Moves.POPULATION_BOMB, Moves.SPLASH]) + .startingHeldItems([ + { name: "GRIP_CLAW", count: 5 }, + { name: "MULTI_LENS", count: 3 }, + ]) + .enemySpecies(Species.SNORLAX) + .ability(Abilities.KLUTZ) + .enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]) + .enemyHeldItems([ + { name: "BERRY", type: BerryType.SITRUS, count: 2 }, + { name: "BERRY", type: BerryType.LUM, count: 2 }, + ]) + .startingLevel(100) + .enemyLevel(100); vi.spyOn(allMoves[Moves.POPULATION_BOMB], "accuracy", "get").mockReturnValue(100); }); From 0acefb1da82f842f56bf557fd878c24219466089 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:51:23 -0700 Subject: [PATCH 41/42] apply game.override.startingBiome --- src/test/moves/flower_shield.test.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/test/moves/flower_shield.test.ts b/src/test/moves/flower_shield.test.ts index 25394992b6d..b903196e15e 100644 --- a/src/test/moves/flower_shield.test.ts +++ b/src/test/moves/flower_shield.test.ts @@ -1,18 +1,17 @@ -import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import Phaser from "phaser"; -import GameManager from "#app/test/utils/gameManager"; -import Overrides from "#app/overrides"; -import { Species } from "#enums/species"; +import { BattleStat } from "#app/data/battle-stat.js"; +import { SemiInvulnerableTag } from "#app/data/battler-tags.js"; +import { Type } from "#app/data/type.js"; +import { Biome } from "#app/enums/biome.js"; import { TurnEndPhase, } from "#app/phases"; -import { Moves } from "#enums/moves"; +import GameManager from "#app/test/utils/gameManager"; import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { Abilities } from "#enums/abilities"; -import { BattleStat } from "#app/data/battle-stat.js"; -import { Biome } from "#app/enums/biome.js"; -import { Type } from "#app/data/type.js"; -import { SemiInvulnerableTag } from "#app/data/battler-tags.js"; +import { Moves } from "#enums/moves"; +import { Species } from "#enums/species"; +import Phaser from "phaser"; +import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest"; import { SPLASH_ONLY } from "../utils/testUtils"; describe("Moves - Flower Shield", () => { @@ -56,9 +55,7 @@ describe("Moves - Flower Shield", () => { }); it("increases defense of all Grass-type Pokemon on the field by one stage - double battle", async () => { - game.override.enemySpecies(Species.MAGIKARP); - vi.spyOn(Overrides, "STARTING_BIOME_OVERRIDE", "get").mockReturnValue(Biome.GRASS); - game.override.battleType("double"); + game.override.enemySpecies(Species.MAGIKARP).startingBiome(Biome.GRASS); await game.startBattle([Species.CHERRIM, Species.MAGIKARP]); const field = game.scene.getField(true); From 2f95c33bf59e0a0e6e0e2238118cb2cbe76a09b2 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:54:59 -0700 Subject: [PATCH 42/42] fix flower_shield.test.ts Somehow the battleType override was gone --- src/test/moves/flower_shield.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/moves/flower_shield.test.ts b/src/test/moves/flower_shield.test.ts index b903196e15e..82476ab5b90 100644 --- a/src/test/moves/flower_shield.test.ts +++ b/src/test/moves/flower_shield.test.ts @@ -55,7 +55,7 @@ describe("Moves - Flower Shield", () => { }); it("increases defense of all Grass-type Pokemon on the field by one stage - double battle", async () => { - game.override.enemySpecies(Species.MAGIKARP).startingBiome(Biome.GRASS); + game.override.enemySpecies(Species.MAGIKARP).startingBiome(Biome.GRASS).battleType("double"); await game.startBattle([Species.CHERRIM, Species.MAGIKARP]); const field = game.scene.getField(true);