pokerogue/src/test/moves/magnet_rise.test.ts

62 lines
1.9 KiB
TypeScript
Raw Normal View History

import GameManager from "#test/utils/gameManager";
2024-07-25 16:18:47 -07:00
import { Moves } from "#enums/moves";
import { Species } from "#enums/species";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
2024-08-19 03:23:52 +01:00
import { CommandPhase } from "#app/phases/command-phase.js";
import { TurnEndPhase } from "#app/phases/turn-end-phase.js";
describe("Moves - Magnet Rise", () => {
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.MAGNET_RISE;
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-07-25 15:18:14 -07: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-07-25 15:51:05 -07:00
game.override.moveset([moveToUse, Moves.SPLASH, Moves.GRAVITY, Moves.BATON_PASS]);
});
it("MAGNET RISE", async () => {
await game.startBattle();
const startingHp = game.scene.getParty()[0].hp;
game.doAttack(0);
await game.phaseInterceptor.to(TurnEndPhase);
const finalHp = game.scene.getParty()[0].hp;
const hpLost = finalHp - startingHp;
expect(hpLost).toBe(0);
}, 20000);
it("MAGNET RISE - Gravity", async () => {
await game.startBattle();
const startingHp = game.scene.getParty()[0].hp;
game.doAttack(0);
await game.phaseInterceptor.to(CommandPhase);
let finalHp = game.scene.getParty()[0].hp;
let hpLost = finalHp - startingHp;
expect(hpLost).toBe(0);
game.doAttack(2);
await game.phaseInterceptor.to(TurnEndPhase);
finalHp = game.scene.getParty()[0].hp;
hpLost = finalHp - startingHp;
expect(hpLost).not.toBe(0);
}, 20000);
});