mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-11-26 13:08:17 +01: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>
97 lines
3.9 KiB
TypeScript
97 lines
3.9 KiB
TypeScript
import { CommandPhase } from "#app/phases/command-phase";
|
|
import { Mode } from "#app/ui/ui";
|
|
import { Abilities } from "#enums/abilities";
|
|
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("Test Battle Phase", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
game.override.enemySpecies(Species.RATTATA);
|
|
game.override.startingLevel(2000);
|
|
game.override.moveset([Moves.TACKLE]);
|
|
game.override.enemyAbility(Abilities.HYDRATION);
|
|
game.override.ability(Abilities.HYDRATION);
|
|
game.override.enemyMoveset([Moves.TACKLE, Moves.TACKLE, Moves.TACKLE, Moves.TACKLE]);
|
|
});
|
|
|
|
it("startBattle 2vs1 boss", async () => {
|
|
game.override.battleStyle("single").startingWave(10);
|
|
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
|
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
|
}, 20000);
|
|
|
|
it("startBattle 2vs2 boss", async () => {
|
|
game.override.battleStyle("double").startingWave(10);
|
|
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
|
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
|
}, 20000);
|
|
|
|
it("startBattle 2vs2 trainer", async () => {
|
|
game.override.battleStyle("double").startingWave(5);
|
|
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
|
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
|
}, 20000);
|
|
|
|
it("startBattle 2vs1 trainer", async () => {
|
|
game.override.battleStyle("single").startingWave(5);
|
|
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
|
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
|
}, 20000);
|
|
|
|
it("startBattle 2vs1 rival", async () => {
|
|
game.override.battleStyle("single").startingWave(8);
|
|
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
|
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
|
}, 20000);
|
|
|
|
it("startBattle 2vs2 rival", async () => {
|
|
game.override.battleStyle("double").startingWave(8);
|
|
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
|
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
|
}, 20000);
|
|
|
|
it("startBattle 1vs1 trainer", async () => {
|
|
game.override.battleStyle("single").startingWave(5);
|
|
await game.startBattle([Species.BLASTOISE]);
|
|
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
|
}, 20000);
|
|
|
|
it("startBattle 2vs2 trainer", async () => {
|
|
game.override.battleStyle("double").startingWave(5);
|
|
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD]);
|
|
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
|
}, 20000);
|
|
|
|
it("startBattle 4vs2 trainer", async () => {
|
|
game.override.battleStyle("double").startingWave(5);
|
|
await game.startBattle([Species.BLASTOISE, Species.CHARIZARD, Species.DARKRAI, Species.GABITE]);
|
|
expect(game.scene.ui?.getMode()).toBe(Mode.COMMAND);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(CommandPhase.name);
|
|
}, 20000);
|
|
});
|