mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
* Move game-mode to its own file Reduces circular imports to 325 * Move battler-index to own file Reduces circular deps to 314 * Move trainer-variant to own file Reduces circ deps to 313 * Move enums in pokemon to their own file * Move arena-tag-type to its own file * Move pokemon-moves to its own file * Move command to own file * Move learnMoveType to own file * Move form change item to own file * Move battlerTagLapseType to own file * Move anim enums to own shared file * Move enums out of challenges * Move species form change triggers to own file Reduces circ imports to 291 * Update test importing pokemon move * Replace move attribute imports with string names * Untangle circular deps from game data * Fix missing string call in switch summon phase * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Ensure ChargeMove's is method calls super * Use InstanceType for proper narrowing * Apply kev's suggestions from code review Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
97 lines
3.8 KiB
TypeScript
97 lines
3.8 KiB
TypeScript
import { BattleStyle } from "#app/enums/battle-style";
|
|
import type { SpeciesId } from "#enums/species-id";
|
|
import { getGameMode } from "#app/game-mode";
|
|
import { GameModes } from "#enums/game-modes";
|
|
import overrides from "#app/overrides";
|
|
import { CommandPhase } from "#app/phases/command-phase";
|
|
import { EncounterPhase } from "#app/phases/encounter-phase";
|
|
import { SelectStarterPhase } from "#app/phases/select-starter-phase";
|
|
import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
|
import { UiMode } from "#enums/ui-mode";
|
|
import { generateStarter } from "../gameManagerUtils";
|
|
import { GameManagerHelper } from "./gameManagerHelper";
|
|
|
|
/**
|
|
* Helper to handle classic-mode specific operations.
|
|
*/
|
|
export class ClassicModeHelper extends GameManagerHelper {
|
|
/**
|
|
* Runs the classic game to the summon phase.
|
|
* @param species - An array of {@linkcode Species} to summon.
|
|
* @returns A promise that resolves when the summon phase is reached.
|
|
*/
|
|
async runToSummon(species: SpeciesId[]): Promise<void>;
|
|
/**
|
|
* Runs the classic game to the summon phase.
|
|
* Selects 3 daily run starters with a fixed seed of "test"
|
|
* (see `DailyRunConfig.getDailyRunStarters` in `daily-run.ts` for more info).
|
|
* @returns A promise that resolves when the summon phase is reached.
|
|
* @deprecated - Specifying the starters helps prevent inconsistencies from internal RNG changes.
|
|
*/
|
|
async runToSummon(): Promise<void>;
|
|
async runToSummon(species: SpeciesId[] | undefined): Promise<void>;
|
|
async runToSummon(species?: SpeciesId[]): Promise<void> {
|
|
await this.game.runToTitle();
|
|
|
|
if (this.game.override.disableShinies) {
|
|
this.game.override.shiny(false).enemyShiny(false);
|
|
}
|
|
|
|
this.game.onNextPrompt("TitlePhase", UiMode.TITLE, () => {
|
|
this.game.scene.gameMode = getGameMode(GameModes.CLASSIC);
|
|
const starters = generateStarter(this.game.scene, species);
|
|
const selectStarterPhase = new SelectStarterPhase();
|
|
this.game.scene.phaseManager.pushPhase(new EncounterPhase(false));
|
|
selectStarterPhase.initBattle(starters);
|
|
});
|
|
|
|
await this.game.phaseInterceptor.to(EncounterPhase);
|
|
if (overrides.OPP_HELD_ITEMS_OVERRIDE.length === 0 && this.game.override.removeEnemyStartingItems) {
|
|
this.game.removeEnemyHeldItems();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Transitions to the start of a battle.
|
|
* @param species - An array of {@linkcode Species} to start the battle with.
|
|
* @returns A promise that resolves when the battle is started.
|
|
*/
|
|
async startBattle(species: SpeciesId[]): Promise<void>;
|
|
/**
|
|
* Transitions to the start of a battle.
|
|
* Will select 3 daily run starters with a fixed seed of "test"
|
|
* (see `DailyRunConfig.getDailyRunStarters` in `daily-run.ts` for more info).
|
|
* @returns A promise that resolves when the battle is started.
|
|
* @deprecated - Specifying the starters helps prevent inconsistencies from internal RNG changes.
|
|
*/
|
|
async startBattle(): Promise<void>;
|
|
async startBattle(species?: SpeciesId[]): Promise<void> {
|
|
await this.runToSummon(species);
|
|
|
|
if (this.game.scene.battleStyle === BattleStyle.SWITCH) {
|
|
this.game.onNextPrompt(
|
|
"CheckSwitchPhase",
|
|
UiMode.CONFIRM,
|
|
() => {
|
|
this.game.setMode(UiMode.MESSAGE);
|
|
this.game.endPhase();
|
|
},
|
|
() => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase),
|
|
);
|
|
|
|
this.game.onNextPrompt(
|
|
"CheckSwitchPhase",
|
|
UiMode.CONFIRM,
|
|
() => {
|
|
this.game.setMode(UiMode.MESSAGE);
|
|
this.game.endPhase();
|
|
},
|
|
() => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase),
|
|
);
|
|
}
|
|
|
|
await this.game.phaseInterceptor.to(CommandPhase);
|
|
console.log("==================[New Turn]==================");
|
|
}
|
|
}
|