mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-25 16:26:25 +00:00
Create the appropriate startBattle()
functions in the helper classes (#3855)
This commit is contained in:
parent
214a9275a9
commit
4124ad0b93
@ -1,6 +1,7 @@
|
||||
import { updateUserInfo } from "#app/account";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import BattleScene from "#app/battle-scene";
|
||||
import { BattleStyle } from "#app/enums/battle-style";
|
||||
import { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
||||
import Trainer from "#app/field/trainer";
|
||||
import { GameModes, getGameMode } from "#app/game-mode";
|
||||
@ -170,6 +171,8 @@ export default class GameManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `game.classicMode.startBattle()` or `game.dailyMode.startBattle()` instead
|
||||
*
|
||||
* Transitions to the start of a battle.
|
||||
* @param species - Optional array of species to start the battle with.
|
||||
* @returns A promise that resolves when the battle is started.
|
||||
@ -177,15 +180,17 @@ export default class GameManager {
|
||||
async startBattle(species?: Species[]) {
|
||||
await this.classicMode.runToSummon(species);
|
||||
|
||||
this.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||
this.setMode(Mode.MESSAGE);
|
||||
this.endPhase();
|
||||
}, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase));
|
||||
if (this.scene.battleStyle === BattleStyle.SWITCH) {
|
||||
this.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||
this.setMode(Mode.MESSAGE);
|
||||
this.endPhase();
|
||||
}, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase));
|
||||
|
||||
this.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||
this.setMode(Mode.MESSAGE);
|
||||
this.endPhase();
|
||||
}, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase));
|
||||
this.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||
this.setMode(Mode.MESSAGE);
|
||||
this.endPhase();
|
||||
}, () => this.isCurrentPhase(CommandPhase) || this.isCurrentPhase(TurnInitPhase));
|
||||
}
|
||||
|
||||
await this.phaseInterceptor.to(CommandPhase);
|
||||
console.log("==================[New Turn]==================");
|
||||
|
@ -1,8 +1,11 @@
|
||||
import { BattleStyle } from "#app/enums/battle-style";
|
||||
import { Species } from "#app/enums/species";
|
||||
import { GameModes, getGameMode } from "#app/game-mode";
|
||||
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 { Mode } from "#app/ui/ui";
|
||||
import { generateStarter } from "../gameManagerUtils";
|
||||
import { GameManagerHelper } from "./gameManagerHelper";
|
||||
@ -33,4 +36,28 @@ export class ClassicModeHelper extends GameManagerHelper {
|
||||
this.game.removeEnemyHeldItems();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transitions to the start of a battle.
|
||||
* @param species - Optional array of species to start the battle with.
|
||||
* @returns A promise that resolves when the battle is started.
|
||||
*/
|
||||
async startBattle(species?: Species[]) {
|
||||
await this.runToSummon(species);
|
||||
|
||||
if (this.game.scene.battleStyle === BattleStyle.SWITCH) {
|
||||
this.game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||
this.game.setMode(Mode.MESSAGE);
|
||||
this.game.endPhase();
|
||||
}, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase));
|
||||
|
||||
this.game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||
this.game.setMode(Mode.MESSAGE);
|
||||
this.game.endPhase();
|
||||
}, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase));
|
||||
}
|
||||
|
||||
await this.game.phaseInterceptor.to(CommandPhase);
|
||||
console.log("==================[New Turn]==================");
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { BattleStyle } from "#app/enums/battle-style";
|
||||
import { Button } from "#app/enums/buttons";
|
||||
import overrides from "#app/overrides";
|
||||
import { CommandPhase } from "#app/phases/command-phase";
|
||||
import { EncounterPhase } from "#app/phases/encounter-phase";
|
||||
import { TitlePhase } from "#app/phases/title-phase";
|
||||
import { TurnInitPhase } from "#app/phases/turn-init-phase";
|
||||
import SaveSlotSelectUiHandler from "#app/ui/save-slot-select-ui-handler";
|
||||
import { Mode } from "#app/ui/ui";
|
||||
import { GameManagerHelper } from "./gameManagerHelper";
|
||||
@ -34,4 +37,27 @@ export class DailyModeHelper extends GameManagerHelper {
|
||||
this.game.removeEnemyHeldItems();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transitions to the start of a battle.
|
||||
* @returns A promise that resolves when the battle is started.
|
||||
*/
|
||||
async startBattle() {
|
||||
await this.runToSummon();
|
||||
|
||||
if (this.game.scene.battleStyle === BattleStyle.SWITCH) {
|
||||
this.game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||
this.game.setMode(Mode.MESSAGE);
|
||||
this.game.endPhase();
|
||||
}, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase));
|
||||
|
||||
this.game.onNextPrompt("CheckSwitchPhase", Mode.CONFIRM, () => {
|
||||
this.game.setMode(Mode.MESSAGE);
|
||||
this.game.endPhase();
|
||||
}, () => this.game.isCurrentPhase(CommandPhase) || this.game.isCurrentPhase(TurnInitPhase));
|
||||
}
|
||||
|
||||
await this.game.phaseInterceptor.to(CommandPhase);
|
||||
console.log("==================[New Turn]==================");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user