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

classicMode: ClassicModeHelper
dailyMode: DailyModeHelper
gameWrapper: default
inputsHandler: default
override: OverridesHelper
phaseInterceptor: default
scene: default
textInterceptor: default

Methods

  • Emulate a player attack

    Parameters

    • movePosition: number

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

    Returns void

  • 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

  • Emulate a player's target selection after an attack is chosen, usually called after doAttack in a double battle.

    Parameters

    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.

  • 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.

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

    Parameters

    Returns Promise<void>

    await game.setTurnOrder([BattlerIndex.PLAYER, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2]);
    
  • Transitions to the start of a battle.

    Parameters

    • Optionalspecies: Species[]

      Optional array of species to start the battle with.

    Returns Promise<void>

    A promise that resolves when the battle is started.

  • 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.