Merge branch 'assistbug2' of https://github.com/schmidtc1/pokerogue into assistbug2

This commit is contained in:
Christopher Schmidt 2024-12-29 10:15:17 -05:00
commit d4839284ad
3 changed files with 10 additions and 10 deletions

View File

@ -6494,7 +6494,7 @@ export class CallMoveAttr extends OverrideMoveEffectAttr {
} }
/** /**
* Attribute used to call a random move * Attribute used to call a random move.
* Used for {@linkcode Moves.METRONOME} * Used for {@linkcode Moves.METRONOME}
* @see {@linkcode apply} for move selection and move call * @see {@linkcode apply} for move selection and move call
* @extends OverrideMoveEffectAttr * @extends OverrideMoveEffectAttr
@ -6514,12 +6514,12 @@ export class RandomMoveAttr extends CallMoveAttr {
/** /**
* User calls a random moveId * User calls a random moveId
* @param {Pokemon} user Pokemon that used the move and will call a random move *
* @param {Pokemon} target Pokemon that will be targeted by the random move (if single target) * Invalid moves are indicated by what is passed in to invalidMoves: {@linkcode invalidMetronomeMoves}
* @param {Move} move Move being used * @param user Pokemon that used the move and will call a random move
* @param {any[]} args Unused * @param target Pokemon that will be targeted by the random move (if single target)
* @returns {Promise<boolean>} * @param move Move being used
* Invalid moves are indicated by what is passed in to invalidMoves: @constant {invalidMetronomeMoves} * @param args Unused
*/ */
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
const moveIds = Utils.getEnumValues(Moves).map(m => !this.invalidMoves.includes(m) && !allMoves[m].name.endsWith(" (N)") ? m : Moves.NONE); const moveIds = Utils.getEnumValues(Moves).map(m => !this.invalidMoves.includes(m) && !allMoves[m].name.endsWith(" (N)") ? m : Moves.NONE);

View File

@ -4807,7 +4807,7 @@ export class EnemyPokemon extends Pokemon {
if (moveQueue.length !== 0) { if (moveQueue.length !== 0) {
const queuedMove = moveQueue[0]; const queuedMove = moveQueue[0];
if (queuedMove) { if (queuedMove) {
const moveIndex = this.getMoveset().findIndex(m => m?.moveId === moveQueue[0].move); const moveIndex = this.getMoveset().findIndex(m => m?.moveId === queuedMove.move);
if ((moveIndex > -1 && this.getMoveset()[moveIndex]!.isUsable(this, queuedMove.ignorePP)) || queuedMove.virtual) { if ((moveIndex > -1 && this.getMoveset()[moveIndex]!.isUsable(this, queuedMove.ignorePP)) || queuedMove.virtual) {
return queuedMove; return queuedMove;
} else { } else {

View File

@ -81,10 +81,10 @@ export class CommandPhase extends FieldPhase {
moveQueue.shift(); moveQueue.shift();
} }
if (moveQueue.length !== 0) { if (moveQueue.length > 0) {
const queuedMove = moveQueue[0]; const queuedMove = moveQueue[0];
if (!queuedMove.move) { if (!queuedMove.move) {
this.handleCommand(Command.FIGHT, -1, undefined); this.handleCommand(Command.FIGHT, -1);
} else { } else {
const moveIndex = playerPokemon.getMoveset().findIndex(m => m?.moveId === queuedMove.move); const moveIndex = playerPokemon.getMoveset().findIndex(m => m?.moveId === queuedMove.move);
if ((moveIndex > -1 && playerPokemon.getMoveset()[moveIndex]!.isUsable(playerPokemon, queuedMove.ignorePP)) || queuedMove.virtual) { // TODO: is the bang correct? if ((moveIndex > -1 && playerPokemon.getMoveset()[moveIndex]!.isUsable(playerPokemon, queuedMove.ignorePP)) || queuedMove.virtual) { // TODO: is the bang correct?