mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-07 07:59:26 +02:00
* [Balance] Prevent MEs on X1 Waves * Fix Bug-Type Superfan Encounter Test * Fix Unit Tests
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import type { BattleScene } from "#app/battle-scene";
|
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
|
import { SpeciesId } from "#enums/species-id";
|
|
import { MysteryEncounterPhase } from "#phases/mystery-encounter-phases";
|
|
import { GameManager } from "#test/test-utils/game-manager";
|
|
import Phaser from "phaser";
|
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
|
|
describe("Mystery Encounters", () => {
|
|
let phaserGame: Phaser.Game;
|
|
let game: GameManager;
|
|
let scene: BattleScene;
|
|
|
|
beforeAll(() => {
|
|
phaserGame = new Phaser.Game({
|
|
type: Phaser.HEADLESS,
|
|
});
|
|
});
|
|
|
|
afterEach(() => {
|
|
game.phaseInterceptor.restoreOg();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
game = new GameManager(phaserGame);
|
|
scene = game.scene;
|
|
game.override.startingWave(12).mysteryEncounterChance(100);
|
|
});
|
|
|
|
it("Spawns a mystery encounter", async () => {
|
|
await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, [
|
|
SpeciesId.CHARIZARD,
|
|
SpeciesId.VOLCARONA,
|
|
]);
|
|
|
|
await game.phaseInterceptor.to(MysteryEncounterPhase, false);
|
|
expect(game.scene.phaseManager.getCurrentPhase()!.constructor.name).toBe(MysteryEncounterPhase.name);
|
|
});
|
|
|
|
it("Encounters should not run on X1 waves", async () => {
|
|
game.override.startingWave(11);
|
|
|
|
await game.runToMysteryEncounter();
|
|
|
|
expect(scene.currentBattle.mysteryEncounter).toBeUndefined();
|
|
});
|
|
|
|
it("Encounters should not run below wave 10", async () => {
|
|
game.override.startingWave(9);
|
|
|
|
await game.runToMysteryEncounter();
|
|
|
|
expect(scene.currentBattle.mysteryEncounter).toBeUndefined();
|
|
});
|
|
|
|
it("Encounters should not run above wave 180", async () => {
|
|
game.override.startingWave(181);
|
|
|
|
await game.runToMysteryEncounter();
|
|
|
|
expect(scene.currentBattle.mysteryEncounter).toBeUndefined();
|
|
});
|
|
});
|