PokéRogue
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _pokemon: Pokemon
    _targets: BattlerIndex[]
    battlerIndex: number

    The battler index this phase refers to, or the pokemon ID if greater than 3. TODO: Make this either use IDs or BattlerIndexes, not a weird mix of both

    cancelled: boolean = false

    Whether the current move should fail and retain PP.

    failed: boolean = false

    Whether the current move should fail but still use PP.

    fieldIndex: number

    Remove in favor of battlerIndex pleas for fuck's sake

    moveHistoryEntry: TurnMove

    The move history entry object that is pushed to the pokemon's move history

    Can be edited after being pushed to the history to adjust the result, targets, etc, for this move phase.

    phaseName: "MovePhase"

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

    player: boolean
    thaw?: boolean

    Flag set to true during checkFreeze that indicates that the pokemon will thaw if it passes the failure conditions

    timingModifier: MovePhaseTimingModifier

    The move's timing modifier.

    MovePhaseTimingModifier.NORMAL

    useMode: MoveUseMode

    Accessors

    Methods

    • Handle the freeze status effect check

      Returns boolean

      Whether the move was cancelled due to the pokemon being frozen

      Responsible for the following

      • Checking if the pokemon is frozen
      • Checking if the pokemon will thaw from random chance, OR from a thawing move. Thawing from a freeze move is not applied until AFTER all other failure checks.
      • Activating the freeze status effect (cancelling the move, playing the message, and displaying the animation)
    • Handle move failures due to Gravity.

      Returns boolean

      Whether the move was cancelled due to Gravity

    • Handle checking and activating the user's Paralysis status condition.

      Returns boolean

      Whether the move was cancelled due to the user being fully paralyzed. Returns false if user is not paralyzed

    • Check if the move is usable based on PP

      Returns boolean

      Whether the move was cancelled due to insufficient PP

    • Check cancellations from a move's pre-use condition.

      Returns boolean

      Whether the move was cancelled due to a pre-use condition.

      Currently only used for Focus Punch.

    • Handle the sleep check

      Returns boolean

      Whether the move was cancelled due to sleep

    • Trigger a specific BattlerTag to conditionally cancel move execution. Used by the first failure check to trigger certain kinds of interruptions before others.

      Parameters

      Returns boolean

      Whether the move was cancelled due to a BattlerTag effect

    • Check if the move is valid and not in an error state

      Returns boolean

      Whether the move was cancelled due to being invalid

      Checks occur in the following order

      1. Move is not implemented
      2. Move is somehow invalid (it is MoveId.NONE or targets is somehow empty)
      3. Move cannot be used by the player due to a challenge
    • Attempt to thaw the user if it successfully uses a self-thawing move.

      Returns void

    • Fail the move currently being used. Handles failure messages, pushing to move history, etc.

      Parameters

      • failedDueToTerrain: boolean = false

        Whether the move failed due to terrain (default false)

      Returns void

    • Perform the first round of move failure checks, occurring before move usage text is displayed and PP is deducted.

      Returns boolean

      Whether the move failed during the check

      Based on battle mechanics research conducted primarily by Smogon, checks happen in the following order (as of Gen 9):

      1. Sleep/Freeze
      2. Disobedience due to overleveled (not implemented in Pokerogue)
      3. Insufficient PP after being selected
      4. (Pokerogue specific) Moves disabled because they are not implemented / prevented from a challenge / somehow have no targets
      5. Sky battle (see PR#5983)
      6. Truant
      7. Focus Punch's loss of focus
      8. Flinch
      9. Move was disabled after being selected
      10. Healing move with heal block
      11. Sound move with throat chop
      12. Failure due to gravity
      13. Move lock from choice items / gorilla tactics
      14. Failure from taunt
      15. Failure from imprison
      16. Failure from confusion
      17. Failure from paralysis
      18. Failure from infatuation
    • Perform a subset of the checks done in firstFailureCheck for called moves.

      Returns boolean

      Whether the called move should fail

      Based on smogon battle mechanics research, checks happen in the following order:

      1. Invalid move (skipped in pokerogue)
      2. Move prevented by heal block
      3. Move prevented by throat chop
      4. Gravity
      5. Sky Battle (See PR#5983)
    • Apply PP increasing abilities (currently only Pressure) on all target Pokemon.

      Parameters

      • targets: Pokemon[]

        An array containing all active Pokemon targeted by this Phase's move

      Returns number

      The amount of extra PP consumed due to Pressure

    • Handles the case where the move was cancelled or failed:

      • Uses PP if the move failed (not cancelled) and should use PP (failed moves are not affected by Pressure)
      • Records a cancelled OR failed move in move history, so abilities like Truant don't trigger on the next turn and soft-lock.
      • Lapses MOVE_EFFECT tags:
        • Semi-invulnerable battler tags (Fly/Dive/etc.) are intended to lapse on move effects, but also need to lapse on move failure/cancellation.

          TODO: ...this seems weird.

      • Lapses AFTER_MOVE tags:
      • Removes the second turn of charge moves

      Returns void

    • Check whether this 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

      • phaseName: K

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

    • Update the targets of any counter-attacking moves with [BattlerIndex.ATTACKER] set to reflect the actual battler index of the user's last attacker.

      If there is no last attacker or they are no longer on the field, a message is displayed and the move is marked for failure

      Returns void

    • Check for cancellation edge cases - no targets remaining, or MoveId.NONE is in the queue

      Returns boolean

      Whether the move failed due to an edge case

    • Modify this.targets in place based on move redirection effects.

      Returns void

    • Second failure check that occurs after the "Pokemon used move" text is shown but BEFORE the move has been registered as being the last move used (for the purposes of something like Copycat)

      Returns boolean

      Other than powder, each failure condition is mutually exclusive (as they are tied to specific moves), so order does not matter. Notably, this failure check only includes failure conditions intrinsic to the move itself, other than Powder (which marks the end of this failure check)

      • Pollen puff used on an ally that is under effect of heal block
      • Burn up / Double shock when the user does not have the required type
      • No Retreat while already under its effects
      • Failure due to primal weather
      • (on cart, not applicable to Pokerogue) Moves that fail if used ON a raid / special boss: selfdestruct/explosion/imprision/power split / guard split
      • (on cart, not applicable to Pokerogue) Moves that fail during a "co-op" battle (like when Arven helps during raid boss): ally switch / teatime

      After all checks, Powder causing the user to explode

    • Display the text for a move failing to execute.

      Parameters

      • failedText: string = ...

        The failure text to display; defaults to "battle:attackFailed" locale key ("But it failed!" in english)

      Returns void

    • Displays the move's usage text to the player as applicable for the move being used.

      Returns void

    • Third failure check is from moves and abilities themselves

      Returns boolean

      Whether the move failed

      • Anything in Move.conditionsSeq3
      • Weather blocking the move
      • Terrain blocking the move
      • Queenly Majesty / Dazzling
      • Damp (which is handled by move conditions in pokerogue rather than the ability, like queenly majesty / dazzling)

      The rest of the failure conditions are marked as sequence 4 and should happen in the move effect phase (though happen here for now)

    • Queue animations and messages for the user's status effect triggering, optionally cancelling the move as well.

      Parameters

      • effect: StatusEffect

        The effect being triggered

      • cancel: boolean = true

        Whether to additionally cancel the current move usage; default true. Used by sleep-bypassing moves

      Returns void

    • Clear out two turn moves, then schedule the move to be used if it passes the third failure check.

      Parameters

      • charging: boolean = false

      Returns void

    • Deduct PP from the move being used, accounting for Pressure and other effects.

      Returns void