add comments where needed

pull/761/head
f-raZ0R 2024-05-13 19:54:47 -04:00
parent 9511699b69
commit e11c8ffe1a
3 changed files with 8 additions and 2 deletions

View File

@ -523,6 +523,7 @@ export class TormentedTag extends BattlerTag {
pokemon.scene.queueMessage(getPokemonMessage(pokemon, 'is no longer\ntormented!'));
}
//At the end of each turn, if this pokemon executed a move this turn, set its unselectableMove to that move, unless it is struggle, in which case unset it.
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
const ret = lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType);
if (ret) {

View File

@ -3283,6 +3283,9 @@ export class PokemonSummonData {
public moveQueue: QueuedMove[] = [];
public disabledMove: Moves = Moves.NONE;
public disabledTurns: integer = 0;
/*
* Moves that can not be selected in the UI, but don't fail when used for other reasons. Currently just used by Torment.
*/
public unselectableMove: Moves = Moves.NONE;
public tags: BattlerTag[] = [];
public abilitySuppressed: boolean = false;

View File

@ -1668,6 +1668,7 @@ export class CommandPhase extends FieldPhase {
else {
const moveIndex = playerPokemon.getMoveset().findIndex(m => m.moveId === queuedMove.move);
if (moveIndex > -1 && playerPokemon.getMoveset()[moveIndex].isUsable(playerPokemon, queuedMove.ignorePP)) {
//if the player already has a move queued (e.g. due to outrage), have arg1 be true in handleCommand
this.handleCommand(Command.FIGHT, moveIndex, queuedMove.ignorePP, true, { targets: queuedMove.targets, multiple: queuedMove.targets.length > 1 });
} else
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
@ -1687,6 +1688,7 @@ export class CommandPhase extends FieldPhase {
let useStruggleB = false;
let useStruggleC = false;
const encoreTag = playerPokemon.getTag(EncoreTag) as EncoreTag;
//Lengthy check for whether or not the player's choice is legal, and if they should struggle.
if (cursor === -1 ||
playerPokemon.trySelectMove(cursor, args[0] as boolean, args[1] as boolean) ||
(useStruggleA = cursor > -1 && (!playerPokemon.getMoveset().filter(m => m.isSelectable(playerPokemon)).length) && !args[1]) ||