ProtectedfieldPrivateisReadonlyphaseThe string name of the phase, used to identify the phase type for is
PrivatecheckHelper method for handleBallCommand that checks if a pokeball can be thrown
and displays the appropriate error message.
Whether a pokeball can be thrown
The pokeball may not be thrown if any of the following are true:
End biome and
PrivatecheckSubmethod of start that sets the turn command to skip if this pokemon
is commanding its ally via AbilityId.COMMANDER.
PrivateclearClear out all unusable moves in front of the currently acting pokemon's move queue.
PrivatecomputeHelper method for handleFightCommand that returns the moveID for the phase
based on the move passed in or the cursor.
Does not check if the move is usable or not, that should be handled by the caller.
End the current phase and start a new one.
PrivatehandleHelper method for handleCommand that handles the logic when the selected command is to use a pokeball.
The index of the pokeball to use
Whether the command was successfully initiated
Process the command phase logic based on the selected command
The kind of command to handle
The index of option that the cursor is on, or -1 if no option is selected
OptionaluseMode: MoveUseModeThe mode to use for the move, if applicable. For switches, a boolean that specifies whether the switch is a Baton switch.
Optionalmove: TurnMoveFor Command.FIGHT, the move to use
Whether the command was successful
Process the command phase logic based on the selected command
The kind of command to handle
The index of option that the cursor is on, or -1 if no option is selected
Whether the command was successful
Process the command phase logic based on the selected command
The kind of command to handle
The index of option that the cursor is on, or -1 if no option is selected
OptionaluseMode: boolean | MoveUseModeThe mode to use for the move, if applicable. For switches, a boolean that specifies whether the switch is a Baton switch.
Optionalmove: TurnMoveFor Command.FIGHT, the move to use
Whether the command was successful
PrivatehandleSubmethod of start that validates field index logic for nonzero field indices.
Must only be called if the field index is nonzero.
PrivatehandleProcess the logic for executing a fight-related command
The command to handle (FIGHT or TERA)
The index that the cursor is placed on, or -1 if no move can be selected.
Optionalmove: TurnMoveThe move to force the command to use, if any.
PrivatehandleHelper method for handleCommand that handles the logic when the selected command is RUN.
Whether the pokemon is able to leave the field, indicating the command phase should end
Checks if the player is allowed to flee, and if not, queues the appropriate message.
The player cannot flee if:
End biomePrivatehandleSubmethod of tryLeaveField to handle the logic for effects that prevent the pokemon from leaving the field
due to trapping abilities or effects.
This method queues the proper messages in the case of trapping abilities or effects.
Whether the pokemon is currently trapped
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.
PrivatequeueSubmethod of handleFightCommand responsible for queuing the provided error message when the move cannot be used
The reason why the move cannot be used
PrivatequeueSet the mode in preparation to show the text, and then show the text. Only works for parameterless i18next keys.
The i18next key for the text to show
PrivateresetResets the cursor to the position of Command.FIGHT if any of the following are true
PrivateshowShow a message indicating that the pokemon cannot escape, and then return to the command phase.
Start the current phase.
PrivatetryAttempt to execute the first usable move in this Pokemon's move queue
Whether a queued move was successfully set to be executed.
PrivatetryCommon helper method that attempts to have the pokemon leave the field. Checks for trapping abilities and effects.
Optionalcursor: numberThe index of the option that the cursor is on
Whether the pokemon is able to leave the field, indicating the command phase should end
Whether the command phase is handling a switch command