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}
* @see {@linkcode apply} for move selection and move call
* @extends OverrideMoveEffectAttr
@ -6514,12 +6514,12 @@ export class RandomMoveAttr extends CallMoveAttr {
/**
* 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)
* @param {Move} move Move being used
* @param {any[]} args Unused
* @returns {Promise<boolean>}
* Invalid moves are indicated by what is passed in to invalidMoves: @constant {invalidMetronomeMoves}
*
* Invalid moves are indicated by what is passed in to invalidMoves: {@linkcode invalidMetronomeMoves}
* @param user Pokemon that used the move and will call a random move
* @param target Pokemon that will be targeted by the random move (if single target)
* @param move Move being used
* @param args Unused
*/
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);

View File

@ -4807,7 +4807,7 @@ export class EnemyPokemon extends Pokemon {
if (moveQueue.length !== 0) {
const queuedMove = moveQueue[0];
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) {
return queuedMove;
} else {

View File

@ -81,10 +81,10 @@ export class CommandPhase extends FieldPhase {
moveQueue.shift();
}
if (moveQueue.length !== 0) {
if (moveQueue.length > 0) {
const queuedMove = moveQueue[0];
if (!queuedMove.move) {
this.handleCommand(Command.FIGHT, -1, undefined);
this.handleCommand(Command.FIGHT, -1);
} else {
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?