2024-06-13 05:36:12 -04:00
|
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, test, vi } from "vitest";
|
|
|
|
import GameManager from "#test/utils/gameManager";
|
|
|
|
import { getMovePosition } from "#test/utils/gameManagerUtils";
|
|
|
|
import * as Overrides from "#app/overrides";
|
2024-06-13 11:11:12 -04:00
|
|
|
import { Moves } from "#enums";
|
|
|
|
import { Abilities } from "#enums";
|
|
|
|
import { Species } from "#enums";
|
2024-06-13 05:36:12 -04:00
|
|
|
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;
|
|
|
|
|
|
|
|
describe("Abilities - SHIELDS DOWN", () => {
|
|
|
|
let phaserGame: Phaser.Game;
|
|
|
|
let game: GameManager;
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
phaserGame = new Phaser.Game({
|
|
|
|
type: Phaser.HEADLESS,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
game.phaseInterceptor.restoreOg();
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
game = new GameManager(phaserGame);
|
|
|
|
const moveToUse = Moves.SPLASH;
|
|
|
|
vi.spyOn(Overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
|
|
|
vi.spyOn(Overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.SHIELDS_DOWN);
|
|
|
|
vi.spyOn(Overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]);
|
|
|
|
vi.spyOn(Overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
|
|
|
});
|
|
|
|
|
|
|
|
test(
|
|
|
|
"check if fainted pokemon switched to base form on arena reset",
|
|
|
|
async () => {
|
|
|
|
const meteorForm = 0,
|
|
|
|
coreForm = 7;
|
|
|
|
vi.spyOn(Overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(4);
|
|
|
|
vi.spyOn(Overrides, "STARTER_FORM_OVERRIDES", "get").mockReturnValue({
|
|
|
|
[Species.MINIOR]: coreForm,
|
|
|
|
});
|
|
|
|
|
|
|
|
await game.startBattle([Species.MAGIKARP, Species.MINIOR]);
|
|
|
|
|
|
|
|
const minior = game.scene.getParty().find((p) => p.species.speciesId === Species.MINIOR);
|
|
|
|
expect(minior).not.toBe(undefined);
|
|
|
|
expect(minior.formIndex).toBe(coreForm);
|
|
|
|
|
|
|
|
minior.hp = 0;
|
|
|
|
minior.status = new Status(StatusEffect.FAINT);
|
|
|
|
expect(minior.isFainted()).toBe(true);
|
|
|
|
|
|
|
|
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
|
|
|
|
await game.doKillOpponents();
|
|
|
|
await game.phaseInterceptor.to(TurnEndPhase);
|
|
|
|
game.doSelectModifier();
|
|
|
|
await game.phaseInterceptor.to(QuietFormChangePhase);
|
|
|
|
|
|
|
|
expect(minior.formIndex).toBe(meteorForm);
|
|
|
|
},
|
|
|
|
TIMEOUT
|
|
|
|
);
|
|
|
|
});
|