pokerogue/test/moves/magnet_rise.test.ts

62 lines
2.0 KiB
TypeScript
Raw Permalink Normal View History

import { CommandPhase } from "#app/phases/command-phase";
import { TurnEndPhase } from "#app/phases/turn-end-phase";
2024-07-25 16:18:47 -07:00
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import GameManager from "#test/testUtils/gameManager";
2024-07-25 16:18:47 -07:00
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
describe("Moves - Magnet Rise", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
const moveToUse = Moves.MAGNET_RISE;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
2024-07-25 14:48:48 -07:00
game.override.battleType("single");
2024-07-25 15:24:07 -07:00
game.override.starterSpecies(Species.MAGNEZONE);
2024-07-25 14:57:47 -07:00
game.override.enemySpecies(Species.RATTATA);
2024-10-04 13:08:31 +08:00
game.override.enemyMoveset([ Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN ]);
2024-07-25 16:18:47 -07:00
game.override.disableCrits();
2024-07-25 16:10:38 -07:00
game.override.enemyLevel(1);
2024-10-04 13:08:31 +08:00
game.override.moveset([ moveToUse, Moves.SPLASH, Moves.GRAVITY, Moves.BATON_PASS ]);
});
it("MAGNET RISE", async () => {
await game.startBattle();
const startingHp = game.scene.getPlayerParty()[0].hp;
game.move.select(moveToUse);
await game.phaseInterceptor.to(TurnEndPhase);
const finalHp = game.scene.getPlayerParty()[0].hp;
const hpLost = finalHp - startingHp;
expect(hpLost).toBe(0);
}, 20000);
it("MAGNET RISE - Gravity", async () => {
await game.startBattle();
const startingHp = game.scene.getPlayerParty()[0].hp;
game.move.select(moveToUse);
await game.phaseInterceptor.to(CommandPhase);
let finalHp = game.scene.getPlayerParty()[0].hp;
let hpLost = finalHp - startingHp;
expect(hpLost).toBe(0);
game.move.select(Moves.GRAVITY);
await game.phaseInterceptor.to(TurnEndPhase);
finalHp = game.scene.getPlayerParty()[0].hp;
hpLost = finalHp - startingHp;
expect(hpLost).not.toBe(0);
}, 20000);
});