PokéRogue
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    fieldIndex: number
    isSwitch: boolean = false

    Whether the command phase is handling a switch command

    phaseName: "CommandPhase"

    The string name of the phase, used to identify the phase type for is

    Methods

    • Helper method for handleBallCommand that checks if a pokeball can be thrown and displays the appropriate error message.

      Returns boolean

      Whether a pokeball can be thrown

      The pokeball may not be thrown if any of the following are true:

      • It is a trainer battle
      • The player is in the End biome and
        • it is not classic mode; or
        • the player has not caught the target before and the player is still missing more than one starter
      • The player is in a mystery encounter that disallows catching the pokemon
    • Clear out all unusable moves in front of the currently acting pokemon's move queue.

      Returns void

    • Helper method for handleCommand that handles the logic when the selected command is to use a pokeball.

      Parameters

      • cursor: number

        The index of the pokeball to use

      Returns boolean

      Whether the command was successfully initiated

    • Process the command phase logic based on the selected command

      Parameters

      • command: FIGHT | TERA

        The kind of command to handle

      • cursor: number

        The index of option that the cursor is on, or -1 if no option is selected

      • OptionaluseMode: MoveUseMode

        The mode to use for the move, if applicable. For switches, a boolean that specifies whether the switch is a Baton switch.

      • Optionalmove: TurnMove

        For Command.FIGHT, the move to use

      Returns boolean

      Whether the command was successful

    • Process the command phase logic based on the selected command

      Parameters

      • command: POKEMON

        The kind of command to handle

      • cursor: number

        The index of option that the cursor is on, or -1 if no option is selected

      • useBaton: boolean

      Returns boolean

      Whether the command was successful

    • Process the command phase logic based on the selected command

      Parameters

      • command: BALL | RUN

        The kind of command to handle

      • cursor: number

        The index of option that the cursor is on, or -1 if no option is selected

      Returns boolean

      Whether the command was successful

    • Process the command phase logic based on the selected command

      Parameters

      • command: Command

        The kind of command to handle

      • cursor: number

        The index of option that the cursor is on, or -1 if no option is selected

      • OptionaluseMode: boolean | MoveUseMode

        The mode to use for the move, if applicable. For switches, a boolean that specifies whether the switch is a Baton switch.

      • Optionalmove: TurnMove

        For Command.FIGHT, the move to use

      Returns boolean

      Whether the command was successful

    • Submethod of start that validates field index logic for nonzero field indices. Must only be called if the field index is nonzero.

      Returns void

    • Process the logic for executing a fight-related command

      Parameters

      • command: FIGHT | TERA

        The command to handle (FIGHT or TERA)

      • cursor: number

        The index that the cursor is placed on, or -1 if no move can be selected.

      • useMode: MoveUseMode = MoveUseMode.NORMAL
      • Optionalmove: TurnMove

        The move to force the command to use, if any.

      Returns boolean

      • Validates whether the move can be used, using struggle if not
      • Constructs the turn command and inserts it into the battle's turn commands
    • Helper method for handleCommand that handles the logic when the selected command is RUN.

      Returns boolean

      Whether the pokemon is able to leave the field, indicating the command phase should end

      Checks if the player is allowed to flee, and if not, queues the appropriate message.

      The player cannot flee if:

      • The player is in the End biome
      • The player is in a trainer battle
      • The player is in a mystery encounter that disallows fleeing
      • The player's pokemon is trapped by an ability or effect
    • Submethod of tryLeaveField to handle the logic for effects that prevent the pokemon from leaving the field due to trapping abilities or effects.

      This method queues the proper messages in the case of trapping abilities or effects.

      Returns boolean

      Whether the pokemon is currently trapped

    • Check if the phase is of the given type without requiring instanceof.

      Type Parameters

      • K extends
            | "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"

      Parameters

      • phase: K

        The string name of the phase to check.

      Returns this is PhaseMap[K]

      Whether this phase is of the provided type.

      This does not check for subclasses! It only checks if the phase is exactly the given type. This method exists to avoid circular import issues, as using instanceof would require importing each phase.

    • Submethod of handleFightCommand responsible for queuing the provided error message when the move cannot be used

      Parameters

      • msg: string

        The reason why the move cannot be used

      Returns void

    • Set the mode in preparation to show the text, and then show the text. Only works for parameterless i18next keys.

      Parameters

      • key: string

        The i18next key for the text to show

      Returns void

    • Resets the cursor to the position of Command.FIGHT if any of the following are true

      • The setting to remember the last action is not enabled
      • This is the first turn of a mystery encounter, trainer battle, or the END biome
      • The cursor is currently on the POKEMON command

      Returns void

    • Show a message indicating that the pokemon cannot escape, and then return to the command phase.

      Parameters

      • tag: any
      • isSwitch: boolean

      Returns void

    • Attempt to execute the first usable move in this Pokemon's move queue

      Returns boolean

      Whether a queued move was successfully set to be executed.

    • Common helper method that attempts to have the pokemon leave the field. Checks for trapping abilities and effects.

      Parameters

      • Optionalcursor: number

        The index of the option that the cursor is on

      • isBatonSwitch: boolean = false

      Returns boolean

      Whether the pokemon is able to leave the field, indicating the command phase should end