mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-09 19:41:37 +00:00
* Replace various `scene` pass-arounds with global scene variable * Modify tests * Add scene back to `fade[in|out]()` calls Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Fix Bug Superfan ME test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Re-enable fixed test Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> * Rename `gScene` to `globalScene` * Move `globalScene` to its own file to fix import/async issues * Fix `SelectModifierPhase` tests * Fix ME tests by removing `scene` from `expect()`s * Resolve merge issues * Remove tsdocs referencing `scene` params Remove missed instances of `.scene` * Remove unnecessary `globalScene` usage in `loading-scene.ts` * Fix merge conflicts * Attempt to fix circular import issue * Found the source of the import issue * Fix merge issues --------- Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com>
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import { afterEach, beforeAll, beforeEach, expect, describe, it } from "vitest";
|
|
import GameManager from "#app/test/utils/gameManager";
|
|
import Phaser from "phaser";
|
|
import { Species } from "#enums/species";
|
|
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
|
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
|
import type BattleScene from "#app/battle-scene";
|
|
|
|
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(11);
|
|
game.override.mysteryEncounterChance(100);
|
|
});
|
|
|
|
it("Spawns a mystery encounter", async () => {
|
|
await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, [ Species.CHARIZARD, Species.VOLCARONA ]);
|
|
|
|
await game.phaseInterceptor.to(MysteryEncounterPhase, false);
|
|
expect(game.scene.getCurrentPhase()!.constructor.name).toBe(MysteryEncounterPhase.name);
|
|
});
|
|
|
|
it("Encounters should not run below wave 10", async () => {
|
|
game.override.startingWave(9);
|
|
|
|
await game.runToMysteryEncounter();
|
|
|
|
expect(scene.currentBattle?.mysteryEncounter?.encounterType).not.toBe(MysteryEncounterType.MYSTERIOUS_CHALLENGERS);
|
|
});
|
|
|
|
it("Encounters should not run above wave 180", async () => {
|
|
game.override.startingWave(181);
|
|
|
|
await game.runToMysteryEncounter();
|
|
|
|
expect(scene.currentBattle.mysteryEncounter).toBeUndefined();
|
|
});
|
|
});
|
|
|