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.
The MovePhaseTimingModifier for the move; Default MovePhaseTimingModifier.NORMAL
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 timing modifier of the move (used by Quash and to force called moves to the front of their queue)
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, cancelling the move and showing the failure text
Whether the move was cancelled due to Gravity
PrivatecheckHandle the paralysis status effect check, cancelling the move and queueing the activation message and animation
Whether the move was cancelled due to paralysis
ProtectedcheckCheck if the move is usable based on PP
Whether the move was cancelled due to insufficient PP
PrivatecheckCancel the move if its pre use condition fails
Whether the move was cancelled due to a pre-use interruption
ProtectedcheckHandle the sleep check
Whether the move was cancelled due to sleep
PrivatecheckLapse the tag type and check if the move is cancelled from it. Meant to be used during the first failure check
The tag type whose lapse method will be called with BattlerTagLapseType.PRE_MOVE
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)PrivatedoHandle the status interactions for sleep and freeze that happen after passing the first failure check
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)
ProtectedfirstCheck the first round of failure checks
Whether the move failed
Based on battle mechanics research conducted primarily by Smogon, checks happen in the following order (as of Gen 9):
PR#5983)ProtectedfollowFollow up moves need to check a subset of the first failure checks
Based on smogon battle mechanics research, checks happen in the following order:
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 if the phase is of the given type without requiring instanceof.
The string 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
Whether the move fails
ProtectedresolveModifies this.targets in place, based upon:
targets constructor param ([BattlerIndex.ATTACKER]).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 the status activation message, play its animation, and cancel the move
The effect being triggered
Whether to cancel the move after triggering the status
effect animation message; default true. Set to false for
sleep-bypassing moves to avoid cancelling attack.
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.