From 6d14915f5f35159748d347ee07d553f20c886b0e Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Thu, 25 Jul 2024 16:18:47 -0700 Subject: [PATCH] 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() => {