pokerogue/src/test/utils/helpers/classicModeHelper.ts
NightKev 0d3fcd82bb
[Bug] Fix daily run generated movesets (#3519)
* Fix daily run generated movesets

* add unit-tests for `fix-daily-run` (#3)

* add `daily` and `classic` helper. split `runToSummon`

there is now a `classicMode.runToSummon` which represents the old one used.
There is now a `dailyMode.runToSummon` too

* add daily_mode.test.ts

covers the occured issue

---------

Co-authored-by: flx-sta <50131232+flx-sta@users.noreply.github.com>
2024-08-13 21:48:56 +01:00

36 lines
1.3 KiB
TypeScript

import { Species } from "#app/enums/species.js";
import { GameModes, getGameMode } from "#app/game-mode.js";
import overrides from "#app/overrides.js";
import { EncounterPhase, SelectStarterPhase } from "#app/phases.js";
import { Mode } from "#app/ui/ui.js";
import { generateStarter } from "../gameManagerUtils";
import { GameManagerHelper } from "./gameManagerHelper";
/**
* Helper to handle classic mode specifics
*/
export class ClassicModeHelper extends GameManagerHelper {
/**
* Runs the classic game to the summon phase.
* @param species - Optional array of species to summon.
* @returns A promise that resolves when the summon phase is reached.
*/
async runToSummon(species?: Species[]) {
await this.game.runToTitle();
this.game.onNextPrompt("TitlePhase", Mode.TITLE, () => {
this.game.scene.gameMode = getGameMode(GameModes.CLASSIC);
const starters = generateStarter(this.game.scene, species);
const selectStarterPhase = new SelectStarterPhase(this.game.scene);
this.game.scene.pushPhase(new EncounterPhase(this.game.scene, false));
selectStarterPhase.initBattle(starters);
});
await this.game.phaseInterceptor.run(EncounterPhase);
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0) {
this.game.removeEnemyHeldItems();
}
}
}