PokéRogue
    Preparing search index...

    Class to manage the game state and transitions between phases.

    Index

    Constructors

    • Creates an instance of GameManager.

      Parameters

      • phaserGame: Game

        The Phaser game instance.

      • bypassLogin: boolean = true

        Whether to bypass the login phase.

      Returns GameManager

    Properties

    challengeMode: ChallengeModeHelper
    classicMode: ClassicModeHelper
    dailyMode: DailyModeHelper
    gameWrapper: GameWrapper
    inputsHandler: InputsHandler
    modifiers: ModifierHelper
    override: OverridesHelper
    phaseInterceptor: PhaseInterceptor
    reload: ReloadHelper
    settings: SettingsHelper
    textInterceptor: TextInterceptor

    Methods

    • Revive pokemon, currently players only.

      Parameters

      • pokemonIndex: number

        The 0-indexed position of the pokemon in your party to revive

      Returns void

    • Select a pokemon from the party menu during the given phase. Only really handles the basic case of "navigate to party slot and press Action twice" - any menus that come up afterwards are ignored and must be handled separately by the caller.

      Parameters

      • slot: number

        The 0-indexed position of the pokemon in your party to switch to

      • inPhase: string = "SwitchPhase"

        Which phase to expect the selection to occur in. Defaults to SwitchPhase (which is where the majority of non-command switch operations occur).

      Returns void

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

      Parameters

      • pokemonIndex: number

        The 0-indexed position of the party pokemon to switch to. Should never be called with 0 as that will select the currently active pokemon and freeze.

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

    • Initialize various default overrides for starting tests, typically to alleviate randomness.

      Returns void

    • Checks if the current phase matches the target phase.

      Parameters

      • phaseTarget:
            | "AddEnemyBuffModifierPhase"
            | "AttemptCapturePhase"
            | "AttemptRunPhase"
            | "BattleEndPhase"
            | "BerryPhase"
            | "CheckInterludePhase"
            | "CheckStatusEffectPhase"
            | "CheckSwitchPhase"
            | "CommandPhase"
            | "CommonAnimPhase"
            | "DamageAnimPhase"
            | "DynamicPhaseMarker"
            | "EggHatchPhase"
            | "EggLapsePhase"
            | "EggSummaryPhase"
            | "EncounterPhase"
            | "EndCardPhase"
            | "EndEvolutionPhase"
            | "EnemyCommandPhase"
            | "EvolutionPhase"
            | "ExpPhase"
            | "FaintPhase"
            | "FormChangePhase"
            | "GameOverPhase"
            | "GameOverModifierRewardPhase"
            | "HideAbilityPhase"
            | "HidePartyExpBarPhase"
            | "InitEncounterPhase"
            | "LearnMovePhase"
            | "LevelCapPhase"
            | "LevelUpPhase"
            | "LoadMoveAnimPhase"
            | "LoginPhase"
            | "MessagePhase"
            | "ModifierRewardPhase"
            | "MoneyRewardPhase"
            | "MoveAnimPhase"
            | "MoveChargePhase"
            | "MoveEffectPhase"
            | "MoveEndPhase"
            | "MoveHeaderPhase"
            | "MovePhase"
            | "MysteryEncounterPhase"
            | "MysteryEncounterOptionSelectedPhase"
            | "MysteryEncounterBattlePhase"
            | "MysteryEncounterBattleStartCleanupPhase"
            | "MysteryEncounterRewardsPhase"
            | "PostMysteryEncounterPhase"
            | "NewBattlePhase"
            | "NewBiomeEncounterPhase"
            | "NextEncounterPhase"
            | "ObtainStatusEffectPhase"
            | "PartyExpPhase"
            | "PartyHealPhase"
            | "PokemonAnimPhase"
            | "PokemonHealPhase"
            | "PokemonTransformPhase"
            | "PositionalTagPhase"
            | "PostGameOverPhase"
            | "PostSummonPhase"
            | "PostTurnStatusEffectPhase"
            | "QuietFormChangePhase"
            | "ReloadSessionPhase"
            | "ResetStatusPhase"
            | "ReturnPhase"
            | "RevivalBlessingPhase"
            | "RibbonModifierRewardPhase"
            | "ScanIvsPhase"
            | "SelectBiomePhase"
            | "SelectChallengePhase"
            | "SelectGenderPhase"
            | "SelectModifierPhase"
            | "SelectStarterPhase"
            | "SelectTargetPhase"
            | "ShinySparklePhase"
            | "ShowAbilityPhase"
            | "ShowPartyExpBarPhase"
            | "ShowTrainerPhase"
            | "StatStageChangePhase"
            | "SummonMissingPhase"
            | "SummonPhase"
            | "SwitchBiomePhase"
            | "SwitchPhase"
            | "SwitchSummonPhase"
            | "TeraPhase"
            | "TitlePhase"
            | "ToggleDoublePositionPhase"
            | "TrainerVictoryPhase"
            | "TurnEndPhase"
            | "TurnInitPhase"
            | "TurnStartPhase"
            | "UnavailablePhase"
            | "UnlockPhase"
            | "VictoryPhase"
            | "WeatherEffectPhase"
            | PhaseClass

        The target phase.

      Returns boolean

      Whether the current phase matches the target phase

      Remove phaseClass from signature

    • Check if the player has won the battle.

      Returns boolean

      whether the player has won the battle (all opposing Pokemon have been fainted)

    • Faint a player or enemy pokemon instantly by setting their HP to 0.

      Parameters

      Returns Promise<void>

      A Promise that resolves once the fainted pokemon's FaintPhase finishes running.

      This method pushes a FaintPhase and runs until it's finished. This may cause a turn to play out unexpectedly

      Consider whether running the faint phase immediately can be done

    • Adds an action to be executed on the next prompt. This can be used to (among other things) simulate inputs or run functions mid-phase.

      Parameters

      • phaseTarget: string

        The target phase.

      • mode: UiMode

        The mode to wait for.

      • callback: () => void

        The callback function to execute on next prompt.

      • OptionalexpireFn: () => void

        Optional function to determine if the prompt has expired.

      • awaitingActionInput: boolean = false

      Returns void

    • Modifies the queue manager to return move phases in a particular order Used to manually modify Pokemon turn order. Note: This DOES NOT account for priority.

      Parameters

      Returns Promise<void>

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