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

gameWrapper: default
inputsHandler: default
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

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

    Parameters

    Returns void

  • Switch pokemon and transition to the enemy command phase

    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

  • Runs the game to the summon phase.

    Parameters

    • Optionalspecies: Species[]

      Optional array of species to summon.

    Returns Promise<void>

    A promise that resolves when the summon phase is reached.

  • Runs the game to the title phase.

    Returns Promise<void>

    A promise that resolves when the title phase is reached.

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