The Pokemon using the move
The PokemonMove to use
The MoveUseMode corresponding to this move's means of execution (usually MoveUseMode.NORMAL).
Not marked optional to ensure callers correctly pass on useModes.
(Default MovePhaseTimingModifier.NORMAL) The timing modifier of the move
Protected_Protected_ProtectedbattlerThe 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
ProtectedcancelledWhether the current move should fail and retain PP.
ProtectedfailedWhether the current move should fail but still use PP.
Protected ReadonlymoveThe move history entry object that is pushed to the pokemon's move history
ReadonlyphaseThe string name of the phase, used to identify the phase type for is
Private OptionalthawFlag set to true during checkFreeze that indicates that the pokemon will thaw if it passes the failure conditions
The move's timing modifier.
ReadonlyuseSignifies the current move should cancel and retain PP
ProtectedchargeQueue a MoveChargePhase for this phase's invoked move.
ProtectedcheckHandle the freeze status effect check
Whether the move was cancelled due to the pokemon being frozen
Responsible for the following
PrivatecheckHandle move failures due to Gravity.
Whether the move was cancelled due to Gravity
PrivatecheckHandle checking and activating the user's Paralysis status condition.
Whether the move was cancelled due to the user being fully paralyzed.
Returns false if user is not paralyzed
ProtectedcheckCheck if the move is usable based on PP
Whether the move was cancelled due to insufficient PP
PrivatecheckCheck cancellations from a move's pre-use condition.
Whether the move was cancelled due to a pre-use condition.
ProtectedcheckHandle the sleep check
Whether the move was cancelled due to sleep
PrivatecheckTrigger a specific BattlerTag to conditionally cancel move execution.
Used by the first failure check to trigger certain kinds of interruptions before others.
Whether the move was cancelled due to a BattlerTag effect
ProtectedcheckCheck if the move is valid and not in an error state
Whether the move was cancelled due to being invalid
Checks occur in the following order
MoveId.NONE or targets is somehow empty)PrivatedoAttempt to thaw the user if it successfully uses a self-thawing move.
Queue a MoveEndPhase and then end this phase.
PrivateexecuteExecute the current move and apply its effects.
Signifies the current move should fail but still use PP
ProtectedfailFail the move currently being used. Handles failure messages, pushing to move history, etc.
Whether the move failed due to terrain (default false)
ProtectedfirstPerform the first round of move failure checks, occurring before move usage text is displayed and PP is deducted.
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):
PR#5983)ProtectedfollowPerform a subset of the checks done in firstFailureCheck
for called moves.
Whether the called move should fail
Based on smogon battle mechanics research, checks happen in the following order:
An array containing all on-field Pokemon targeted by this Phase's invoked move.
ProtectedhandleHandles the case where the move was cancelled or failed:
Pressure)Truant don't trigger on the
next turn and soft-lock.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.
AFTER_MOVE tags:
SubstituteCheck whether this Phase is of the given type without requiring instanceof.
The name of the phase to check
Whether this Phase is of the provided type.
ProtectedresolveUpdate 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
ProtectedresolveCheck for cancellation edge cases - no targets remaining, or MoveId.NONE is in the queue
Whether the move failed due to an edge case
ProtectedresolveModify this.targets in place based on move redirection effects.
ProtectedsecondSecond 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)
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)
After all checks, Powder causing the user to explode
Display the text for a move failing to execute.
The failure text to display; defaults to "battle:attackFailed" locale key
("But it failed!" in english)
Displays the move's usage text to the player as applicable for the move being used.
Start the current phase.
ProtectedthirdThird failure check is from moves and abilities themselves
Whether the move failed
Move.conditionsSeq3The rest of the failure conditions are marked as sequence 4 and should happen in the move effect phase (though happen here for now)
PrivatetriggerQueue animations and messages for the user's status effect triggering, optionally cancelling the move as well.
The effect being triggered
Whether to additionally cancel the current move usage; default true.
Used by sleep-bypassing moves
ProtecteduseClear out two turn moves, then schedule the move to be used if it passes the third failure check.
ProtecteduseDeduct PP from the move being used, accounting for Pressure and other effects.
Create a new MovePhase for using moves.