PokéRogue
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    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

    fieldIndex: number

    Remove in favor of battlerIndex pleas for fuck's sake

    firstHit: boolean

    Is this the first strike of a move?

    hitChecks: HitCheckEntry[]

    The result of the hit check against each target

    lastHit: boolean

    Is this the last strike of a move?

    move: Move
    moveHistoryEntry: TurnMove

    Log to be entered into the user's move history once the move result is resolved.

    Note that result logs whether the move was successfully used in the sense of "Does it have an effect on the user?".

    phaseName: "MoveEffectPhase"

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

    player: boolean
    targets: BattlerIndex[]
    useMode: MoveUseMode

    Methods

    • Unshifts a new MoveEffectPhase with the same properties as this phase. Used to queue the next hit of multi-strike moves.

      Returns void

    • Applies all move effects that trigger in the event of a successful hit:

      • PRE_APPLY effects
      • Applying damage to the target
      • POST_APPLY effects
      • Invoking applyOnTargetEffects if the move does not hit a substitute
      • Triggering form changes and emergency exit / wimp out if this is the last hit

      Parameters

      • target: Pokemon

        the Pokemon hit by this phase's move.

      • effectiveness: TypeDamageMultiplier

        The effectiveness of the move (as previously evaluated in hitCheck)

      • firstTarget: boolean

        Whether this is the first target successfully struck by the move

      Returns void

    • Check whether the move should bypass both the accuracy and semi-invulnerable states.

      Parameters

      Returns true | undefined

      true if the move should bypass accuracy and semi-invulnerability

      Accuracy and semi-invulnerability can be bypassed by:

      • An ability like AbilityId.NO_GUARD | No Guard
      • A poison type using Toxic
      • A move like Lock-On or Mind Reader.
      • A field-targeted move like spikes

      Does not check against effects Glaive Rush status (which should not bypass semi-invulnerability), or interactions like Earthquake hitting against Dig, (which should not bypass the accuracy check).

    • Compute targets and the results of hit checks of the invoked move against all targets, organized by battler index.

      This is not a pure function; it has the following side effects

      • this.hitChecks - The results of the hit checks against each target
      • this.moveHistoryEntry - Sets success or failure based on the hit check results
      • user.turnData.hitCount and user.turnData.hitsLeft - Both set to 1 if the move was unsuccessful against all targets

      Parameters

      Returns Pokemon[]

      The targets of the invoked move

    • Returns Pokemon

      The Pokemon using this phase's invoked move.

      The returned Pokémon is guaranteed to be defined during move execution itself, as the start method ends this phase immediately if a source is missing.

    • Conduct the hit check and type effectiveness for this move against the target

      Checks occur in the following order:

      1. if the move is self-target
      2. if the target is on the field
      3. if the target is hidden by the effects of its commander ability
      4. if the target is in an applicable semi-invulnerable state
      5. if the target has an applicable protection effect
      6. if the move is reflected by magic coat or magic bounce
      7. type effectiveness calculation, including immunities from abilities and typing
      8. if accuracy is checked, whether the roll passes the accuracy check

      Parameters

      Returns HitCheckEntry

      a HitCheckEntry containing the attack's HitCheckResult and effectiveness against the target.

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

    • Triggers move effects of the given move effect trigger.

      Parameters

      • triggerType: MoveEffectTrigger

        The MoveEffectTrigger being applied

      • user: Pokemon

        The Pokemon using the move

      • target: Pokemon | null

        The Pokemon targeted by the move

      • OptionalfirstTarget: boolean | null

        Whether the target is the first to be hit by the current strike

      • OptionalselfTarget: boolean

        If defined, limits the effects triggered to either self-targeted effects (if set to true) or targeted effects (if set to false).

      Returns void