mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-01-27 03:07:28 +00:00
dc30dd33b2
* moving enums * import updates * fix tsconfig paths importing (#2184) * reverse index.ts addition --------- Co-authored-by: Devin Korb <meepdarknessmeep@gmail.com>
67 lines
2.5 KiB
TypeScript
67 lines
2.5 KiB
TypeScript
import {afterEach, beforeAll, beforeEach, describe, expect, it, vi} from "vitest";
|
|
import Phaser from "phaser";
|
|
import GameManager from "#app/test/utils/gameManager";
|
|
import * as overrides from "#app/overrides";
|
|
import {
|
|
CommandPhase,
|
|
EnemyCommandPhase,
|
|
TurnInitPhase,
|
|
} from "#app/phases";
|
|
import {Mode} from "#app/ui/ui";
|
|
import {getMovePosition} from "#app/test/utils/gameManagerUtils";
|
|
import {Command} from "#app/ui/command-ui-handler";
|
|
import {BattleStat} from "#app/data/battle-stat";
|
|
import { Abilities } from "#enums/abilities";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
|
|
|
|
describe("Moves - Tail whip", () => {
|
|
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.TAIL_WHIP;
|
|
vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true);
|
|
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RATTATA);
|
|
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA);
|
|
vi.spyOn(overrides, "ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.INSOMNIA);
|
|
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(2000);
|
|
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([moveToUse]);
|
|
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([Moves.TACKLE,Moves.TACKLE,Moves.TACKLE,Moves.TACKLE]);
|
|
});
|
|
|
|
it("TAIL_WHIP", async() => {
|
|
const moveToUse = Moves.TAIL_WHIP;
|
|
await game.startBattle([
|
|
Species.MIGHTYENA,
|
|
Species.MIGHTYENA,
|
|
]);
|
|
|
|
let battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
|
expect(battleStatsOpponent[BattleStat.DEF]).toBe(0);
|
|
|
|
game.onNextPrompt("CommandPhase", Mode.COMMAND, () => {
|
|
game.scene.ui.setMode(Mode.FIGHT, (game.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
|
|
});
|
|
game.onNextPrompt("CommandPhase", Mode.FIGHT, () => {
|
|
const movePosition = getMovePosition(game.scene, 0, moveToUse);
|
|
(game.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, movePosition, false);
|
|
});
|
|
await game.phaseInterceptor.runFrom(EnemyCommandPhase).to(TurnInitPhase);
|
|
battleStatsOpponent = game.scene.currentBattle.enemyParty[0].summonData.battleStats;
|
|
expect(battleStatsOpponent[BattleStat.DEF]).toBe(-1);
|
|
}, 20000);
|
|
});
|