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
_Protected
battlerThe battler index this phase refers to, or the pokemon ID if greater than 3.
TODO: Make this either use IDs or BattlerIndex
es, not a weird mix of both
Protected
cancelledWhether the current move should fail and retain PP.
Protected
failedWhether the current move should fail but still use PP.
Protected
Readonly
moveThe move history entry object that is pushed to the pokemon's move history
Readonly
phaseThe string name of the phase, used to identify the phase type for is
Private
Optional
thawFlag 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)
Readonly
useSignifies the current move should cancel and retain PP
Protected
chargeQueue a MoveChargePhase for this phase's invoked move.
Protected
checkHandle the freeze status effect check
Whether the move was cancelled due to the pokemon being frozen
Responsible for the following
Private
checkHandle move failures due to Gravity, cancelling the move and showing the failure text
Whether the move was cancelled due to Gravity
Private
checkHandle the paralysis status effect check, cancelling the move and queueing the activation message and animation
Whether the move was cancelled due to paralysis
Protected
checkCheck if the move is usable based on PP
Whether the move was cancelled due to insufficient PP
Private
checkCancel the move if its pre use condition fails
Whether the move was cancelled due to a pre-use interruption
Protected
checkHandle the sleep check
Whether the move was cancelled due to sleep
Private
checkLapse 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
Protected
checkCheck 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)Private
doHandle the status interactions for sleep and freeze that happen after passing the first failure check
Queue a MoveEndPhase and then end this phase.
Private
executeExecute the current move and apply its effects.
Signifies the current move should fail but still use PP
Protected
failFail the move currently being used. Handles failure messages, pushing to move history, etc.
Whether the move failed due to terrain (default false
)
Protected
firstCheck 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
)Protected
followFollow up moves need to check a subset of the first failure checks
Based on smogon battle mechanics research, checks happen in the following order:
Protected
handleHandles 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:
Substitute
Check 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.
Protected
resolveUpdate 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
Protected
resolveCheck for cancellation edge cases - no targets remaining
Whether the move fails
Protected
resolveModifies this.targets
in place, based upon:
targets
constructor param ([
BattlerIndex.ATTACKER
]
).Protected
secondSecond 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.
Protected
thirdThird failure check is from moves and abilities themselves
Whether the move failed
Move.conditionsSeq3
The rest of the failure conditions are marked as sequence 4 and should happen in the move effect phase (though happen here for now)
Private
triggerQueue 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.
Protected
useClear out two turn moves, then schedule the move to be used if it passes the third failure check.
Protected
useDeduct PP from the move being used, accounting for Pressure and other effects
Create a new MovePhase for using moves.