From 822c83e46972387346d953f11277022d4e74471b Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 27 Feb 2024 20:15:47 -0500 Subject: [PATCH] Fix charge move effect activating twice --- src/data/move.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 89e25ba2a..2556446a8 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -955,8 +955,9 @@ export class ChargeAttr extends OverrideMoveEffectAttr { usedChargeEffect(user: Pokemon, target: Pokemon, move: Move): boolean { if (!this.chargeEffect) return false; - const lastMove = user.getLastXMoves().find(() => true); - return lastMove && lastMove.move === move.id && lastMove.result === MoveResult.OTHER; + // Account for move history being populated when this function is called + const lastMoves = user.getLastXMoves(2); + return lastMoves.length === 2 && lastMoves[1].move === move.id && lastMoves[1].result === MoveResult.OTHER; } } @@ -2206,7 +2207,7 @@ export function getMoveTargets(user: Pokemon, move: Moves): MoveTargetSet { break; case MoveTarget.ALL: case MoveTarget.BOTH_SIDES: - set = [ user, user.getAlly() ].concat(user.getOpponents()); + set = [ user, user.getAlly() ].concat(opponents); multiple = true; break; }