Class to manage the game state and transitions between phases.

Constructors

  • Creates an instance of GameManager.

    Parameters

    • phaserGame: Game

      The Phaser game instance.

    • bypassLogin: boolean = true

      Whether to bypass the login phase.

    Returns default

Properties

challengeMode: ChallengeModeHelper
classicMode: ClassicModeHelper
dailyMode: DailyModeHelper
gameWrapper: default
inputsHandler: default
override: OverridesHelper
phaseInterceptor: default
reload: ReloadHelper
scene: default
settings: SettingsHelper
textInterceptor: default

Methods

  • Revive pokemon, currently players only.

    Parameters

    • pokemonIndex: number

      the index of the pokemon in your party to revive

    Returns void

  • Select a pokemon from the party menu. Only really handles the basic cases of the party UI, where you just need to navigate to a party slot and press Action twice - navigating any menus that come up after you select a party member is not supported.

    Parameters

    • slot: number

      the index of the pokemon in your party to switch to

    • inPhase: string = "SwitchPhase"

      Which phase to expect the selection to occur in. Typically non-command switch actions happen in SwitchPhase.

    Returns void

  • Command an in-battle switch to another Pokemon via the main battle menu.

    Parameters

    • pokemonIndex: number

      the index of the pokemon in your party to switch to

    Returns void

  • Exports the save data to import it in a test game.

    Returns Promise<string>

    A promise that resolves with the exported save data.

  • Forces the next enemy selecting a move to use the given move in its moveset against the given target (if applicable).

    Parameters

    Returns Promise<void>

  • Imports game data from a file.

    Parameters

    • path: any

      The path to the data file.

    Returns Promise<[boolean, number]>

    A promise that resolves with a tuple containing a boolean indicating success and an integer status code.

  • Checks if the current mode matches the target mode.

    Parameters

    • mode: Mode

      The target mode.

    Returns boolean

    True if the current mode matches the target mode, otherwise false.

  • Checks if the current phase matches the target phase.

    Parameters

    • phaseTarget: any

      The target phase.

    Returns boolean

    True if the current phase matches the target phase, otherwise false.

  • Checks if the player has won the battle.

    Returns boolean

    True if the player has won, otherwise false.

  • Adds an action to be executed on the next prompt.

    Parameters

    • phaseTarget: string

      The target phase.

    • mode: Mode

      The mode to wait for.

    • callback: (() => void)

      The callback to execute.

        • (): void
        • Returns void

    • OptionalexpireFn: (() => void)

      Optional function to determine if the prompt has expired.

        • (): void
        • Returns void

    • awaitingActionInput: boolean = false

    Returns void

  • Helper function to run to the final boss encounter as it's a bit tricky due to extra dialogue Also handles Major/Minor bosses from endless modes

    Parameters

    Returns Promise<void>

  • Runs the game to the title phase.

    Returns Promise<void>

    A promise that resolves when the title phase is reached.

  • Emulate a player's target selection after a move is chosen, usually called automatically by MoveHelper.select. Will trigger during the next SelectTargetPhase

    Parameters

    • movePosition: number

      The index of the move in the pokemon's moveset array

    • OptionaltargetIndex: BattlerIndex

      The index of the attack target, or undefined for multi-target attacks

    Returns void

  • Intercepts TurnStartPhase and mocks the getSpeedOrder's return value TurnStartPhase.getSpeedOrder Used to modify the turn order.

    Parameters

    Returns Promise<void>

    await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2]);
    
  • Parameters

    • Optionalspecies: Species[]

      Optional array of species to start the battle with.

    Returns Promise<void>

    A promise that resolves when the battle is started.

    Use game.classicMode.startBattle() or game.dailyMode.startBattle() instead

    Transitions to the start of a battle.

  • Waits until the specified mode is set.

    Parameters

    • mode: Mode

      The mode to wait for.

    Returns Promise<void>

    A promise that resolves when the mode is set.