Merge pull request #3212 from flx-sta/feature/test--overrides-helper-2

[Tests] Overrides helper utility (after beta rebase)
This commit is contained in:
Frederico Santos 2024-07-29 22:54:52 +01:00 committed by GitHub
commit 005d986d9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
94 changed files with 1813 additions and 1583 deletions

View File

@ -1,13 +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 { CommandPhase, MessagePhase, TurnInitPhase } from "#app/phases"; 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 { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; 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";
describe("Ability Timing", () => { describe("Ability Timing", () => {
@ -26,14 +26,14 @@ describe("Ability Timing", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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)); 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]); game.override.moveset([Moves.SPLASH, Moves.ICE_BEAM]);
}); });
it("should trigger after switch check", async() => { it("should trigger after switch check", async() => {

View File

@ -1,13 +1,13 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { allMoves } from "#app/data/move.js";
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 { MoveEffectPhase } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; 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", () => { describe("Abilities - Aura Break", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,18 +27,18 @@ describe("Abilities - Aura Break", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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]); game.override.moveset([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);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.AURA_BREAK); game.override.enemyAbility(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 () => { it("reverses the effect of fairy aura", async () => {
const moveToCheck = allMoves[Moves.MOONBLAST]; const moveToCheck = allMoves[Moves.MOONBLAST];
const basePower = moveToCheck.power; const basePower = moveToCheck.power;
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.FAIRY_AURA); game.override.ability(Abilities.FAIRY_AURA);
vi.spyOn(moveToCheck, "calculateBattlePower"); vi.spyOn(moveToCheck, "calculateBattlePower");
await game.startBattle([Species.PIKACHU]); await game.startBattle([Species.PIKACHU]);
@ -52,7 +52,7 @@ describe("Abilities - Aura Break", () => {
const moveToCheck = allMoves[Moves.DARK_PULSE]; const moveToCheck = allMoves[Moves.DARK_PULSE];
const basePower = moveToCheck.power; const basePower = moveToCheck.power;
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.DARK_AURA); game.override.ability(Abilities.DARK_AURA);
vi.spyOn(moveToCheck, "calculateBattlePower"); vi.spyOn(moveToCheck, "calculateBattlePower");
await game.startBattle([Species.PIKACHU]); await game.startBattle([Species.PIKACHU]);

View File

@ -1,13 +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 { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.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", () => { describe("Abilities - Battery", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,11 +27,11 @@ describe("Abilities - Battery", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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]); game.override.moveset([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 () => { it("raises the power of allies' special moves by 30%", async () => {

View File

@ -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 GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#test/utils/gameManagerUtils";
import Overrides from "#app/overrides"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
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";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -28,19 +27,19 @@ describe("Abilities - BATTLE BOND", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH; 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); game.override.ability(Abilities.BATTLE_BOND);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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( test(
"check if fainted pokemon switches to base form on arena reset", "check if fainted pokemon switches to base form on arena reset",
async () => { async () => {
const baseForm = 1, const baseForm = 1;
ashForm = 2; const ashForm = 2;
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); game.override.startingWave(4);
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ game.override.starterForms({
[Species.GRENINJA]: ashForm, [Species.GRENINJA]: ashForm,
}); });

View File

@ -1,13 +1,13 @@
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 { 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 { Abilities } from "#app/enums/abilities.js";
import { Moves } from "#app/enums/moves.js"; import { Moves } from "#app/enums/moves.js";
import { Species } from "#app/enums/species.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; const TIMEOUT = 20 * 1000;
@ -27,17 +27,17 @@ describe("Abilities - COSTAR", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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]);
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); game.override.enemyMoveset(SPLASH_ONLY);
}); });
test( test(
"ability copies positive stat changes", "ability copies positive stat changes",
async () => { 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]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);
@ -68,7 +68,7 @@ describe("Abilities - COSTAR", () => {
test( test(
"ability copies negative stat changes", "ability copies negative stat changes",
async () => { 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]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP, Species.FLAMIGO]);

View File

@ -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 GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#test/utils/gameManagerUtils";
import Overrides from "#app/overrides"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
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";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -28,10 +27,10 @@ describe("Abilities - DISGUISE", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH; 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); game.override.ability(Abilities.DISGUISE);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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( test(
@ -39,8 +38,8 @@ describe("Abilities - DISGUISE", () => {
async () => { async () => {
const baseForm = 0, const baseForm = 0,
bustedForm = 1; bustedForm = 1;
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); game.override.startingWave(4);
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ game.override.starterForms({
[Species.MIMIKYU]: bustedForm, [Species.MIMIKYU]: bustedForm,
}); });
@ -71,11 +70,11 @@ describe("Abilities - DISGUISE", () => {
const baseForm = 0, const baseForm = 0,
bustedForm = 1; 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); game.override.startingLevel(20);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(20); game.override.enemyLevel(20);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); game.override.enemySpecies(Species.MAGIKARP);
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ game.override.starterForms({
[Species.MIMIKYU]: baseForm, [Species.MIMIKYU]: baseForm,
}); });

View File

@ -1,12 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { Species } from "#app/enums/species.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { TurnEndPhase } from "#app/phases"; 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 { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; 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", () => { describe("Abilities - Dry Skin", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -24,17 +24,17 @@ describe("Abilities - Dry Skin", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.disableCrits();
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.enemyMoveset(SPLASH_ONLY);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.CHARMANDER); game.override.enemySpecies(Species.CHARMANDER);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); game.override.ability(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 () => { 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(); await game.startBattle();
@ -55,7 +55,7 @@ describe("Abilities - Dry Skin", () => {
}); });
it("during rain, gain 1/8 of maximum health at the end of each turn", async () => { 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(); await game.startBattle();
@ -78,7 +78,7 @@ describe("Abilities - Dry Skin", () => {
}); });
it("opposing fire attacks do 25% more damage", async () => { 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(); await game.startBattle();
@ -94,7 +94,7 @@ describe("Abilities - Dry Skin", () => {
expect(enemy.hp > 0); expect(enemy.hp > 0);
enemy.hp = initialHP; enemy.hp = initialHP;
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); game.override.enemyAbility(Abilities.NONE);
// second turn // second turn
game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER)); game.doAttack(getMovePosition(game.scene, 0, Moves.FLAMETHROWER));
@ -105,7 +105,7 @@ describe("Abilities - Dry Skin", () => {
}); });
it("opposing water attacks heal 1/4 of maximum health and deal no damage", async () => { 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(); await game.startBattle();
@ -120,7 +120,7 @@ describe("Abilities - Dry Skin", () => {
}); });
it("opposing water attacks do not heal if they were protected from", async () => { 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(); await game.startBattle();
@ -128,7 +128,7 @@ describe("Abilities - Dry Skin", () => {
expect(enemy).not.toBe(undefined); expect(enemy).not.toBe(undefined);
enemy.hp = 1; 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)); game.doAttack(getMovePosition(game.scene, 0, Moves.WATER_GUN));
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);
@ -136,7 +136,7 @@ describe("Abilities - Dry Skin", () => {
}); });
it("multi-strike water attacks only heal once", async () => { 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(); await game.startBattle();

View File

@ -1,14 +1,14 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { allMoves } from "#app/data/move.js";
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 { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { Stat } from "#app/enums/stat.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", () => { describe("Abilities - Hustle", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,14 +26,14 @@ describe("Abilities - Hustle", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HUSTLE); game.override.ability(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); game.override.startingLevel(5);
vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.disableCrits();
vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(5); game.override.enemyLevel(5);
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_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); 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 () => { it("increases the user's Attack stat by 50%", async () => {
@ -79,8 +79,8 @@ describe("Abilities - Hustle", () => {
}); });
it("does not affect OHKO moves", async () => { it("does not affect OHKO moves", async () => {
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.startingLevel(100);
vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(30); game.override.enemyLevel(30);
await game.startBattle([Species.PIKACHU]); await game.startBattle([Species.PIKACHU]);
const pikachu = game.scene.getPlayerPokemon(); const pikachu = game.scene.getPlayerPokemon();

View File

@ -1,19 +1,18 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { QuietFormChangePhase } from "#app/form-change-phase";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { import {
MoveEffectPhase, MoveEffectPhase,
MoveEndPhase, MoveEndPhase,
TurnEndPhase, TurnEndPhase,
TurnInitPhase, TurnInitPhase,
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type"; 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", () => { describe("Abilities - Ice Face", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -33,10 +32,10 @@ describe("Abilities - Ice Face", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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]); 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 () => { it("takes no damage from physical move and transforms to Noice", async () => {
@ -54,8 +53,8 @@ describe("Abilities - Ice Face", () => {
}); });
it("takes no damage from the first hit of multihit physical move and transforms to Noice", async () => { 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); game.override.enemyLevel(1);
await game.startBattle([Species.HITMONLEE]); await game.startBattle([Species.HITMONLEE]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SURGING_STRIKES)); game.doAttack(getMovePosition(game.scene, 0, Moves.SURGING_STRIKES));
@ -109,8 +108,8 @@ describe("Abilities - Ice Face", () => {
}); });
it("transforms to Ice Face when Hail or Snow starts", async () => { 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]);
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]); await game.startBattle([Species.MAGIKARP]);
@ -131,8 +130,8 @@ describe("Abilities - Ice Face", () => {
}); });
it("transforms to Ice Face when summoned on arena with active Snow or Hail", async () => { 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]); game.override.moveset([Moves.SNOWSCAPE]);
await game.startBattle([Species.EISCUE, Species.NINJASK]); await game.startBattle([Species.EISCUE, Species.NINJASK]);
@ -158,8 +157,8 @@ describe("Abilities - Ice Face", () => {
}); });
it("will not revert to its Ice Face if there is already Hail when it changes into Noice", async () => { 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]); game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.startBattle([Species.EISCUE]); await game.startBattle([Species.EISCUE]);
@ -178,7 +177,7 @@ describe("Abilities - Ice Face", () => {
}); });
it("persists form change when switched out", async () => { 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]); await game.startBattle([Species.EISCUE, Species.MAGIKARP]);
@ -202,10 +201,10 @@ describe("Abilities - Ice Face", () => {
}); });
it("reverts to Ice Face on arena reset", async () => { 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); game.override.startingLevel(4);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); game.override.enemySpecies(Species.MAGIKARP);
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ game.override.starterForms({
[Species.EISCUE]: noiceForm, [Species.EISCUE]: noiceForm,
}); });
@ -227,7 +226,7 @@ describe("Abilities - Ice Face", () => {
}); });
it("cannot be suppressed", async () => { 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]); await game.startBattle([Species.MAGIKARP]);
@ -243,7 +242,7 @@ describe("Abilities - Ice Face", () => {
}); });
it("cannot be swapped with another ability", async () => { 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]); await game.startBattle([Species.MAGIKARP]);
@ -259,7 +258,7 @@ describe("Abilities - Ice Face", () => {
}); });
it("cannot be copied", async () => { it("cannot be copied", async () => {
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.TRACE); game.override.ability(Abilities.TRACE);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);

View File

@ -2,13 +2,17 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vite
import Phaser from "phaser"; import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides"; import Overrides from "#app/overrides";
import { CommandPhase, DamagePhase, EncounterPhase, EnemyCommandPhase, SelectStarterPhase, TurnInitPhase } from "#app/phases";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import { BattleStat } from "#app/data/battle-stat"; import { BattleStat } from "#app/data/battle-stat";
import { generateStarter, getMovePosition } from "#app/test/utils/gameManagerUtils"; import { generateStarter, getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { Status, StatusEffect } from "#app/data/status-effect"; import { Status, StatusEffect } from "#app/data/status-effect";
import { GameModes, getGameMode } from "#app/game-mode"; import { GameModes, getGameMode } from "#app/game-mode";
import {
CommandPhase, DamagePhase, EncounterPhase,
EnemyCommandPhase, SelectStarterPhase,
TurnInitPhase,
} from "#app/phases";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
@ -30,13 +34,13 @@ describe("Abilities - Intimidate", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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); game.override.enemyPassiveAbility(Abilities.HYDRATION);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INTIMIDATE); game.override.ability(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]); game.override.enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]);
}); });
it("single - wild with switch", async () => { it("single - wild with switch", async () => {
@ -70,7 +74,7 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("single - boss should only trigger once then switch", async () => { 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]); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
game.onNextPrompt( game.onNextPrompt(
@ -100,7 +104,7 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("single - trainer should only trigger once with switch", async () => { 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]); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
game.onNextPrompt( game.onNextPrompt(
@ -130,8 +134,8 @@ describe("Abilities - Intimidate", () => {
}, 200000); }, 200000);
it("double - trainer should only trigger once per pokemon", async () => { it("double - trainer should only trigger once per pokemon", async () => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override.battleType("double");
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); game.override.startingWave(5);
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
game.onNextPrompt( game.onNextPrompt(
@ -157,8 +161,8 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("double - wild: should only trigger once per pokemon", async () => { it("double - wild: should only trigger once per pokemon", async () => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override.battleType("double");
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override.startingWave(3);
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
game.onNextPrompt( game.onNextPrompt(
@ -184,8 +188,8 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("double - boss: should only trigger once per pokemon", async () => { it("double - boss: should only trigger once per pokemon", async () => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override.battleType("double");
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(10); game.override.startingWave(10);
await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]); await game.runToSummon([Species.MIGHTYENA, Species.POOCHYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
game.onNextPrompt( game.onNextPrompt(
@ -211,8 +215,8 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("single - wild next wave opp triger once, us: none", async () => { 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]); game.override.moveset([Moves.AERIAL_ACE]);
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
@ -238,8 +242,8 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("single - wild next turn - no retrigger on next turn", async () => { 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]); game.override.moveset([Moves.SPLASH]);
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
@ -263,9 +267,9 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("single - trainer should only trigger once and each time he switch", async () => { 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]);
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]);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); game.override.startingWave(5);
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
@ -303,9 +307,9 @@ describe("Abilities - Intimidate", () => {
}, 200000); }, 200000);
it("single - trainer should only trigger once whatever turn we are", async () => { 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]);
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, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); game.override.startingWave(5);
await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]); await game.startBattle([Species.MIGHTYENA, Species.POOCHYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats; let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
@ -343,8 +347,8 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("double - wild vs only 1 on player side", async () => { it("double - wild vs only 1 on player side", async () => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override.battleType("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" }]); vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "COIN_CASE" }]);
await game.runToSummon([Species.MIGHTYENA]); await game.runToSummon([Species.MIGHTYENA]);
removeEnemyHeldItems(game.scene); removeEnemyHeldItems(game.scene);
@ -359,8 +363,8 @@ describe("Abilities - Intimidate", () => {
}, 20000); }, 20000);
it("double - wild vs only 1 alive on player side", async () => { it("double - wild vs only 1 alive on player side", async () => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override.battleType("double");
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override.startingWave(3);
await game.runToTitle(); await game.runToTitle();
game.onNextPrompt("TitlePhase", Mode.TITLE, () => { game.onNextPrompt("TitlePhase", Mode.TITLE, () => {

View File

@ -1,13 +1,12 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { BattleStat } from "#app/data/battle-stat";
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 { import {
CommandPhase, CommandPhase,
} from "#app/phases"; } 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", () => { describe("Abilities - Intrepid Sword", () => {
@ -26,10 +25,10 @@ describe("Abilities - Intrepid Sword", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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); game.override.ability(Abilities.INTREPID_SWORD);
}); });
it("INTREPID SWORD on player", async() => { it("INTREPID SWORD on player", async() => {

View File

@ -1,18 +1,18 @@
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 Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "../utils/gameManager"; 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 { getMovePosition } from "../utils/gameManagerUtils";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; import { SPLASH_ONLY } from "../utils/testUtils";
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";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -32,17 +32,17 @@ describe("Abilities - Protean", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.ability(Abilities.LIBERO);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.startingLevel(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]); game.override.enemyMoveset([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]);
}); });
test( test(
"ability applies and changes a pokemon's type", "ability applies and changes a pokemon's type",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.moveset([Moves.SPLASH]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -60,7 +60,7 @@ describe("Abilities - Protean", () => {
test.skip( test.skip(
"ability applies only once per switch in", "ability applies only once per switch in",
async () => { 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]); await game.startBattle([Species.MAGIKARP, Species.BULBASAUR]);
@ -100,7 +100,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move has a variable type", "ability applies correctly even if the pokemon's move has a variable type",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WEATHER_BALL]); game.override.moveset([Moves.WEATHER_BALL]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -123,8 +123,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the type has changed by another ability", "ability applies correctly even if the type has changed by another ability",
async () => { 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); game.override.passiveAbility(Abilities.REFRIGERATE);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -146,7 +146,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move calls another move", "ability applies correctly even if the pokemon's move calls another move",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.NATURE_POWER]); game.override.moveset([Moves.NATURE_POWER]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -165,7 +165,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move is delayed / charging", "ability applies correctly even if the pokemon's move is delayed / charging",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DIG]); game.override.moveset([Moves.DIG]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -183,8 +183,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move misses", "ability applies correctly even if the pokemon's move misses",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([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]); await game.startBattle([Species.MAGIKARP]);
@ -206,8 +206,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move is protected against", "ability applies correctly even if the pokemon's move is protected against",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([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]); await game.startBattle([Species.MAGIKARP]);
@ -225,8 +225,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move fails because of type immunity", "ability applies correctly even if the pokemon's move fails because of type immunity",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GASTLY); game.override.enemySpecies(Species.GASTLY);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -244,7 +244,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability is not applied if pokemon's type is the same as the move's type", "ability is not applied if pokemon's type is the same as the move's type",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.moveset([Moves.SPLASH]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -263,7 +263,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability is not applied if pokemon is terastallized", "ability is not applied if pokemon is terastallized",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.moveset([Moves.SPLASH]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -283,7 +283,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability is not applied if pokemon uses struggle", "ability is not applied if pokemon uses struggle",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STRUGGLE]); game.override.moveset([Moves.STRUGGLE]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -301,7 +301,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability is not applied if the pokemon's move fails", "ability is not applied if the pokemon's move fails",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BURN_UP]); game.override.moveset([Moves.BURN_UP]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -319,8 +319,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's Trick-or-Treat fails", "ability applies correctly even if the pokemon's Trick-or-Treat fails",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TRICK_OR_TREAT]); game.override.moveset([Moves.TRICK_OR_TREAT]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GASTLY); game.override.enemySpecies(Species.GASTLY);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -338,7 +338,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly and the pokemon curses itself", "ability applies correctly and the pokemon curses itself",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.CURSE]); game.override.moveset([Moves.CURSE]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);

View File

@ -1,20 +1,19 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { BattleStat } from "#app/data/battle-stat";
import Phaser from "phaser"; import { Stat } from "#app/data/pokemon-stat";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
CommandPhase, CommandPhase,
EnemyCommandPhase, EnemyCommandPhase,
VictoryPhase VictoryPhase
} from "#app/phases"; } from "#app/phases";
import {Mode} from "#app/ui/ui"; import GameManager from "#app/test/utils/gameManager";
import {Stat} from "#app/data/pokemon-stat"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { Command } from "#app/ui/command-ui-handler";
import {Command} from "#app/ui/command-ui-handler"; import { Mode } from "#app/ui/ui";
import {BattleStat} from "#app/data/battle-stat";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Abilities - Moxie", () => { describe("Abilities - Moxie", () => {
@ -34,13 +33,13 @@ describe("Abilities - Moxie", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.AERIAL_ACE; 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); 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); game.override.ability(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.moveset([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() => { it("MOXIE", async() => {

View File

@ -1,16 +1,16 @@
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 Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "../utils/gameManager"; 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 { getMovePosition } from "../utils/gameManagerUtils";
import { BerryPhase, CommandPhase, DamagePhase, MoveEffectPhase, MoveEndPhase, TurnEndPhase } from "#app/phases.js"; import { SPLASH_ONLY } from "../utils/testUtils";
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";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -30,20 +30,20 @@ describe("Abilities - Parental Bond", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.disableCrits();
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.PARENTAL_BOND); game.override.ability(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); 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); game.override.startingLevel(100);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(100);
}); });
test( test(
"ability should add second strike to attack move", "ability should add second strike to attack move",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -75,8 +75,8 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should apply secondary effects to both strikes", "ability should apply secondary effects to both strikes",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.POWER_UP_PUNCH]); game.override.moveset([Moves.POWER_UP_PUNCH]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.AMOONGUSS); game.override.enemySpecies(Species.AMOONGUSS);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -98,7 +98,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not apply to Status moves", "ability should not apply to Status moves",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BABY_DOLL_EYES]); game.override.moveset([Moves.BABY_DOLL_EYES]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -118,7 +118,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not apply to multi-hit moves", "ability should not apply to multi-hit moves",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DOUBLE_HIT]); game.override.moveset([Moves.DOUBLE_HIT]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -143,7 +143,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not apply to self-sacrifice moves", "ability should not apply to self-sacrifice moves",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SELF_DESTRUCT]); game.override.moveset([Moves.SELF_DESTRUCT]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -164,7 +164,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not apply to Rollout", "ability should not apply to Rollout",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ROLLOUT]); game.override.moveset([Moves.ROLLOUT]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -188,7 +188,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not apply multiplier to fixed-damage moves", "ability should not apply multiplier to fixed-damage moves",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_RAGE]); game.override.moveset([Moves.DRAGON_RAGE]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -210,8 +210,8 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not apply multiplier to counter moves", "ability should not apply multiplier to counter moves",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.COUNTER]); game.override.moveset([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]); await game.startBattle([Species.CHARIZARD]);
@ -238,8 +238,8 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not apply to multi-target moves", "ability should not apply to multi-target moves",
async () => { async () => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); 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]); await game.startBattle([Species.CHARIZARD, Species.PIDGEOT]);
@ -264,7 +264,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should apply to multi-target moves when hitting only one target", "ability should apply to multi-target moves when hitting only one target",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE]); game.override.moveset([Moves.EARTHQUAKE]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -284,7 +284,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should only trigger post-target move effects once", "ability should only trigger post-target move effects once",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.MIND_BLOWN]); game.override.moveset([Moves.MIND_BLOWN]);
await game.startBattle([Species.PIDGEOT]); await game.startBattle([Species.PIDGEOT]);
@ -310,7 +310,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"Burn Up only removes type after second strike with this ability", "Burn Up only removes type after second strike with this ability",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BURN_UP]); game.override.moveset([Moves.BURN_UP]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -337,8 +337,8 @@ describe("Abilities - Parental Bond", () => {
test( test(
"Moves boosted by this ability and Multi-Lens should strike 4 times", "Moves boosted by this ability and Multi-Lens should strike 4 times",
async () => { 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}]); game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -359,8 +359,8 @@ describe("Abilities - Parental Bond", () => {
test( test(
"Super Fang boosted by this ability and Multi-Lens should strike twice", "Super Fang boosted by this ability and Multi-Lens should strike twice",
async () => { 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}]); game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -390,8 +390,8 @@ describe("Abilities - Parental Bond", () => {
test( test(
"Seismic Toss boosted by this ability and Multi-Lens should strike twice", "Seismic Toss boosted by this ability and Multi-Lens should strike twice",
async () => { 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}]); game.override.startingHeldItems([{name: "MULTI_LENS", count: 1}]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -421,7 +421,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"Hyper Beam boosted by this ability should strike twice, then recharge", "Hyper Beam boosted by this ability should strike twice, then recharge",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HYPER_BEAM]); game.override.moveset([Moves.HYPER_BEAM]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -451,7 +451,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"Anchor Shot boosted by this ability should only trap the target after the second hit", "Anchor Shot boosted by this ability should only trap the target after the second hit",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.ANCHOR_SHOT]); game.override.moveset([Moves.ANCHOR_SHOT]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -483,7 +483,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"Smack Down boosted by this ability should only ground the target after the second hit", "Smack Down boosted by this ability should only ground the target after the second hit",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SMACK_DOWN]); game.override.moveset([Moves.SMACK_DOWN]);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -512,7 +512,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"U-turn boosted by this ability should strike twice before forcing a switch", "U-turn boosted by this ability should strike twice before forcing a switch",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.U_TURN]); game.override.moveset([Moves.U_TURN]);
await game.startBattle([Species.CHARIZARD, Species.BLASTOISE]); await game.startBattle([Species.CHARIZARD, Species.BLASTOISE]);
@ -538,8 +538,7 @@ describe("Abilities - Parental Bond", () => {
test( test(
"Wake-Up Slap boosted by this ability should only wake up the target after the second hit", "Wake-Up Slap boosted by this ability should only wake up the target after the second hit",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WAKE_UP_SLAP]); game.override.moveset([Moves.WAKE_UP_SLAP]).enemyStatusEffect(StatusEffect.SLEEP);
vi.spyOn(Overrides, "OPP_STATUS_OVERRIDE", "get").mockReturnValue(StatusEffect.SLEEP);
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -568,8 +567,8 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not cause user to hit into King's Shield more than once", "ability should not cause user to hit into King's Shield more than once",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([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]); await game.startBattle([Species.CHARIZARD]);
@ -590,8 +589,8 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not cause user to hit into Storm Drain more than once", "ability should not cause user to hit into Storm Drain more than once",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WATER_GUN]); game.override.moveset([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]); await game.startBattle([Species.CHARIZARD]);
@ -612,9 +611,9 @@ describe("Abilities - Parental Bond", () => {
test( test(
"ability should not apply to multi-target moves with Multi-Lens", "ability should not apply to multi-target moves with Multi-Lens",
async () => { 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]); 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]); await game.startBattle([Species.CHARIZARD, Species.PIDGEOT]);

View File

@ -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 GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#test/utils/gameManagerUtils";
import Overrides from "#app/overrides"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
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";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -28,10 +27,10 @@ describe("Abilities - POWER CONSTRUCT", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH; 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); game.override.ability(Abilities.POWER_CONSTRUCT);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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( test(
@ -39,8 +38,8 @@ describe("Abilities - POWER CONSTRUCT", () => {
async () => { async () => {
const baseForm = 2, const baseForm = 2,
completeForm = 4; completeForm = 4;
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); game.override.startingWave(4);
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ game.override.starterForms({
[Species.ZYGARDE]: completeForm, [Species.ZYGARDE]: completeForm,
}); });

View File

@ -1,13 +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 { allMoves } from "#app/data/move.js";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js";
import { Abilities } from "#app/enums/abilities.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", () => { describe("Abilities - Power Spot", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,11 +27,11 @@ describe("Abilities - Power Spot", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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]); game.override.moveset([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);
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); game.override.enemyAbility(Abilities.BALL_FETCH);
}); });
it("raises the power of allies' special moves by 30%", async () => { it("raises the power of allies' special moves by 30%", async () => {

View File

@ -1,18 +1,18 @@
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 Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "../utils/gameManager"; 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 { getMovePosition } from "../utils/gameManagerUtils";
import { MoveEffectPhase, TurnEndPhase } from "#app/phases.js"; import { SPLASH_ONLY } from "../utils/testUtils";
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";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -32,17 +32,17 @@ describe("Abilities - Protean", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.ability(Abilities.PROTEAN);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.startingLevel(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]); game.override.enemyMoveset([Moves.ENDURE, Moves.ENDURE, Moves.ENDURE, Moves.ENDURE]);
}); });
test( test(
"ability applies and changes a pokemon's type", "ability applies and changes a pokemon's type",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.moveset([Moves.SPLASH]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -60,7 +60,7 @@ describe("Abilities - Protean", () => {
test.skip( test.skip(
"ability applies only once per switch in", "ability applies only once per switch in",
async () => { 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]); await game.startBattle([Species.MAGIKARP, Species.BULBASAUR]);
@ -100,7 +100,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move has a variable type", "ability applies correctly even if the pokemon's move has a variable type",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.WEATHER_BALL]); game.override.moveset([Moves.WEATHER_BALL]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -123,8 +123,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the type has changed by another ability", "ability applies correctly even if the type has changed by another ability",
async () => { 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); game.override.passiveAbility(Abilities.REFRIGERATE);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -146,7 +146,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move calls another move", "ability applies correctly even if the pokemon's move calls another move",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.NATURE_POWER]); game.override.moveset([Moves.NATURE_POWER]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -165,7 +165,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move is delayed / charging", "ability applies correctly even if the pokemon's move is delayed / charging",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DIG]); game.override.moveset([Moves.DIG]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -183,8 +183,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move misses", "ability applies correctly even if the pokemon's move misses",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([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]); await game.startBattle([Species.MAGIKARP]);
@ -206,8 +206,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move is protected against", "ability applies correctly even if the pokemon's move is protected against",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([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]); await game.startBattle([Species.MAGIKARP]);
@ -225,8 +225,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's move fails because of type immunity", "ability applies correctly even if the pokemon's move fails because of type immunity",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([Moves.TACKLE]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GASTLY); game.override.enemySpecies(Species.GASTLY);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -244,7 +244,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability is not applied if pokemon's type is the same as the move's type", "ability is not applied if pokemon's type is the same as the move's type",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.moveset([Moves.SPLASH]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -263,7 +263,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability is not applied if pokemon is terastallized", "ability is not applied if pokemon is terastallized",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.moveset([Moves.SPLASH]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -283,7 +283,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability is not applied if pokemon uses struggle", "ability is not applied if pokemon uses struggle",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.STRUGGLE]); game.override.moveset([Moves.STRUGGLE]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -301,7 +301,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability is not applied if the pokemon's move fails", "ability is not applied if the pokemon's move fails",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.BURN_UP]); game.override.moveset([Moves.BURN_UP]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -319,8 +319,8 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly even if the pokemon's Trick-or-Treat fails", "ability applies correctly even if the pokemon's Trick-or-Treat fails",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TRICK_OR_TREAT]); game.override.moveset([Moves.TRICK_OR_TREAT]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GASTLY); game.override.enemySpecies(Species.GASTLY);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -338,7 +338,7 @@ describe("Abilities - Protean", () => {
test( test(
"ability applies correctly and the pokemon curses itself", "ability applies correctly and the pokemon curses itself",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.CURSE]); game.override.moveset([Moves.CURSE]);
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);

View File

@ -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 { 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"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
describe("Abilities - Quick Draw", () => { describe("Abilities - Quick Draw", () => {
@ -25,16 +24,16 @@ describe("Abilities - Quick Draw", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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]); game.override.moveset([Moves.TACKLE, Moves.TAIL_WHIP]);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(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); 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); vi.spyOn(allAbilities[Abilities.QUICK_DRAW].getAttrs(BypassSpeedChanceAbAttr)[0], "chance", "get").mockReturnValue(100);
}); });
@ -78,7 +77,7 @@ describe("Abilities - Quick Draw", () => {
); );
test("does not increase priority", async () => { 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(); await game.startBattle();

View File

@ -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 Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "../utils/gameManager"; 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 { 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; const TIMEOUT = 20 * 1000;
@ -29,14 +28,15 @@ describe("Abilities - Sand Veil", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override.moveset([Moves.SPLASH]);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.enemySpecies(Species.MEOWSCARADA);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEOWSCARADA); game.override.enemyAbility(Abilities.INSOMNIA);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); game.override.enemyMoveset([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]);
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TWISTER, Moves.TWISTER, Moves.TWISTER, Moves.TWISTER]); game.override.startingLevel(100);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(100);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override
vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(WeatherType.SANDSTORM); .weather(WeatherType.SANDSTORM)
.battleType("double");
}); });
test( test(

View File

@ -1,17 +1,16 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { BattleStat } from "#app/data/battle-stat.js";
import Phaser from "phaser"; import { TerrainType } from "#app/data/terrain.js";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
MoveEndPhase, TurnEndPhase, MoveEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import GameManager from "#app/test/utils/gameManager";
import { BattleStat } from "#app/data/battle-stat.js"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { TerrainType } from "#app/data/terrain.js";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
// See also: TypeImmunityAbAttr // See also: TypeImmunityAbAttr
describe("Abilities - Sap Sipper", () => { describe("Abilities - Sap Sipper", () => {
@ -30,18 +29,18 @@ describe("Abilities - Sap Sipper", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.disableCrits();
}); });
it("raise attack 1 level and block effects when activated against a grass attack", async() => { it("raise attack 1 level and block effects when activated against a grass attack", async() => {
const moveToUse = Moves.LEAFAGE; const moveToUse = Moves.LEAFAGE;
const enemyAbility = Abilities.SAP_SIPPER; const enemyAbility = Abilities.SAP_SIPPER;
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.DUSKULL); game.override.enemySpecies(Species.DUSKULL);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); game.override.enemyAbility(enemyAbility);
await game.startBattle(); await game.startBattle();
@ -59,10 +58,10 @@ describe("Abilities - Sap Sipper", () => {
const moveToUse = Moves.SPORE; const moveToUse = Moves.SPORE;
const enemyAbility = Abilities.SAP_SIPPER; const enemyAbility = Abilities.SAP_SIPPER;
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); game.override.enemySpecies(Species.RATTATA);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); game.override.enemyAbility(enemyAbility);
await game.startBattle(); await game.startBattle();
@ -78,10 +77,10 @@ describe("Abilities - Sap Sipper", () => {
const moveToUse = Moves.GRASSY_TERRAIN; const moveToUse = Moves.GRASSY_TERRAIN;
const enemyAbility = Abilities.SAP_SIPPER; const enemyAbility = Abilities.SAP_SIPPER;
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); game.override.enemySpecies(Species.RATTATA);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); game.override.enemyAbility(enemyAbility);
await game.startBattle(); await game.startBattle();
@ -98,10 +97,10 @@ describe("Abilities - Sap Sipper", () => {
const moveToUse = Moves.BULLET_SEED; const moveToUse = Moves.BULLET_SEED;
const enemyAbility = Abilities.SAP_SIPPER; const enemyAbility = Abilities.SAP_SIPPER;
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); game.override.enemySpecies(Species.RATTATA);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); game.override.enemyAbility(enemyAbility);
await game.startBattle(); await game.startBattle();
@ -119,11 +118,11 @@ describe("Abilities - Sap Sipper", () => {
const moveToUse = Moves.SPIKY_SHIELD; const moveToUse = Moves.SPIKY_SHIELD;
const ability = Abilities.SAP_SIPPER; const ability = Abilities.SAP_SIPPER;
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([moveToUse]);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); game.override.ability(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]);
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); game.override.enemyAbility(Abilities.NONE);
await game.startBattle(); await game.startBattle();
@ -145,10 +144,10 @@ describe("Abilities - Sap Sipper", () => {
const moveToUse = Moves.METRONOME; const moveToUse = Moves.METRONOME;
const enemyAbility = Abilities.SAP_SIPPER; const enemyAbility = Abilities.SAP_SIPPER;
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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]);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); game.override.enemySpecies(Species.RATTATA);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(enemyAbility); game.override.enemyAbility(enemyAbility);
await game.startBattle(); await game.startBattle();

View File

@ -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 GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#test/utils/gameManagerUtils";
import Overrides from "#app/overrides"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
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";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -28,10 +27,10 @@ describe("Abilities - SCHOOLING", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH; 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); game.override.ability(Abilities.SCHOOLING);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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( test(
@ -39,8 +38,8 @@ describe("Abilities - SCHOOLING", () => {
async () => { async () => {
const soloForm = 0, const soloForm = 0,
schoolForm = 1; schoolForm = 1;
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); game.override.startingWave(4);
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ game.override.starterForms({
[Species.WISHIWASHI]: schoolForm, [Species.WISHIWASHI]: schoolForm,
}); });

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { PostSummonPhase, TurnEndPhase, } from "#app/phases"; 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 { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; 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", () => { describe("Abilities - Screen Cleaner", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -25,14 +24,14 @@ describe("Abilities - Screen Cleaner", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.ability(Abilities.SCREEN_CLEANER);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SHUCKLE); game.override.enemySpecies(Species.SHUCKLE);
}); });
it("removes Aurora Veil", async () => { it("removes Aurora Veil", async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.HAIL]); game.override.moveset([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]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
@ -49,7 +48,7 @@ describe("Abilities - Screen Cleaner", () => {
}); });
it("removes Light Screen", async () => { 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]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]);
@ -66,7 +65,7 @@ describe("Abilities - Screen Cleaner", () => {
}); });
it("removes Reflect", async () => { 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]); await game.startBattle([Species.MAGIKARP, Species.MAGIKARP]);

View File

@ -1,20 +1,19 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { applyAbAttrs, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability";
import Phaser from "phaser"; import { Stat } from "#app/data/pokemon-stat";
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 { import {
CommandPhase, CommandPhase,
MoveEffectPhase, MoveEffectPhase,
} from "#app/phases"; } from "#app/phases";
import {Mode} from "#app/ui/ui"; import GameManager from "#app/test/utils/gameManager";
import {Stat} from "#app/data/pokemon-stat"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import {Moves} from "#enums/moves"; import { Command } from "#app/ui/command-ui-handler";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { Mode } from "#app/ui/ui";
import {Command} from "#app/ui/command-ui-handler";
import * as Utils from "#app/utils"; 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", () => { describe("Abilities - Serene Grace", () => {
@ -34,11 +33,11 @@ describe("Abilities - Serene Grace", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const movesToUse = [Moves.AIR_SLASH, Moves.TACKLE]; 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); 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.moveset(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() => { it("Move chance without Serene Grace", async() => {
@ -76,7 +75,7 @@ describe("Abilities - Serene Grace", () => {
it("Move chance with Serene Grace", async() => { it("Move chance with Serene Grace", async() => {
const moveToUse = Moves.AIR_SLASH; const moveToUse = Moves.AIR_SLASH;
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SERENE_GRACE); game.override.ability(Abilities.SERENE_GRACE);
await game.startBattle([ await game.startBattle([
Species.TOGEKISS Species.TOGEKISS
]); ]);

View File

@ -1,20 +1,19 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { applyAbAttrs, applyPostDefendAbAttrs, applyPreAttackAbAttrs, MoveEffectChanceMultiplierAbAttr, MovePowerBoostAbAttr, PostDefendTypeChangeAbAttr } from "#app/data/ability";
import Phaser from "phaser"; import { Stat } from "#app/data/pokemon-stat";
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 { import {
CommandPhase, CommandPhase,
MoveEffectPhase, MoveEffectPhase,
} from "#app/phases"; } from "#app/phases";
import {Mode} from "#app/ui/ui"; import GameManager from "#app/test/utils/gameManager";
import {Stat} from "#app/data/pokemon-stat"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import {Moves} from "#enums/moves"; import { Command } from "#app/ui/command-ui-handler";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { Mode } from "#app/ui/ui";
import {Command} from "#app/ui/command-ui-handler";
import * as Utils from "#app/utils"; 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", () => { describe("Abilities - Sheer Force", () => {
@ -34,16 +33,16 @@ describe("Abilities - Sheer Force", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const movesToUse = [Moves.AIR_SLASH, Moves.BIND, Moves.CRUSH_CLAW, Moves.TACKLE]; 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); 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.moveset(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() => { it("Sheer Force", async() => {
const moveToUse = Moves.AIR_SLASH; const moveToUse = Moves.AIR_SLASH;
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHEER_FORCE); game.override.ability(Abilities.SHEER_FORCE);
await game.startBattle([ await game.startBattle([
Species.PIDGEOT Species.PIDGEOT
]); ]);
@ -82,7 +81,7 @@ describe("Abilities - Sheer Force", () => {
it("Sheer Force with exceptions including binding moves", async() => { it("Sheer Force with exceptions including binding moves", async() => {
const moveToUse = Moves.BIND; const moveToUse = Moves.BIND;
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHEER_FORCE); game.override.ability(Abilities.SHEER_FORCE);
await game.startBattle([ await game.startBattle([
Species.PIDGEOT Species.PIDGEOT
]); ]);
@ -121,7 +120,7 @@ describe("Abilities - Sheer Force", () => {
it("Sheer Force with moves with no secondary effect", async() => { it("Sheer Force with moves with no secondary effect", async() => {
const moveToUse = Moves.TACKLE; const moveToUse = Moves.TACKLE;
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHEER_FORCE); game.override.ability(Abilities.SHEER_FORCE);
await game.startBattle([ await game.startBattle([
Species.PIDGEOT Species.PIDGEOT
]); ]);
@ -160,9 +159,9 @@ describe("Abilities - Sheer Force", () => {
it("Sheer Force Disabling Specific Abilities", async() => { it("Sheer Force Disabling Specific Abilities", async() => {
const moveToUse = Moves.CRUSH_CLAW; 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}]); game.override.startingHeldItems([{name: "KINGS_ROCK", count: 1}]);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHEER_FORCE); game.override.ability(Abilities.SHEER_FORCE);
await game.startBattle([ await game.startBattle([
Species.PIDGEOT Species.PIDGEOT
]); ]);

View File

@ -1,20 +1,19 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { applyAbAttrs, applyPreDefendAbAttrs, IgnoreMoveEffectsAbAttr, MoveEffectChanceMultiplierAbAttr } from "#app/data/ability";
import Phaser from "phaser"; import { Stat } from "#app/data/pokemon-stat";
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 { import {
CommandPhase, CommandPhase,
MoveEffectPhase, MoveEffectPhase,
} from "#app/phases"; } from "#app/phases";
import {Mode} from "#app/ui/ui"; import GameManager from "#app/test/utils/gameManager";
import {Stat} from "#app/data/pokemon-stat"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import {Moves} from "#enums/moves"; import { Command } from "#app/ui/command-ui-handler";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { Mode } from "#app/ui/ui";
import {Command} from "#app/ui/command-ui-handler";
import * as Utils from "#app/utils"; 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", () => { describe("Abilities - Shield Dust", () => {
@ -34,12 +33,12 @@ describe("Abilities - Shield Dust", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const movesToUse = [Moves.AIR_SLASH]; 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); 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); game.override.startingLevel(100);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue(movesToUse); game.override.moveset(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() => { it("Shield Dust", async() => {

View File

@ -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 GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#test/utils/gameManagerUtils";
import Overrides from "#app/overrides"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
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";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -28,10 +27,10 @@ describe("Abilities - SHIELDS DOWN", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH; 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); game.override.ability(Abilities.SHIELDS_DOWN);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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( test(
@ -39,8 +38,8 @@ describe("Abilities - SHIELDS DOWN", () => {
async () => { async () => {
const meteorForm = 0, const meteorForm = 0,
coreForm = 7; coreForm = 7;
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); game.override.startingWave(4);
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ game.override.starterForms({
[Species.MINIOR]: coreForm, [Species.MINIOR]: coreForm,
}); });

View File

@ -1,14 +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 { 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 { allAbilities } from "#app/data/ability.js";
import { allMoves } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { MoveEffectPhase, SelectTargetPhase } from "#app/phases.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", () => { describe("Abilities - Steely Spirit", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -29,11 +29,11 @@ describe("Abilities - Steely Spirit", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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]); game.override.moveset([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"); vi.spyOn(allMoves[moveToCheck], "calculateBattlePower");
}); });

View File

@ -1,16 +1,15 @@
import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; import { EnemyPokemon } from "#app/field/pokemon.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
DamagePhase, DamagePhase,
MoveEndPhase, MoveEndPhase,
} from "#app/phases"; } 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 { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; 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; const TIMEOUT = 20 * 1000;
@ -30,15 +29,15 @@ describe("Abilities - Sturdy", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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.moveset([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); game.override.enemyLevel(5);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.STURDY); game.override.enemyAbility(Abilities.STURDY);
}); });
test( test(
@ -85,7 +84,7 @@ describe("Abilities - Sturdy", () => {
test( test(
"Sturdy is ignored by pokemon with `Abilities.MOLD_BREAKER`", "Sturdy is ignored by pokemon with `Abilities.MOLD_BREAKER`",
async () => { async () => {
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.MOLD_BREAKER); game.override.ability(Abilities.MOLD_BREAKER);
await game.startBattle(); await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT)); game.doAttack(getMovePosition(game.scene, 0, Moves.CLOSE_COMBAT));

View File

@ -1,12 +1,11 @@
import Phaser from "phaser"; import { TurnEndPhase } from "#app/phases.js";
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 { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; 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 { getMovePosition } from "../utils/gameManagerUtils";
import { TurnEndPhase } from "#app/phases.js";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -26,12 +25,12 @@ describe("Abilities - Unseen Fist", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.starterSpecies(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]); 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); game.override.enemyLevel(100);
}); });
test( test(
@ -49,7 +48,7 @@ describe("Abilities - Unseen Fist", () => {
test( test(
"ability does not apply if the source has Long Reach", "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); testUnseenFistHitResult(game, Moves.QUICK_ATTACK, Moves.PROTECT, false);
}, TIMEOUT }, TIMEOUT
); );
@ -68,8 +67,8 @@ describe("Abilities - Unseen Fist", () => {
}); });
async function testUnseenFistHitResult(game: GameManager, attackMove: Moves, protectMove: Moves, shouldSucceed: boolean = true): Promise<void> { async function testUnseenFistHitResult(game: GameManager, attackMove: Moves, protectMove: Moves, shouldSucceed: boolean = true): Promise<void> {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([attackMove]); game.override.moveset([attackMove]);
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([protectMove, protectMove, protectMove, protectMove]); game.override.enemyMoveset([protectMove, protectMove, protectMove, protectMove]);
await game.startBattle(); await game.startBattle();

View File

@ -1,16 +1,15 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { BattleStat } from "#app/data/battle-stat.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import GameManager from "#app/test/utils/gameManager";
import { BattleStat } from "#app/data/battle-stat.js"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
// See also: TypeImmunityAbAttr // See also: TypeImmunityAbAttr
describe("Abilities - Volt Absorb", () => { describe("Abilities - Volt Absorb", () => {
@ -29,19 +28,19 @@ describe("Abilities - Volt Absorb", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.disableCrits();
}); });
it("does not activate when CHARGE is used", async () => { it("does not activate when CHARGE is used", async () => {
const moveToUse = Moves.CHARGE; const moveToUse = Moves.CHARGE;
const ability = Abilities.VOLT_ABSORB; const ability = Abilities.VOLT_ABSORB;
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([moveToUse]);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); game.override.ability(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]);
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); game.override.enemyAbility(Abilities.BALL_FETCH);
await game.startBattle(); await game.startBattle();

View File

@ -1,15 +1,15 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { import {
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; 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", () => { describe("Abilities - Wind Power", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,11 +27,11 @@ describe("Abilities - Wind Power", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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]); game.override.moveset([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 () => { it("it becomes charged when hit by wind moves", async () => {
@ -47,8 +47,8 @@ describe("Abilities - Wind Power", () => {
}); });
it("it becomes charged when Tailwind takes effect on its side", async () => { 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);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); game.override.enemySpecies(Species.MAGIKARP);
await game.startBattle([Species.SHIFTRY]); await game.startBattle([Species.SHIFTRY]);
const shiftry = game.scene.getPlayerPokemon(); const shiftry = game.scene.getPlayerPokemon();
@ -62,8 +62,8 @@ describe("Abilities - Wind Power", () => {
}); });
it("does not become charged when Tailwind takes effect on opposing side", async () => { 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); game.override.ability(Abilities.WIND_POWER);
await game.startBattle([Species.SHIFTRY]); await game.startBattle([Species.SHIFTRY]);
const magikarp = game.scene.getEnemyPokemon(); const magikarp = game.scene.getEnemyPokemon();
@ -81,7 +81,7 @@ describe("Abilities - Wind Power", () => {
}); });
it("does not interact with Sandstorm", async () => { 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]); await game.startBattle([Species.SHIFTRY]);
const shiftry = game.scene.getPlayerPokemon(); const shiftry = game.scene.getPlayerPokemon();

View File

@ -1,15 +1,15 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattleStat } from "#app/data/battle-stat.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { import {
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; 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", () => { describe("Abilities - Wind Rider", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,11 +27,11 @@ describe("Abilities - Wind Rider", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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]); game.override.moveset([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 () => { it("takes no damage from wind moves and its Attack is increased by one stage when hit by one", async () => {
@ -49,8 +49,8 @@ describe("Abilities - Wind Rider", () => {
}); });
it("Attack is increased by one stage when Tailwind is present on its side", async () => { 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);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); game.override.enemySpecies(Species.MAGIKARP);
await game.startBattle([Species.SHIFTRY]); await game.startBattle([Species.SHIFTRY]);
const shiftry = game.scene.getPlayerPokemon(); const shiftry = game.scene.getPlayerPokemon();
@ -65,8 +65,8 @@ describe("Abilities - Wind Rider", () => {
}); });
it("does not increase Attack when Tailwind is present on opposing side", async () => { 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);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); game.override.enemySpecies(Species.MAGIKARP);
await game.startBattle([Species.SHIFTRY]); await game.startBattle([Species.SHIFTRY]);
const magikarp = game.scene.getEnemyPokemon(); 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 () => { 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]); await game.startBattle([Species.SHIFTRY]);
const magikarp = game.scene.getEnemyPokemon(); const magikarp = game.scene.getEnemyPokemon();
@ -102,7 +102,7 @@ describe("Abilities - Wind Rider", () => {
}); });
it("does not interact with Sandstorm", async () => { 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]); await game.startBattle([Species.SHIFTRY]);
const shiftry = game.scene.getPlayerPokemon(); const shiftry = game.scene.getPlayerPokemon();

View File

@ -1,14 +1,14 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { allAbilities } from "#app/data/ability.js";
import Phaser from "phaser"; import { allMoves } from "#app/data/move.js";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { MoveEffectPhase } from "#app/phases"; 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 { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { allMoves } from "#app/data/move.js"; import { Moves } from "#enums/moves";
import { allAbilities } from "#app/data/ability.js"; 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", () => { describe("Abilities - Wonder Skin", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,12 +26,12 @@ describe("Abilities - Wonder Skin", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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]); game.override.moveset([Moves.TACKLE, Moves.CHARM]);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.ability(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); 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 () => { it("lowers accuracy of status moves to 50%", async () => {
@ -64,7 +64,7 @@ describe("Abilities - Wonder Skin", () => {
it(`does not affect pokemon with ${allAbilities[ability].name}`, async () => { it(`does not affect pokemon with ${allAbilities[ability].name}`, async () => {
const moveToCheck = allMoves[Moves.CHARM]; const moveToCheck = allMoves[Moves.CHARM];
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(ability); game.override.ability(ability);
vi.spyOn(moveToCheck, "calculateBattleAccuracy"); vi.spyOn(moveToCheck, "calculateBattleAccuracy");
await game.startBattle([Species.PIKACHU]); await game.startBattle([Species.PIKACHU]);

View File

@ -1,7 +1,6 @@
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { Stat } from "#app/data/pokemon-stat";
import Phaser from "phaser"; import { Status, StatusEffect } from "#app/data/status-effect.js";
import GameManager from "#app/test/utils/gameManager"; import { QuietFormChangePhase } from "#app/form-change-phase";
import Overrides from "#app/overrides";
import { import {
CommandPhase, CommandPhase,
DamagePhase, DamagePhase,
@ -14,15 +13,15 @@ import {
TurnInitPhase, TurnInitPhase,
TurnStartPhase, TurnStartPhase,
} from "#app/phases"; } from "#app/phases";
import { Mode } from "#app/ui/ui"; import GameManager from "#app/test/utils/gameManager";
import { Stat } from "#app/data/pokemon-stat";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Command } from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import { QuietFormChangePhase } from "#app/form-change-phase"; import { Mode } from "#app/ui/ui";
import { Status, StatusEffect } from "#app/data/status-effect.js";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -43,13 +42,13 @@ describe("Abilities - ZEN MODE", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH; 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); 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); game.override.ability(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.moveset([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( test(
@ -153,8 +152,8 @@ describe("Abilities - ZEN MODE", () => {
async () => { async () => {
const baseForm = 0, const baseForm = 0,
zenForm = 1; zenForm = 1;
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); game.override.startingWave(4);
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ game.override.starterForms({
[Species.DARMANITAN]: zenForm, [Species.DARMANITAN]: zenForm,
}); });

View File

@ -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 GameManager from "#test/utils/gameManager";
import { getMovePosition } from "#test/utils/gameManagerUtils"; import { getMovePosition } from "#test/utils/gameManagerUtils";
import Overrides from "#app/overrides"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
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";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -28,10 +27,10 @@ describe("Abilities - ZERO TO HERO", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH; 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); game.override.ability(Abilities.ZERO_TO_HERO);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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( test(
@ -39,8 +38,8 @@ describe("Abilities - ZERO TO HERO", () => {
async () => { async () => {
const baseForm = 0, const baseForm = 0,
heroForm = 1; heroForm = 1;
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4); game.override.startingWave(4);
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({ game.override.starterForms({
[Species.PALAFIN]: heroForm, [Species.PALAFIN]: heroForm,
}); });

View File

@ -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 { 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 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", () => { describe("check some Achievement related stuff", () => {
it ("should check Achievement creation", () => { it ("should check Achievement creation", () => {
@ -103,13 +102,13 @@ describe("RibbonAchv", () => {
}); });
beforeEach(() => { 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, "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 = new GameManager(phaserGame);
game.override.moveset([]);
game.override.startingLevel(0);
game.override.starterSpecies(0);
game.override.enemyMoveset([]);
game.override.enemySpecies(0);
game.override.startingWave(0);
scene = game.scene; scene = game.scene;
}); });

View File

@ -1,17 +1,16 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { allMoves } from "#app/data/move.js";
import Phaser from "phaser"; import { Abilities } from "#app/enums/abilities.js";
import GameManager from "#app/test/utils/gameManager"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { import {
MoveEffectPhase, MoveEffectPhase,
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { allMoves } from "#app/data/move.js"; import { Moves } from "#enums/moves";
import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { Species } from "#enums/species";
import { Abilities } from "#app/enums/abilities.js"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Arena - Gravity", () => { describe("Arena - Gravity", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -29,12 +28,12 @@ describe("Arena - Gravity", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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]); game.override.moveset([Moves.TACKLE, Moves.GRAVITY, Moves.FISSURE]);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); game.override.ability(Abilities.UNNERVE);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemyAbility(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)); game.override.enemyMoveset(new Array(4).fill(Moves.SPLASH));
}); });
it("non-OHKO move accuracy is multiplied by 1.67", async () => { it("non-OHKO move accuracy is multiplied by 1.67", async () => {
@ -58,8 +57,8 @@ describe("Arena - Gravity", () => {
}); });
it("OHKO move accuracy is not affected", async () => { 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); game.override.enemyLevel(5);
/** See Fissure {@link https://bulbapedia.bulbagarden.net/wiki/Fissure_(move)} */ /** See Fissure {@link https://bulbapedia.bulbagarden.net/wiki/Fissure_(move)} */
const moveToCheck = allMoves[Moves.FISSURE]; const moveToCheck = allMoves[Moves.FISSURE];

View File

@ -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 { allMoves } from "#app/data/move.js";
import { WeatherType } from "#app/data/weather.js"; import { WeatherType } from "#app/data/weather.js";
import { Abilities } from "#app/enums/abilities.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", () => { describe("Weather - Fog", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -28,13 +27,14 @@ describe("Weather - Fog", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
vi.spyOn(Overrides, "WEATHER_OVERRIDE", "get").mockReturnValue(WeatherType.FOG); game.override
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); .weather(WeatherType.FOG)
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); .battleType("single");
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.moveset([Moves.TACKLE]);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.ability(Abilities.BALL_FETCH);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MAGIKARP); game.override.enemyAbility(Abilities.BALL_FETCH);
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(new Array(4).fill(Moves.SPLASH)); game.override.enemySpecies(Species.MAGIKARP);
game.override.enemyMoveset(new Array(4).fill(Moves.SPLASH));
}); });
it("move accuracy is multiplied by 90%", async () => { it("move accuracy is multiplied by 90%", async () => {

View File

@ -1,15 +1,14 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { allMoves } from "#app/data/move.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { import {
TurnStartPhase, TurnStartPhase,
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; 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", () => { describe("Weather - Strong Winds", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,15 +26,15 @@ describe("Weather - Strong Winds", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.startingLevel(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); 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 () => { 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]); await game.startBattle([Species.PIKACHU]);
const pikachu = game.scene.getPlayerPokemon(); const pikachu = game.scene.getPlayerPokemon();

View File

@ -1,20 +1,19 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { Stat } from "#app/data/pokemon-stat";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
CommandPhase, EnemyCommandPhase, SelectTargetPhase, CommandPhase, EnemyCommandPhase, SelectTargetPhase,
TurnStartPhase TurnStartPhase
} from "#app/phases"; } from "#app/phases";
import {Mode} from "#app/ui/ui"; import GameManager from "#app/test/utils/gameManager";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import {Command} from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import {Stat} from "#app/data/pokemon-stat";
import TargetSelectUiHandler from "#app/ui/target-select-ui-handler"; import TargetSelectUiHandler from "#app/ui/target-select-ui-handler";
import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Button } from "#enums/buttons";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; 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", () => { describe("Battle order", () => {
@ -33,11 +32,11 @@ describe("Battle order", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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); 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() => { it("opponent faster than player 50 vs 150", async() => {
@ -83,7 +82,7 @@ describe("Battle order", () => {
}, 20000); }, 20000);
it("double - both opponents faster than player 50/50 vs 150/150", async() => { 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([ await game.startBattle([
Species.BULBASAUR, Species.BULBASAUR,
Species.BLASTOISE, Species.BLASTOISE,
@ -125,7 +124,7 @@ describe("Battle order", () => {
}, 20000); }, 20000);
it("double - speed tie except 1 - 100/100 vs 100/150", async() => { 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([ await game.startBattle([
Species.BULBASAUR, Species.BULBASAUR,
Species.BLASTOISE, Species.BLASTOISE,
@ -166,7 +165,7 @@ describe("Battle order", () => {
}, 20000); }, 20000);
it("double - speed tie 100/150 vs 100/150", async() => { 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([ await game.startBattle([
Species.BULBASAUR, Species.BULBASAUR,
Species.BLASTOISE, Species.BLASTOISE,

View File

@ -1,9 +1,6 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { allSpecies } from "#app/data/pokemon-species";
import {generateStarter, getMovePosition,} from "#app/test/utils/gameManagerUtils"; import { GameModes } from "#app/game-mode";
import {Mode} from "#app/ui/ui"; import { getGameMode } from "#app/game-mode.js";
import {GameModes} from "#app/game-mode";
import Overrides from "#app/overrides";
import {Command} from "#app/ui/command-ui-handler";
import { import {
CommandPhase, DamagePhase, CommandPhase, DamagePhase,
EncounterPhase, EncounterPhase,
@ -17,13 +14,15 @@ import {
TurnInitPhase, VictoryPhase, TurnInitPhase, VictoryPhase,
} from "#app/phases"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Phaser from "phaser"; import { generateStarter, getMovePosition, } from "#app/test/utils/gameManagerUtils";
import {allSpecies} from "#app/data/pokemon-species"; import { Command } from "#app/ui/command-ui-handler";
import { getGameMode } from "#app/game-mode.js"; import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { PlayerGender } from "#enums/player-gender"; import { PlayerGender } from "#enums/player-gender";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Test Battle Phase", () => { describe("Test Battle Phase", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -90,14 +89,15 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("do attack wave 3 - single battle - regular - OHKO", async() => { 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);
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.startingLevel(2000);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); .startingWave(3)
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); .battleType("single");
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]); game.override.moveset([Moves.TACKLE]);
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override.enemyAbility(Abilities.HYDRATION);
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
await game.startBattle(); await game.startBattle();
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex()); game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
@ -110,14 +110,14 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("do attack wave 3 - single battle - regular - NO OHKO with opponent using non damage attack", async() => { 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);
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.startingLevel(5);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override.startingWave(3);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([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.enemyMoveset([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(); await game.startBattle();
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => { game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex()); game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
@ -204,10 +204,10 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("2vs1", async() => { 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); 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.ability(Abilities.HYDRATION);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -217,10 +217,10 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("1vs1", async() => { 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); 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.ability(Abilities.HYDRATION);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
]); ]);
@ -229,11 +229,11 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("2vs2", async() => { 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); 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.ability(Abilities.HYDRATION);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override.startingWave(3);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -243,11 +243,11 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("4vs2", async() => { 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); 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.ability(Abilities.HYDRATION);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override.startingWave(3);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -260,15 +260,15 @@ describe("Test Battle Phase", () => {
it("kill opponent pokemon", async() => { it("kill opponent pokemon", async() => {
const moveToUse = Moves.SPLASH; 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); game.override.starterSpecies(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); game.override.enemyAbility(Abilities.HYDRATION);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); game.override.ability(Abilities.ZEN_MODE);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.startingLevel(2000);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override.startingWave(3);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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([ await game.startBattle([
Species.DARMANITAN, Species.DARMANITAN,
Species.CHARIZARD, Species.CHARIZARD,
@ -289,15 +289,15 @@ describe("Test Battle Phase", () => {
it("to next turn", async() => { it("to next turn", async() => {
const moveToUse = Moves.SPLASH; 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); game.override.starterSpecies(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); game.override.enemyAbility(Abilities.HYDRATION);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); game.override.ability(Abilities.ZEN_MODE);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.startingLevel(2000);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override.startingWave(3);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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(); await game.startBattle();
const turn = game.scene.currentBattle.turn; const turn = game.scene.currentBattle.turn;
game.doAttack(0); game.doAttack(0);
@ -307,15 +307,15 @@ describe("Test Battle Phase", () => {
it("to next wave with pokemon killed, single", async() => { it("to next wave with pokemon killed, single", async() => {
const moveToUse = Moves.SPLASH; 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); game.override.starterSpecies(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); game.override.enemyAbility(Abilities.HYDRATION);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); game.override.ability(Abilities.ZEN_MODE);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.startingLevel(2000);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override.startingWave(3);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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(); await game.startBattle();
const waveIndex = game.scene.currentBattle.waveIndex; const waveIndex = game.scene.currentBattle.waveIndex;
game.doAttack(0); game.doAttack(0);

View File

@ -1,10 +1,9 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest";
import GameManager from "#app/test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Phaser from "phaser";
import Overrides from "#app/overrides";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Test Battle Phase", () => { describe("Test Battle Phase", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -23,15 +22,16 @@ describe("Test Battle Phase", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.SPLASH; const moveToUse = Moves.SPLASH;
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override
vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.MEWTWO); .battleType("single")
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA); .startingWave(3);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.HYDRATION); game.override.starterSpecies(Species.MEWTWO);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ZEN_MODE); game.override.enemySpecies(Species.RATTATA);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.enemyAbility(Abilities.HYDRATION);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(3); game.override.ability(Abilities.ZEN_MODE);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.startingLevel(2000);
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]); game.override.moveset([moveToUse]);
game.override.enemyMoveset([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]);
}); });
it.skip("to next turn", async() => { it.skip("to next turn", async() => {

View File

@ -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 { import {
CommandPhase, CommandPhase,
} from "#app/phases"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Phaser from "phaser"; import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Test Battle Phase", () => { describe("Test Battle Phase", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,17 +25,18 @@ describe("Test Battle Phase", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.startingLevel(2000);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE]); game.override.moveset([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); game.override.ability(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() => { it("startBattle 2vs1 boss", async() => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(10); .battleType("single")
.startingWave(10);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -46,8 +46,9 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("startBattle 2vs2 boss", async() => { it("startBattle 2vs2 boss", async() => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(10); .battleType("double")
.startingWave(10);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -57,8 +58,9 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("startBattle 2vs2 trainer", async() => { it("startBattle 2vs2 trainer", async() => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); .battleType("double")
.startingWave(5);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -68,8 +70,9 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("startBattle 2vs1 trainer", async() => { it("startBattle 2vs1 trainer", async() => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); .battleType("single")
.startingWave(5);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -79,8 +82,9 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("startBattle 2vs1 rival", async() => { it("startBattle 2vs1 rival", async() => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(8); .battleType("single")
.startingWave(8);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -90,8 +94,9 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("startBattle 2vs2 rival", async() => { it("startBattle 2vs2 rival", async() => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(8); .battleType("double")
.startingWave(8);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -101,8 +106,9 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("startBattle 1vs1 trainer", async() => { it("startBattle 1vs1 trainer", async() => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); .battleType("single")
.startingWave(5);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
]); ]);
@ -111,8 +117,9 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("startBattle 2vs2 trainer", async() => { it("startBattle 2vs2 trainer", async() => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); .battleType("double")
.startingWave(5);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,
@ -122,8 +129,9 @@ describe("Test Battle Phase", () => {
}, 20000); }, 20000);
it("startBattle 4vs2 trainer", async() => { it("startBattle 4vs2 trainer", async() => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); .battleType("double")
.startingWave(5);
await game.startBattle([ await game.startBattle([
Species.BLASTOISE, Species.BLASTOISE,
Species.CHARIZARD, Species.CHARIZARD,

View File

@ -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 { 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", () => { describe("Evolution", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -24,12 +23,12 @@ describe("Evolution", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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); game.override.startingLevel(60);
}); });
it("should keep hidden ability after evolving", async () => { it("should keep hidden ability after evolving", async () => {

View File

@ -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 { Stat } from "#app/data/pokemon-stat";
import { EvolutionStatBoosterModifier } from "#app/modifier/modifier"; import { EvolutionStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n"; 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 { Species } from "#enums/species";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Items - Eviolite", () => { describe("Items - Eviolite", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,11 +25,11 @@ describe("Items - Eviolite", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override.battleType("single");
}); });
it("EVIOLITE activates in battle correctly", async() => { 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"); const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([ await game.startBattle([
Species.PICHU Species.PICHU

View File

@ -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 { Abilities } from "#app/enums/abilities.js";
import { PokemonExpBoosterModifier } from "#app/modifier/modifier.js"; import { PokemonExpBoosterModifier } from "#app/modifier/modifier.js";
import GameManager from "#app/test/utils/gameManager";
import * as Utils from "#app/utils"; import * as Utils from "#app/utils";
import Phase from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("EXP Modifier Items", () => { describe("EXP Modifier Items", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -23,13 +22,13 @@ describe("EXP Modifier Items", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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.ability(Abilities.BALL_FETCH);
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override.battleType("single");
}); });
it("EXP booster items stack additively", async() => { 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(); await game.startBattle();
const partyMember = game.scene.getPlayerPokemon(); const partyMember = game.scene.getPlayerPokemon();

View File

@ -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 { BattlerIndex } from "#app/battle.js";
import { allMoves } from "#app/data/move.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 const TIMEOUT = 20 * 1000; // 20 seconds
@ -30,18 +29,22 @@ describe("Items - Grip Claw", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POPULATION_BOMB, Moves.SPLASH ]); .battleType("double")
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "GRIP_CLAW", count: 5}, {name: "MULTI_LENS", count: 3}]); .moveset([Moves.POPULATION_BOMB, Moves.SPLASH])
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); .startingHeldItems([
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.KLUTZ); { name: "GRIP_CLAW", count: 5 },
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]); { name: "MULTI_LENS", count: 3 },
vi.spyOn(Overrides, "OPP_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([ ])
{name: "BERRY", type: BerryType.SITRUS, count: 2}, .enemySpecies(Species.SNORLAX)
{name: "BERRY", type: BerryType.LUM, count: 2} .ability(Abilities.KLUTZ)
]); .enemyMoveset([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH])
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); .enemyHeldItems([
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); { 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); vi.spyOn(allMoves[Moves.POPULATION_BOMB], "accuracy", "get").mockReturnValue(100);
}); });

View File

@ -1,14 +1,13 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattlerIndex } from "#app/battle";
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 { CritBoosterModifier } from "#app/modifier/modifier"; import { CritBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import { MoveEffectPhase, TurnStartPhase } from "#app/phases"; 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", () => { describe("Items - Leek", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,16 +26,16 @@ describe("Items - Leek", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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 ]); game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]);
vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.disableCrits();
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override.battleType("single");
}); });
it("LEEK activates in battle correctly", async() => { it("LEEK activates in battle correctly", async() => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{ name: "LEEK" }]); game.override.startingHeldItems([{ name: "LEEK" }]);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POUND ]); game.override.moveset([ Moves.POUND ]);
const consoleSpy = vi.spyOn(console, "log"); const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([ await game.startBattle([
Species.FARFETCHD Species.FARFETCHD

View File

@ -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 { DamagePhase, TurnEndPhase } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Items - Leftovers", () => { describe("Items - Leftovers", () => {
@ -25,14 +24,14 @@ describe("Items - Leftovers", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.startingLevel(2000);
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); game.override.ability(Abilities.UNNERVE);
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH]); game.override.moveset([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); 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}]); game.override.startingHeldItems([{name: "LEFTOVERS", count: 1}]);
}); });
it("leftovers works", async() => { it("leftovers works", async() => {

View File

@ -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 { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n"; 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", () => { describe("Items - Light Ball", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,11 +25,11 @@ describe("Items - Light Ball", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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() => { 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"); const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([ await game.startBattle([
Species.PIKACHU Species.PIKACHU

View File

@ -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 { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n"; 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", () => { describe("Items - Metal Powder", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,11 +25,11 @@ describe("Items - Metal Powder", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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() => { 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"); const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([ await game.startBattle([
Species.DITTO Species.DITTO

View File

@ -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 { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n"; 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", () => { describe("Items - Quick Powder", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,11 +25,11 @@ describe("Items - Quick Powder", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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() => { 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"); const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([ await game.startBattle([
Species.DITTO Species.DITTO

View File

@ -1,14 +1,13 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattlerIndex } from "#app/battle";
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 { CritBoosterModifier } from "#app/modifier/modifier"; import { CritBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import { MoveEffectPhase, TurnStartPhase } from "#app/phases"; 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", () => { describe("Items - Scope Lens", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,16 +26,16 @@ describe("Items - Scope Lens", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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 ]); game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]);
vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.disableCrits();
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override.battleType("single");
}, 20000); }, 20000);
it("SCOPE_LENS activates in battle correctly", async() => { 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" }]);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.POUND ]); game.override.moveset([ Moves.POUND ]);
const consoleSpy = vi.spyOn(console, "log"); const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([ await game.startBattle([
Species.GASTLY Species.GASTLY

View File

@ -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 { Stat } from "#app/data/pokemon-stat";
import { SpeciesStatBoosterModifier } from "#app/modifier/modifier"; import { SpeciesStatBoosterModifier } from "#app/modifier/modifier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
import * as Utils from "#app/utils";
import i18next from "#app/plugins/i18n"; 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", () => { describe("Items - Thick Club", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,11 +25,11 @@ describe("Items - Thick Club", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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() => { 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"); const consoleSpy = vi.spyOn(console, "log");
await game.startBattle([ await game.startBattle([
Species.CUBONE Species.CUBONE

View File

@ -1,21 +1,20 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { StatusEffect } from "#app/data/status-effect";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
CommandPhase, CommandPhase,
EnemyCommandPhase, EnemyCommandPhase,
MessagePhase, MessagePhase,
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import {Mode} from "#app/ui/ui"; import i18next, { initI18n } from "#app/plugins/i18n";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import GameManager from "#app/test/utils/gameManager";
import {Command} from "#app/ui/command-ui-handler"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import {StatusEffect} from "#app/data/status-effect"; import { Command } from "#app/ui/command-ui-handler";
import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; 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", () => { describe("Items - Toxic orb", () => {
@ -36,14 +35,14 @@ describe("Items - Toxic orb", () => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.GROWTH; const moveToUse = Moves.GROWTH;
const oppMoveToUse = Moves.TACKLE; 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); game.override.enemySpecies(Species.RATTATA);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA); game.override.ability(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); game.override.startingLevel(2000);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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([{ game.override.startingHeldItems([{
name: "TOXIC_ORB", name: "TOXIC_ORB",
}]); }]);
}); });

View File

@ -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 { 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 i18next from "i18next";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { mockI18next } from "../utils/testUtils"; import { mockI18next } from "../utils/testUtils";
describe("terrain", () => { describe("terrain", () => {
@ -21,7 +20,7 @@ describe("terrain", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override.battleType("single");
}); });
describe("NONE", () => { describe("NONE", () => {

View File

@ -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 Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import GameManager from "../utils/gameManager"; 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 { 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; const TIMEOUT = 20 * 1000;
@ -28,13 +27,13 @@ describe("Moves - Astonish", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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]); game.override.moveset([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); 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); 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); vi.spyOn(allMoves[Moves.ASTONISH], "chance", "get").mockReturnValue(100);
}); });

View File

@ -1,20 +1,19 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { ArenaTagSide } from "#app/data/arena-tag.js";
import Phaser from "phaser"; import Move, { allMoves } from "#app/data/move.js";
import GameManager from "#app/test/utils/gameManager"; import { WeatherType } from "#app/data/weather.js";
import Overrides from "#app/overrides"; import { Abilities } from "#app/enums/abilities.js";
import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Pokemon from "#app/field/pokemon.js";
import { import {
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } 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 { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { Abilities } from "#app/enums/abilities.js"; import Phaser from "phaser";
import Pokemon from "#app/field/pokemon.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
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";
describe("Moves - Aurora Veil", () => { describe("Moves - Aurora Veil", () => {
@ -35,14 +34,14 @@ describe("Moves - Aurora Veil", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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.enemyLevel(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]); 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();
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() => { it("reduces damage of physical attacks by half in a single battle", async() => {
@ -58,7 +57,7 @@ describe("Moves - Aurora Veil", () => {
}); });
it("reduces damage of physical attacks by a third in a double battle", async() => { 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; const moveToUse = Moves.ROCK_SLIDE;
await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]); await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]);
@ -86,7 +85,7 @@ describe("Moves - Aurora Veil", () => {
}); });
it("reduces damage of special attacks by a third in a double battle", async() => { 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; const moveToUse = Moves.DAZZLING_GLEAM;
await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]); await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]);

View File

@ -1,18 +1,17 @@
import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
import Phaser from "phaser"; import { allMoves } from "#app/data/move";
import GameManager from "#app/test/utils/gameManager"; import { Abilities } from "#app/enums/abilities";
import Overrides from "#app/overrides"; import { ArenaTagType } from "#app/enums/arena-tag-type";
import { import {
MoveEffectPhase, MoveEffectPhase,
TurnEndPhase TurnEndPhase
} from "#app/phases"; } 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 { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { ArenaTagType } from "#app/enums/arena-tag-type"; import Phaser from "phaser";
import { allMoves } from "#app/data/move"; import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
import { ArenaTagSide, ArenaTrapTag } from "#app/data/arena-tag";
import { Abilities } from "#app/enums/abilities";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -32,14 +31,14 @@ describe("Moves - Ceaseless Edge", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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); game.override.enemyPassiveAbility(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); game.override.enemyLevel(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 ]);
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); vi.spyOn(allMoves[Moves.CEASELESS_EDGE], "accuracy", "get").mockReturnValue(100);
}); });
@ -75,7 +74,7 @@ describe("Moves - Ceaseless Edge", () => {
test( test(
"move should hit twice with multi lens and apply two layers of spikes", "move should hit twice with multi lens and apply two layers of spikes",
async () => { async () => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS"}]); game.override.startingHeldItems([{name: "MULTI_LENS"}]);
await game.startBattle([ Species.ILLUMISE ]); await game.startBattle([ Species.ILLUMISE ]);
const leadPokemon = game.scene.getPlayerPokemon(); const leadPokemon = game.scene.getPlayerPokemon();
@ -104,8 +103,8 @@ describe("Moves - Ceaseless Edge", () => {
test( test(
"trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage", "trainer - move should hit twice, apply two layers of spikes, force switch opponent - opponent takes damage",
async () => { async () => {
vi.spyOn(Overrides, "STARTING_HELD_ITEMS_OVERRIDE", "get").mockReturnValue([{name: "MULTI_LENS"}]); game.override.startingHeldItems([{name: "MULTI_LENS"}]);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(5); game.override.startingWave(5);
await game.startBattle([ Species.ILLUMISE ]); await game.startBattle([ Species.ILLUMISE ]);

View File

@ -1,15 +1,14 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattleStat } from "#app/data/battle-stat.js";
import Phaser from "phaser"; import { Abilities } from "#app/enums/abilities.js";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { import {
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat.js"; import { Moves } from "#enums/moves";
import { Abilities } from "#app/enums/abilities.js"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Moves - Double Team", () => { describe("Moves - Double Team", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,13 +26,13 @@ describe("Moves - Double Team", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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]); game.override.moveset([Moves.DOUBLE_TEAM]);
vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.disableCrits();
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.ability(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); 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 () => { it("increases the user's evasion by one stage.", async () => {

View File

@ -1,17 +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 { 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 { 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 { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
import { modifierTypes } from "#app/modifier/modifier-type"; 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", () => { describe("Moves - Dragon Rage", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -34,20 +34,20 @@ describe("Moves - Dragon Rage", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); 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); game.override.disableCrits();
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]); game.override.moveset([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.passiveAbility(Abilities.BALL_FETCH);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.startingLevel(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]); game.override.enemyMoveset(SPLASH_ONLY);
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); game.override.enemyPassiveAbility(Abilities.BALL_FETCH);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(100);
await game.startBattle(); await game.startBattle();
@ -111,7 +111,7 @@ describe("Moves - Dragon Rage", () => {
}); });
it("ignores damage modification from abilities such as ice scales", async () => { 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)); game.doAttack(getMovePosition(game.scene, 0, Moves.DRAGON_RAGE));
await game.phaseInterceptor.to(TurnEndPhase); await game.phaseInterceptor.to(TurnEndPhase);

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattlerIndex } from "#app/battle";
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 { allMoves } from "#app/data/move"; 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 { Moves } from "#enums/moves";
import { Species } from "#enums/species"; 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", () => { describe("Moves - Dynamax Cannon", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -28,22 +27,22 @@ describe("Moves - Dynamax Cannon", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ dynamaxCannon.id ]); game.override.moveset([ 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 // 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"); game.override.battleType("single");
vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.disableCrits();
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 ]); game.override.enemyMoveset([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]);
vi.spyOn(dynamaxCannon, "calculateBattlePower"); vi.spyOn(dynamaxCannon, "calculateBattlePower");
}); });
it("should return 100 power against an enemy below level cap", async() => { 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([ await game.startBattle([
Species.ETERNATUS, Species.ETERNATUS,
]); ]);
@ -57,7 +56,7 @@ describe("Moves - Dynamax Cannon", () => {
}, 20000); }, 20000);
it("should return 100 power against an enemy at level cap", async() => { 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([ await game.startBattle([
Species.ETERNATUS, Species.ETERNATUS,
]); ]);
@ -71,7 +70,7 @@ describe("Moves - Dynamax Cannon", () => {
}, 20000); }, 20000);
it("should return 120 power against an enemy 1% above level cap", async() => { 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([ await game.startBattle([
Species.ETERNATUS, Species.ETERNATUS,
]); ]);
@ -88,7 +87,7 @@ describe("Moves - Dynamax Cannon", () => {
}, 20000); }, 20000);
it("should return 140 power against an enemy 2% above level capp", async() => { 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([ await game.startBattle([
Species.ETERNATUS, Species.ETERNATUS,
]); ]);
@ -105,7 +104,7 @@ describe("Moves - Dynamax Cannon", () => {
}, 20000); }, 20000);
it("should return 160 power against an enemy 3% above level cap", async() => { 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([ await game.startBattle([
Species.ETERNATUS, Species.ETERNATUS,
]); ]);
@ -122,7 +121,7 @@ describe("Moves - Dynamax Cannon", () => {
}, 20000); }, 20000);
it("should return 180 power against an enemy 4% above level cap", async() => { 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([ await game.startBattle([
Species.ETERNATUS, Species.ETERNATUS,
]); ]);
@ -139,7 +138,7 @@ describe("Moves - Dynamax Cannon", () => {
}, 20000); }, 20000);
it("should return 200 power against an enemy 5% above level cap", async() => { 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([ await game.startBattle([
Species.ETERNATUS, Species.ETERNATUS,
]); ]);
@ -156,7 +155,7 @@ describe("Moves - Dynamax Cannon", () => {
}, 20000); }, 20000);
it("should return 200 power against an enemy way above level cap", async() => { 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([ await game.startBattle([
Species.ETERNATUS, Species.ETERNATUS,
]); ]);

View File

@ -1,14 +1,14 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattleStat } from "#app/data/battle-stat";
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 { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon"; 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", () => { describe("Moves - Fissure", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -29,18 +29,18 @@ describe("Moves - Fissure", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); 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); game.override.disableCrits();
vi.spyOn(Overrides, "STARTER_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); 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.passiveAbility(Abilities.BALL_FETCH);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.startingLevel(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]); game.override.enemyMoveset(SPLASH_ONLY);
vi.spyOn(Overrides, "OPP_PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); game.override.enemyPassiveAbility(Abilities.BALL_FETCH);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(100);
await game.startBattle(); await game.startBattle();
@ -53,8 +53,8 @@ describe("Moves - Fissure", () => {
}); });
it("ignores damage modification from abilities such as fur coat", async () => { 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);
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)); game.doAttack(getMovePosition(game.scene, 0, Moves.FISSURE));
await game.phaseInterceptor.to(DamagePhase, true); await game.phaseInterceptor.to(DamagePhase, true);

View File

@ -1,18 +1,18 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattleStat } from "#app/data/battle-stat.js";
import Phaser from "phaser"; import { SemiInvulnerableTag } from "#app/data/battler-tags.js";
import GameManager from "#app/test/utils/gameManager"; import { Type } from "#app/data/type.js";
import Overrides from "#app/overrides"; import { Biome } from "#app/enums/biome.js";
import { Species } from "#enums/species";
import { import {
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { BattleStat } from "#app/data/battle-stat.js"; import { Moves } from "#enums/moves";
import { Biome } from "#app/enums/biome.js"; import { Species } from "#enums/species";
import { Type } from "#app/data/type.js"; import Phaser from "phaser";
import { SemiInvulnerableTag } from "#app/data/battler-tags.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Flower Shield", () => { describe("Moves - Flower Shield", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -30,15 +30,15 @@ describe("Moves - Flower Shield", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); game.override.ability(Abilities.NONE);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); game.override.enemyAbility(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]); game.override.moveset([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 () => { 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]); await game.startBattle([Species.MAGIKARP]);
const cherrim = game.scene.getEnemyPokemon(); const cherrim = game.scene.getEnemyPokemon();
@ -55,9 +55,7 @@ describe("Moves - Flower Shield", () => {
}); });
it("increases defense of all Grass-type Pokemon on the field by one stage - double battle", async () => { 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).startingBiome(Biome.GRASS).battleType("double");
vi.spyOn(Overrides, "STARTING_BIOME_OVERRIDE", "get").mockReturnValue(Biome.GRASS);
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double");
await game.startBattle([Species.CHERRIM, Species.MAGIKARP]); await game.startBattle([Species.CHERRIM, Species.MAGIKARP]);
const field = game.scene.getField(true); const field = game.scene.getField(true);
@ -80,9 +78,9 @@ describe("Moves - Flower Shield", () => {
* See semi-vulnerable state tags. {@linkcode SemiInvulnerableTag} * See semi-vulnerable state tags. {@linkcode SemiInvulnerableTag}
*/ */
it("does not increase defense of a pokemon in semi-vulnerable state", async () => { 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]); 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]); await game.startBattle([Species.CHERRIM]);
const paras = game.scene.getEnemyPokemon(); const paras = game.scene.getEnemyPokemon();
@ -101,7 +99,7 @@ describe("Moves - Flower Shield", () => {
}); });
it("does nothing if there are no Grass-type pokemon on the field", async () => { 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]); await game.startBattle([Species.MAGIKARP]);
const enemy = game.scene.getEnemyPokemon(); const enemy = game.scene.getEnemyPokemon();

View File

@ -1,18 +1,17 @@
import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; import { BattlerIndex } from "#app/battle.js";
import Phaser from "phaser"; import { Stat } from "#app/data/pokemon-stat";
import GameManager from "#app/test/utils/gameManager"; import { Abilities } from "#app/enums/abilities.js";
import Overrides from "#app/overrides";
import { import {
CommandPhase, CommandPhase,
SelectTargetPhase, SelectTargetPhase,
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import {Stat} from "#app/data/pokemon-stat"; import GameManager from "#app/test/utils/gameManager";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { BattlerIndex } from "#app/battle.js"; import Phaser from "phaser";
import { Abilities } from "#app/enums/abilities.js"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -32,13 +31,13 @@ describe("Moves - Follow Me", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.starterSpecies(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); game.override.startingLevel(100);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(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 ]);
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( test(
@ -101,9 +100,9 @@ describe("Moves - Follow Me", () => {
test( test(
"move effect should be bypassed by Stalwart", "move effect should be bypassed by Stalwart",
async () => { 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.moveset([ 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 ]); await game.startBattle([ Species.AMOONGUSS, Species.CHARIZARD ]);
@ -136,8 +135,8 @@ describe("Moves - Follow Me", () => {
test( test(
"move effect should be bypassed by Snipe Shot", "move effect should be bypassed by Snipe Shot",
async () => { async () => {
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SNIPE_SHOT ]); game.override.moveset([ 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 ]); await game.startBattle([ Species.AMOONGUSS, Species.CHARIZARD ]);

View File

@ -1,15 +1,15 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattlerIndex } from "#app/battle.js";
import GameManager from "../utils/gameManager"; import { Stat } from "#app/data/pokemon-stat.js";
import { Abilities } from "#app/enums/abilities.js";
import { import {
Moves Moves
} from "#app/enums/moves.js"; } 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 { 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; const TIMEOUT = 20 * 1000;
@ -29,14 +29,14 @@ describe("Moves - Gastro Acid", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.startingLevel(1);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(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.moveset([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]); game.override.enemyMoveset(SPLASH_ONLY);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.WATER_ABSORB); game.override.enemyAbility(Abilities.WATER_ABSORB);
}); });
it("suppresses effect of ability", async () => { it("suppresses effect of ability", async () => {
@ -72,7 +72,7 @@ describe("Moves - Gastro Acid", () => {
}, TIMEOUT); }, TIMEOUT);
it("fails if used on an enemy with an already-suppressed ability", async () => { 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(); await game.startBattle();

View File

@ -1,13 +1,12 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { allMoves } from "#app/data/move.js";
import Phaser from "phaser"; import { Abilities } from "#app/enums/abilities.js";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { DamagePhase, TurnEndPhase } from "#app/phases"; import { DamagePhase, TurnEndPhase } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { Abilities } from "#app/enums/abilities.js"; import Phaser from "phaser";
import { allMoves } from "#app/data/move.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("Moves - Glaive Rush", () => { describe("Moves - Glaive Rush", () => {
@ -26,15 +25,15 @@ describe("Moves - Glaive Rush", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.disableCrits();
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); 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); 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); game.override.passiveAbility(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() => { it("takes double damage from attacks", async() => {
@ -66,8 +65,8 @@ describe("Moves - Glaive Rush", () => {
}, 20000); }, 20000);
it("interacts properly with multi-lens", async() => { 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}]);
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue(Array(4).fill(Moves.AVALANCHE)); game.override.enemyMoveset(Array(4).fill(Moves.AVALANCHE));
await game.startBattle(); await game.startBattle();
const player = game.scene.getPlayerPokemon(); const player = game.scene.getPlayerPokemon();
const enemy = game.scene.getEnemyPokemon(); const enemy = game.scene.getEnemyPokemon();
@ -86,7 +85,7 @@ describe("Moves - Glaive Rush", () => {
}, 20000); }, 20000);
it("secondary effects only last until next move", async() => { 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(); await game.startBattle();
const player = game.scene.getPlayerPokemon(); const player = game.scene.getPlayerPokemon();
const enemy = game.scene.getEnemyPokemon(); const enemy = game.scene.getEnemyPokemon();
@ -110,8 +109,8 @@ describe("Moves - Glaive Rush", () => {
}, 20000); }, 20000);
it("secondary effects are removed upon switching", async() => { 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); game.override.starterSpecies(0);
await game.startBattle([Species.KLINK, Species.FEEBAS]); await game.startBattle([Species.KLINK, Species.FEEBAS]);
const player = game.scene.getPlayerPokemon(); const player = game.scene.getPlayerPokemon();
const enemy = game.scene.getEnemyPokemon(); const enemy = game.scene.getEnemyPokemon();

View File

@ -1,20 +1,19 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { BattleStat } from "#app/data/battle-stat";
import Phaser from "phaser"; import { Stat } from "#app/data/pokemon-stat";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
CommandPhase, CommandPhase,
EnemyCommandPhase, EnemyCommandPhase,
TurnInitPhase, TurnInitPhase,
} from "#app/phases"; } from "#app/phases";
import {Mode} from "#app/ui/ui"; import GameManager from "#app/test/utils/gameManager";
import {Stat} from "#app/data/pokemon-stat"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { Command } from "#app/ui/command-ui-handler";
import {Command} from "#app/ui/command-ui-handler"; import { Mode } from "#app/ui/ui";
import {BattleStat} from "#app/data/battle-stat";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Growth", () => { describe("Moves - Growth", () => {
@ -34,13 +33,13 @@ describe("Moves - Growth", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.GROWTH; 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); 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); game.override.ability(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.moveset([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() => { it("GROWTH", async() => {

View File

@ -1,15 +1,15 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { allMoves } from "#app/data/move.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { import {
MoveEffectPhase MoveEffectPhase
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; 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", () => { describe("Moves - Hard Press", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -29,12 +29,12 @@ describe("Moves - Hard Press", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.ability(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); 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]); game.override.moveset([Moves.HARD_PRESS]);
vi.spyOn(moveToCheck, "calculateBattlePower"); vi.spyOn(moveToCheck, "calculateBattlePower");
}); });

View File

@ -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 { allMoves } from "#app/data/move.js";
import { getMovePosition } from "../utils/gameManagerUtils"; import { Abilities } from "#app/enums/abilities.js";
import { BerryPhase, TurnEndPhase } from "#app/phases.js";
import { BattlerTagType } from "#app/enums/battler-tag-type.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 const TIMEOUT = 20 * 1000; // 20 sec timeout for all tests
@ -29,13 +28,13 @@ describe("Moves - Hyper Beam", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.ability(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); 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]); game.override.moveset([Moves.HYPER_BEAM, Moves.TACKLE]);
vi.spyOn(allMoves[Moves.HYPER_BEAM], "accuracy", "get").mockReturnValue(100); vi.spyOn(allMoves[Moves.HYPER_BEAM], "accuracy", "get").mockReturnValue(100);
}); });

View File

@ -1,19 +1,18 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { ArenaTagSide } from "#app/data/arena-tag.js";
import Phaser from "phaser"; import Move, { allMoves } from "#app/data/move.js";
import GameManager from "#app/test/utils/gameManager"; import { Abilities } from "#app/enums/abilities.js";
import Overrides from "#app/overrides"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Pokemon from "#app/field/pokemon.js";
import { import {
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } 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 { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { Abilities } from "#app/enums/abilities.js"; import Phaser from "phaser";
import Pokemon from "#app/field/pokemon.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
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";
describe("Moves - Light Screen", () => { describe("Moves - Light Screen", () => {
@ -34,13 +33,13 @@ describe("Moves - Light Screen", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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.enemyLevel(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]); 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() => { it("reduces damage of special attacks by half in a single battle", async() => {
@ -57,7 +56,7 @@ describe("Moves - Light Screen", () => {
}); });
it("reduces damage of special attacks by a third in a double battle", async() => { 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; const moveToUse = Moves.DAZZLING_GLEAM;
await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]); await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]);

View File

@ -1,10 +1,9 @@
import {beforeAll, afterEach, beforeEach, describe, vi, it, expect} from "vitest"; import { CommandPhase, TurnEndPhase } from "#app/phases.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides"; import { Moves } from "#enums/moves";
import {Moves} from "#enums/moves"; import { Species } from "#enums/species";
import {Species} from "#enums/species"; import Phaser from "phaser";
import {CommandPhase, TurnEndPhase} from "#app/phases.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Magnet Rise", () => { describe("Moves - Magnet Rise", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -23,13 +22,13 @@ describe("Moves - Magnet Rise", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.MAGNET_RISE; 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); game.override.starterSpecies(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]); 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();
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(1); game.override.enemyLevel(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 () => { it("MAGNET RISE", async () => {

View File

@ -1,17 +1,17 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { BattleStat } from "#app/data/battle-stat.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { import {
CommandPhase, CommandPhase,
MoveEndPhase, MoveEndPhase,
StatChangePhase, StatChangePhase,
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; 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; const TIMEOUT = 20 * 1000;
@ -31,13 +31,13 @@ describe("Moves - Make It Rain", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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]); game.override.moveset([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); 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); 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 () => { it("should only reduce Sp. Atk. once in a double battle", async () => {
@ -62,8 +62,8 @@ describe("Moves - Make It Rain", () => {
}, TIMEOUT); }, TIMEOUT);
it("should apply effects even if the target faints", async () => { 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
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override.battleType("single");
await game.startBattle([Species.CHARIZARD]); await game.startBattle([Species.CHARIZARD]);
@ -82,7 +82,7 @@ describe("Moves - Make It Rain", () => {
}, TIMEOUT); }, TIMEOUT);
it("should reduce Sp. Atk. once after KOing two enemies", async () => { 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]); await game.startBattle([Species.CHARIZARD, Species.BLASTOISE]);

View File

@ -1,13 +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 { Moves } from "#enums/moves";
import { getMoveTargets } from "#app/data/move.js"; import { getMoveTargets } from "#app/data/move.js";
import { Abilities } from "#app/enums/abilities.js"; import { Abilities } from "#app/enums/abilities.js";
import { Species } from "#app/enums/species.js"; import { Species } from "#app/enums/species.js";
import { getMovePosition } from "../utils/gameManagerUtils";
import { TurnEndPhase } from "#app/phases.js"; 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; const TIMEOUT = 20 * 1000;
@ -69,7 +69,7 @@ describe("Moves - Multi target", () => {
async function checkTargetMultiplier(game: GameManager, attackMove: Moves, killAlly: boolean, killSecondEnemy: boolean, shouldMultiplied: boolean, oppAbility?: Abilities) { async function checkTargetMultiplier(game: GameManager, attackMove: Moves, killAlly: boolean, killSecondEnemy: boolean, shouldMultiplied: boolean, oppAbility?: Abilities) {
// play an attack and check target count // 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(); await game.startBattle();
const playerPokemonRepr = game.scene.getPlayerField(); const playerPokemonRepr = game.scene.getPlayerField();
@ -164,15 +164,16 @@ function leaveOneEnemyPokemon(game: GameManager) {
function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) { function beforeTrial(phaserGame: Phaser.Game, single: boolean = false) {
const game = new GameManager(phaserGame); const game = new GameManager(phaserGame);
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double"); game.override
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.EARTHQUAKE, Moves.HYPER_VOICE, Moves.SURF, Moves.SPLASH]); .battleType("double")
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.BALL_FETCH); .moveset([Moves.EARTHQUAKE, Moves.HYPER_VOICE, Moves.SURF, Moves.SPLASH])
vi.spyOn(Overrides, "PASSIVE_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.UNNERVE); .ability(Abilities.BALL_FETCH)
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH]); .passiveAbility(Abilities.UNNERVE)
vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); .enemyMoveset(SPLASH_ONLY)
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(50); .disableCrits()
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(40); .startingLevel(50)
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.EEVEE); .enemyLevel(40)
.enemySpecies(Species.EEVEE);
return game; return game;
} }

View File

@ -1,14 +1,14 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { BattleStat } from "#app/data/battle-stat";
import Phaser from "phaser"; import { TrappedTag } from "#app/data/battler-tags.js";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { CommandPhase, MoveEndPhase, TurnInitPhase } from "#app/phases"; import { CommandPhase, MoveEndPhase, TurnInitPhase } from "#app/phases";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import GameManager from "#app/test/utils/gameManager";
import {BattleStat} from "#app/data/battle-stat"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; 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", () => { describe("Moves - Octolock", () => {
describe("integration tests", () => { describe("integration tests", () => {
@ -28,15 +28,15 @@ describe("Moves - Octolock", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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);
vi.spyOn(Overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); 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]); game.override.moveset([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 () => { it("Reduces DEf and SPDEF by 1 each turn", { timeout: 10000 }, async () => {

View File

@ -1,15 +1,14 @@
import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; import { Status, StatusEffect } from "#app/data/status-effect.js";
import Phaser from "phaser"; import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon.js";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
MoveEndPhase, MoveEndPhase,
} from "#app/phases"; } 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 { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon.js"; import Phaser from "phaser";
import { Status, StatusEffect } from "#app/data/status-effect.js"; import { afterEach, beforeAll, beforeEach, describe, expect, test } from "vitest";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -29,15 +28,15 @@ describe("Moves - Purify", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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.moveset([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); game.override.enemyLevel(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( test(

View File

@ -1,17 +1,16 @@
import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; import { BattlerIndex } from "#app/battle.js";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
CommandPhase, CommandPhase,
SelectTargetPhase, SelectTargetPhase,
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } 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 { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; 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; const TIMEOUT = 20 * 1000;
@ -31,19 +30,19 @@ describe("Moves - Rage Powder", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.starterSpecies(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); game.override.startingLevel(100);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(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 ]);
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( test(
"move effect should be bypassed by Grass type", "move effect should be bypassed by Grass type",
async () => { 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 ]); await game.startBattle([ Species.AMOONGUSS, Species.VENUSAUR ]);
@ -76,8 +75,8 @@ describe("Moves - Rage Powder", () => {
test( test(
"move effect should be bypassed by Overcoat", "move effect should be bypassed by Overcoat",
async () => { async () => {
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.OVERCOAT); game.override.ability(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 // Test with two non-Grass type player Pokemon
await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD ]); await game.startBattle([ Species.BLASTOISE, Species.CHARIZARD ]);

View File

@ -1,19 +1,18 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { ArenaTagSide } from "#app/data/arena-tag.js";
import Phaser from "phaser"; import Move, { allMoves } from "#app/data/move.js";
import GameManager from "#app/test/utils/gameManager"; import { Abilities } from "#app/enums/abilities.js";
import Overrides from "#app/overrides"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Pokemon from "#app/field/pokemon.js";
import { import {
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } 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 { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { Abilities } from "#app/enums/abilities.js"; import Phaser from "phaser";
import Pokemon from "#app/field/pokemon.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
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";
describe("Moves - Reflect", () => { describe("Moves - Reflect", () => {
@ -34,13 +33,13 @@ describe("Moves - Reflect", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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.enemyLevel(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]); 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() => { it("reduces damage of physical attacks by half in a single battle", async() => {
@ -56,7 +55,7 @@ describe("Moves - Reflect", () => {
}); });
it("reduces damage of physical attacks by a third in a double battle", async() => { 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; const moveToUse = Moves.ROCK_SLIDE;
await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]); await game.startBattle([Species.SHUCKLE, Species.SHUCKLE]);

View File

@ -1,5 +1,4 @@
import { allMoves } from "#app/data/move.js"; import { allMoves } from "#app/data/move.js";
import Overrides from "#app/overrides";
import { CommandPhase } from "#app/phases"; import { CommandPhase } from "#app/phases";
import GameManager from "#app/test/utils/gameManager"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
@ -26,19 +25,19 @@ describe("Moves - Rollout", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
vi.spyOn(Overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true); game.override.disableCrits();
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); 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.ability(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); 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.enemyLevel(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 () => { 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 vi.spyOn(allMoves[Moves.ROLLOUT], "accuracy", "get").mockReturnValue(100); //always hit
const variance = 5; const variance = 5;

View File

@ -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 { 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; const TIMEOUT = 20 * 1000;
@ -27,13 +26,13 @@ describe("Moves - Roost", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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); game.override.startingLevel(100);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(100);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.STOMPING_TANTRUM ]); game.override.moveset([ 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( test(

View File

@ -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 { import {
CommandPhase CommandPhase
} from "#app/phases"; } from "#app/phases";
import GameManager from "#app/test/utils/gameManager";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Spikes", () => { describe("Moves - Spikes", () => {
@ -27,15 +26,15 @@ describe("Moves - Spikes", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.scene.battleStyle = 1; 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); 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); game.override.enemyPassiveAbility(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.passiveAbility(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]); 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() => { it("single - wild - stay on field - no damage", async() => {
@ -86,7 +85,7 @@ describe("Moves - Spikes", () => {
}, 20000); }, 20000);
it("trainer - wild - force switch opponent - should take damage", async() => { 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 // player set spikes on the field and do splash for 3 turns
// opponent do splash for 4 turns // opponent do splash for 4 turns
// nobody should take damage // nobody should take damage
@ -104,9 +103,9 @@ describe("Moves - Spikes", () => {
}, 20000); }, 20000);
it("trainer - wild - force switch by himself opponent - should take damage", async() => { 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); game.override.startingLevel(5000);
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(0); game.override.enemySpecies(0);
// turn 1: player set spikes, opponent do splash // turn 1: player set spikes, opponent do splash
// turn 2: player do splash, opponent switch pokemon // turn 2: player do splash, opponent switch pokemon
// opponent pokemon should trigger spikes and lose HP // opponent pokemon should trigger spikes and lose HP

View File

@ -1,16 +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 { MovePhase, TurnInitPhase } from "#app/phases";
import { BattleStat } from "#app/data/battle-stat"; 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 { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { StockpilingTag } from "#app/data/battler-tags.js"; import Phaser from "phaser";
import { MoveResult, TurnMove } from "#app/field/pokemon.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import { SPLASH_ONLY } from "../utils/testUtils";
import { allMoves } from "#app/data/move.js";
describe("Moves - Spit Up", () => { describe("Moves - Spit Up", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -27,15 +27,15 @@ describe("Moves - Spit Up", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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);
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); game.override.enemyAbility(Abilities.NONE);
vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.enemyLevel(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); game.override.ability(Abilities.NONE);
}); });
describe("consumes all stockpile stacks to deal damage (scaling with stacks)", () => { describe("consumes all stockpile stacks to deal damage (scaling with stacks)", () => {

View File

@ -1,17 +1,16 @@
import {afterEach, beforeAll, beforeEach, describe, expect, test, vi} from "vitest"; import { BattlerIndex } from "#app/battle.js";
import Phaser from "phaser"; import { Stat } from "#app/data/pokemon-stat";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
CommandPhase, CommandPhase,
SelectTargetPhase, SelectTargetPhase,
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import {Stat} from "#app/data/pokemon-stat"; import GameManager from "#app/test/utils/gameManager";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; 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; const TIMEOUT = 20 * 1000;
@ -31,13 +30,13 @@ describe("Moves - Spotlight", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); game.override.starterSpecies(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); game.override.startingLevel(100);
vi.spyOn(Overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(100); game.override.enemyLevel(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 ]);
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( test(
@ -73,7 +72,7 @@ describe("Moves - Spotlight", () => {
test( test(
"move should cause other redirection moves to fail", "move should cause other redirection moves to fail",
async () => { 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 ]); await game.startBattle([ Species.AMOONGUSS, Species.CHARIZARD ]);

View File

@ -1,15 +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 { CommandPhase, TurnInitPhase } from "#app/phases";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { BattleStat } from "#app/data/battle-stat"; 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 { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { StockpilingTag } from "#app/data/battler-tags.js"; import Phaser from "phaser";
import { MoveResult, TurnMove } from "#app/field/pokemon.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Stockpile", () => { describe("Moves - Stockpile", () => {
describe("integration tests", () => { describe("integration tests", () => {
@ -27,15 +27,15 @@ describe("Moves - Stockpile", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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);
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); 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.STOCKPILE, Moves.SPLASH]); 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 () => { it("Gains a stockpile stack and increases DEF and SPDEF by 1 on each use, fails at max stacks (3)", { timeout: 10000 }, async () => {

View File

@ -1,15 +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 { 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 { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { StockpilingTag } from "#app/data/battler-tags.js"; import Phaser from "phaser";
import { MoveResult, TurnMove } from "#app/field/pokemon.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Swallow", () => { describe("Moves - Swallow", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -26,15 +26,15 @@ describe("Moves - Swallow", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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);
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.NONE); game.override.enemyAbility(Abilities.NONE);
vi.spyOn(overrides, "OPP_LEVEL_OVERRIDE", "get").mockReturnValue(2000); game.override.enemyLevel(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); game.override.ability(Abilities.NONE);
}); });
describe("consumes all stockpile stacks to heal (scaling with stacks)", () => { describe("consumes all stockpile stacks to heal (scaling with stacks)", () => {

View File

@ -1,17 +1,16 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { Stat } from "#app/data/pokemon-stat";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
CommandPhase, CommandPhase,
EnemyCommandPhase, TurnEndPhase, EnemyCommandPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import {Mode} from "#app/ui/ui"; import GameManager from "#app/test/utils/gameManager";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import {Command} from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import {Stat} from "#app/data/pokemon-stat"; import { Mode } from "#app/ui/ui";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Tackle", () => { describe("Moves - Tackle", () => {
@ -31,18 +30,18 @@ describe("Moves - Tackle", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.TACKLE; 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); game.override.enemySpecies(Species.MAGIKARP);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1); game.override.startingLevel(1);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(97); game.override.startingWave(97);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]); game.override.moveset([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); game.override.disableCrits();
}); });
it("TACKLE against ghost", async() => { it("TACKLE against ghost", async() => {
const moveToUse = Moves.TACKLE; const moveToUse = Moves.TACKLE;
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.GENGAR); game.override.enemySpecies(Species.GENGAR);
await game.startBattle([ await game.startBattle([
Species.MIGHTYENA, Species.MIGHTYENA,
]); ]);

View File

@ -1,19 +1,18 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { BattleStat } from "#app/data/battle-stat";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
CommandPhase, CommandPhase,
EnemyCommandPhase, EnemyCommandPhase,
TurnInitPhase, TurnInitPhase,
} from "#app/phases"; } from "#app/phases";
import {Mode} from "#app/ui/ui"; import GameManager from "#app/test/utils/gameManager";
import {getMovePosition} from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import {Command} from "#app/ui/command-ui-handler"; import { Command } from "#app/ui/command-ui-handler";
import {BattleStat} from "#app/data/battle-stat"; import { Mode } from "#app/ui/ui";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Tail whip", () => { describe("Moves - Tail whip", () => {
@ -33,13 +32,13 @@ describe("Moves - Tail whip", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
const moveToUse = Moves.TAIL_WHIP; 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); 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); game.override.ability(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.moveset([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() => { it("TAIL_WHIP", async() => {

View File

@ -1,16 +1,16 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { ArenaTagSide } from "#app/data/arena-tag.js";
import Phaser from "phaser"; import { Stat } from "#app/data/pokemon-stat.js";
import GameManager from "#app/test/utils/gameManager"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import Overrides from "#app/overrides";
import { Species } from "#enums/species";
import { import {
TurnEndPhase, TurnEndPhase,
} from "#app/phases"; } from "#app/phases";
import { Moves } from "#enums/moves"; import GameManager from "#app/test/utils/gameManager";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { Stat } from "#app/data/pokemon-stat.js"; import { Moves } from "#enums/moves";
import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { Species } from "#enums/species";
import { ArenaTagSide } from "#app/data/arena-tag.js"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { SPLASH_ONLY } from "../utils/testUtils";
describe("Abilities - Wind Rider", () => { describe("Abilities - Wind Rider", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;
@ -28,9 +28,9 @@ describe("Abilities - Wind Rider", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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]); game.override.moveset([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 () => { it("doubles the Speed stat of the Pokemons on its side", async () => {
@ -55,7 +55,7 @@ describe("Abilities - Wind Rider", () => {
}); });
it("lasts for 4 turns", async () => { it("lasts for 4 turns", async () => {
vi.spyOn(Overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single"); game.override.battleType("single");
await game.startBattle([Species.MAGIKARP]); await game.startBattle([Species.MAGIKARP]);
@ -78,7 +78,7 @@ describe("Abilities - Wind Rider", () => {
}); });
it("does not affect the opposing side", async () => { 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]); await game.startBattle([Species.MAGIKARP]);

View File

@ -1,16 +1,15 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { Abilities } from "#app/enums/abilities.js";
import Phaser from "phaser"; import { BattlerTagType } from "#app/enums/battler-tag-type.js";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { import {
BerryPhase, BerryPhase,
MoveEffectPhase MoveEffectPhase
} from "#app/phases"; } 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 { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { BattlerTagType } from "#app/enums/battler-tag-type.js"; import Phaser from "phaser";
import { Abilities } from "#app/enums/abilities.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
const TIMEOUT = 20 * 1000; const TIMEOUT = 20 * 1000;
@ -30,12 +29,12 @@ describe("Moves - Thousand Arrows", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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); game.override.enemyLevel(100);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.THOUSAND_ARROWS ]); game.override.moveset([ 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( it(
@ -61,8 +60,8 @@ describe("Moves - Thousand Arrows", () => {
it( it(
"move should hit and ground targets with Levitate", "move should hit and ground targets with Levitate",
async () => { 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); game.override.enemyAbility(Abilities.LEVITATE);
await game.startBattle([ Species.ILLUMISE ]); await game.startBattle([ Species.ILLUMISE ]);
@ -84,7 +83,7 @@ describe("Moves - Thousand Arrows", () => {
it( it(
"move should hit and ground targets under the effects of Magnet Rise", "move should hit and ground targets under the effects of Magnet Rise",
async () => { async () => {
vi.spyOn(Overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.SNORLAX); game.override.enemySpecies(Species.SNORLAX);
await game.startBattle([ Species.ILLUMISE ]); await game.startBattle([ Species.ILLUMISE ]);

View File

@ -1,14 +1,14 @@
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest"; import { BattleStat } from "#app/data/battle-stat.js";
import Phaser from "phaser"; import { ArenaTagType } from "#app/enums/arena-tag-type.js";
import GameManager from "#app/test/utils/gameManager";
import Overrides from "#app/overrides";
import { MoveEndPhase, TurnEndPhase } from "#app/phases"; 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 { Abilities } from "#enums/abilities";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { getMovePosition } from "#app/test/utils/gameManagerUtils"; import Phaser from "phaser";
import { ArenaTagType } from "#app/enums/arena-tag-type.js"; import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { BattleStat } from "#app/data/battle-stat.js"; import { SPLASH_ONLY } from "../utils/testUtils";
describe("Moves - Tidy Up", () => { describe("Moves - Tidy Up", () => {
@ -27,19 +27,19 @@ describe("Moves - Tidy Up", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); 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); 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]); 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); game.override.ability(Abilities.BALL_FETCH);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TIDY_UP]); game.override.moveset([Moves.TIDY_UP]);
vi.spyOn(Overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(50); game.override.startingLevel(50);
}); });
it("spikes are cleared", async() => { 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]);
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(); await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.SPIKES)); game.doAttack(getMovePosition(game.scene, 0, Moves.SPIKES));
@ -51,8 +51,8 @@ describe("Moves - Tidy Up", () => {
}, 20000); }, 20000);
it("stealth rocks are cleared", async() => { 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]);
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(); await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.STEALTH_ROCK)); game.doAttack(getMovePosition(game.scene, 0, Moves.STEALTH_ROCK));
@ -64,8 +64,8 @@ describe("Moves - Tidy Up", () => {
}, 20000); }, 20000);
it("toxic spikes are cleared", async() => { 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]);
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(); await game.startBattle();
game.doAttack(getMovePosition(game.scene, 0, Moves.TOXIC_SPIKES)); game.doAttack(getMovePosition(game.scene, 0, Moves.TOXIC_SPIKES));
@ -77,8 +77,8 @@ describe("Moves - Tidy Up", () => {
}, 20000); }, 20000);
it("sticky webs are cleared", async() => { 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]);
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(); await game.startBattle();
@ -91,8 +91,8 @@ describe("Moves - Tidy Up", () => {
}, 20000); }, 20000);
it.skip("substitutes are cleared", async() => { 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]);
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(); await game.startBattle();

View File

@ -38,7 +38,7 @@ describe("check if every variant's sprite are correctly set", () => {
const errors = []; const errors = [];
const trimmedDirpath = `variant${path.sep}${dirpath.split(rootDir)[1]}`; const trimmedDirpath = `variant${path.sep}${dirpath.split(rootDir)[1]}`;
if (fs.existsSync(dirpath)) { if (fs.existsSync(dirpath)) {
const files = fs.readdirSync(dirpath); const files = fs.readdirSync(dirpath).filter(filename => !filename.startsWith("."));
for (const filename of files) { for (const filename of files) {
const filePath = `${dirpath}${filename}`; const filePath = `${dirpath}${filename}`;
const trimmedFilePath = `${trimmedDirpath}${filename}`; const trimmedFilePath = `${trimmedDirpath}${filename}`;

View File

@ -1,8 +1,7 @@
import { BerryType } from "#app/enums/berry-type"; import { BerryType } from "#app/enums/berry-type";
import { Button } from "#app/enums/buttons";
import { Moves } from "#app/enums/moves"; import { Moves } from "#app/enums/moves";
import { Species } from "#app/enums/species"; import { Species } from "#app/enums/species";
import { Button } from "#app/enums/buttons";
import Overrides from "#app/overrides";
import { import {
BattleEndPhase, BattleEndPhase,
SelectModifierPhase SelectModifierPhase
@ -13,7 +12,7 @@ import PartyUiHandler, { PartyUiMode } from "#app/ui/party-ui-handler";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import Phaser from "phaser"; import Phaser from "phaser";
import BBCodeText from "phaser3-rex-plugins/plugins/bbcodetext"; 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"; import { getMovePosition } from "../utils/gameManagerUtils";
@ -33,17 +32,17 @@ describe("UI - Transfer Items", () => {
beforeEach(async () => { beforeEach(async () => {
game = new GameManager(phaserGame); 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.startingLevel(100);
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(1); 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: 1, type: BerryType.SITRUS },
{ name: "BERRY", count: 2, type: BerryType.APICOT }, { name: "BERRY", count: 2, type: BerryType.APICOT },
{ name: "BERRY", count: 2, type: BerryType.LUM }, { name: "BERRY", count: 2, type: BerryType.LUM },
]); ]);
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([Moves.DRAGON_CLAW]); game.override.moveset([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]); game.override.enemyMoveset([Moves.SPLASH]);
await game.startBattle([Species.RAYQUAZA, Species.RAYQUAZA, Species.RAYQUAZA]); await game.startBattle([Species.RAYQUAZA, Species.RAYQUAZA, Species.RAYQUAZA]);

View File

@ -34,6 +34,7 @@ import { Species } from "#enums/species";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";
import { BattlerIndex } from "#app/battle.js"; import { BattlerIndex } from "#app/battle.js";
import TargetSelectUiHandler from "#app/ui/target-select-ui-handler.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. * Class to manage the game state and transitions between phases.
@ -44,6 +45,7 @@ export default class GameManager {
public phaseInterceptor: PhaseInterceptor; public phaseInterceptor: PhaseInterceptor;
public textInterceptor: TextInterceptor; public textInterceptor: TextInterceptor;
public inputsHandler: InputsHandler; public inputsHandler: InputsHandler;
public readonly override: OverridesHelper;
/** /**
* Creates an instance of GameManager. * Creates an instance of GameManager.
@ -59,6 +61,7 @@ export default class GameManager {
this.phaseInterceptor = new PhaseInterceptor(this.scene); this.phaseInterceptor = new PhaseInterceptor(this.scene);
this.textInterceptor = new TextInterceptor(this.scene); this.textInterceptor = new TextInterceptor(this.scene);
this.gameWrapper.setScene(this.scene); this.gameWrapper.setScene(this.scene);
this.override = new OverridesHelper(this);
} }
/** /**

View File

@ -0,0 +1,271 @@
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";
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";
/**
* 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 this
*/
startingWave(wave: number): this {
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(wave);
this.log(`Starting wave set to ${wave}!`);
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) 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
* @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 the player (pokemons) forms
* @param forms the (pokemon) forms to set
* @returns this
*/
starterForms(forms: Partial<Record<Species, number>>): 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
* @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 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
* @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 not have standard trainer battles
* @returns this
*/
disableTrainerWaves(): this {
const realFn = getGameMode;
vi.spyOn(GameMode, "getGameMode").mockImplementation((gameMode: GameModes) => {
const mode = realFn(gameMode);
mode.hasTrainers = false;
return mode;
});
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;
}
/**
* Override the {@linkcode WeatherType | weather (type)}
* @param type {@linkcode WeatherType | weather type} to set
* @returns this
*/
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 this
*/
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;
}
/**
* 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;
}
/**
* Override the enemy (pokemon) {@linkcode Species | species}
* @param species the (pokemon) {@linkcode Species | species} to set
* @returns 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;
}
/**
* 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 ability set to ${Abilities[ability]} (=${ability})!`);
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
* @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;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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);
}
}