PokéRogue
    Preparing search index...

    Helper class to handle executing prompts upon UI mode changes.

    Remove once a UI overhaul occurs - using this correctly effectively requires one to know the entire phase heiarchy

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    originalSetModeInternal: (
        this: UI,
        mode: UiMode,
        clear: boolean,
        forceTransition: boolean,
        chainMode: boolean,
        args: any[],
    ) => Promise<void>

    The original setModeInternal function, stored for use in setMode.

    prompts: UIPrompt[] = []

    An array of prompts with associated callbacks.

    runInterval?: Timeout

    A Timeout containing an interval used to check prompts.

    Is unused during test execution itself, as pre- and post-test hooks automatically set and clear it to avoid deadlocks.

    Methods

    • Queue a callback to be executed on the next UI mode change. This can be used to (among other things) simulate inputs or run callbacks mid-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"

        The name of the Phase during which the callback will be executed

      • mode: UiMode

        The UiMode to wait for

      • callback: () => void

        The callback function to execute

      • OptionalexpireFn: () => boolean

        Optional function to determine if the prompt has expired

      • awaitingActionInput: boolean = false

        If true, restricts the prompt to only activate when the current AwaitableUiHandler is waiting for input; default false

      Returns void

      If multiple prompts are queued up in succession, each will be checked in turn until the first prompt that neither expires nor matches.

      Review all uses of this function to check if they can be made synchronous and if AwaitableUiHandlers can be stubbed to always be active

    • Wrapper function to add coloration to phase logs.

      Parameters

      • ...args: unknown[]

        Arguments to original logging function

      Returns void

    • Helper method to wrap UI mode changing.

      Parameters

      • args: [
            mode: UiMode,
            clear: boolean,
            forceTransition: boolean,
            chainMode: boolean,
            args: any[],
        ]

        Arguments being passed to the original method

      Returns Promise<void>

      The original return value.

      Make this wait for the actual UI mode setting