PokéRogue
    Preparing search index...

    The PhaseInterceptor is a wrapper around the BattleScene's PhaseManager. It allows tests to exert finer control over the phase system, providing logging, manual advancing, and other helpful utilities.

    Index

    Constructors

    Properties

    log: (
        | "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"
    )[] = []

    A log containing all phases having been executed in FIFO order.
    Entries are appended each time run is called, and can be cleared manually with clearLogs.

    state: StateType = "idling"

    The interceptor's current state.

    idling

    target:
        | "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 current target that is being ran to.

    Methods

    • If this is at the target phase, unlock the interceptor and return control back to the caller once the calling phase has finished.

      Returns void

      This should not be called by anything other than PromptHandler.

    • Wrapper function to add coral coloration to phase logs.

      Parameters

      • ...args: unknown[]

        Arguments to original logging function

      Returns void

    • Method to log the start of a phase. Called in place of PhaseManager.startCurrentPhase to allow for manual intervention.

      Parameters

      • phaseName:
            | "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 to log

      Returns void

    • Skip the next upcoming phase.

      Returns void

      Error if currently running a phase.

      This function should be used for skipping phases not yet started. To end ones already in the process of running, use GameManager.endPhase.

      await game.phaseInterceptor.to("LoginPhase", false);
      game.phaseInterceptor.shiftPhase(); // skips LoginPhase without starting it
    • Method to transition to a target phase.

      Parameters

      • target:
            | "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 to transition to

      • runTarget: boolean = true

        Whether or not to run the target phase before resolving; default true

      Returns Promise<void>

      A Promise that resolves once target has been reached.

      This will not resolve for any reason until the target phase has been reached.

      await game.phaseInterceptor.to("MoveEffectPhase", false);