mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-20 16:42:45 +02:00
* Add isPartner method to trainer class * Ensure force switches cannot pull pokemon from the wrong trainer * Add override for battle type * Fixup tests and broken assumptions * Make move fail override semi-invuln check Bandaid fix because move effect phase does not allow for the move to fail if all of its conditions fail * Restore overrides * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Fix illusion test battle type invocation * Update struggle and healer tests to use battleStyle --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
62 lines
2.0 KiB
TypeScript
62 lines
2.0 KiB
TypeScript
import { CommandPhase } from "#app/phases/command-phase";
|
|
import { TurnEndPhase } from "#app/phases/turn-end-phase";
|
|
import { Moves } from "#enums/moves";
|
|
import { Species } from "#enums/species";
|
|
import GameManager from "#test/testUtils/gameManager";
|
|
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);
|
|
game.override.battleStyle("single");
|
|
game.override.starterSpecies(Species.MAGNEZONE);
|
|
game.override.enemySpecies(Species.RATTATA);
|
|
game.override.enemyMoveset([Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN, Moves.DRILL_RUN]);
|
|
game.override.disableCrits();
|
|
game.override.enemyLevel(1);
|
|
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);
|
|
});
|