From c746d0723f7886365993ec14583214af9d93dbc9 Mon Sep 17 00:00:00 2001 From: Charlie Giang <146129103+charliegiang@users.noreply.github.com> Date: Sun, 9 Jun 2024 15:08:33 -0500 Subject: [PATCH] [Move] fix for sparkly swirl apply check (#1059) fix for sparkly swirl apply check Update move.ts Co-authored-by: Temps Ray --- src/data/move.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) mode change 100755 => 100644 src/data/move.ts diff --git a/src/data/move.ts b/src/data/move.ts old mode 100755 new mode 100644 index 96961959a44..103f4840ef7 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1251,11 +1251,18 @@ export class PartyStatusCureAttr extends MoveEffectAttr { this.abilityCondition = abilityCondition; } + //The same as MoveEffectAttr.canApply, except it doesn't check for the target's HP. + canApply(user: Pokemon, target: Pokemon, move: Move, args: any[]) { + const isTargetValid = + (this.selfTarget && user.hp && !user.getTag(BattlerTagType.FRENZY)) || + (!this.selfTarget && (!target.getTag(BattlerTagType.PROTECTED) || move.hasFlag(MoveFlags.IGNORE_PROTECT))); + return !!isTargetValid; + } + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { - if (!super.apply(user, target, move, args)) { + if (!this.canApply(user, target, move, args)) { return false; } - this.addPartyCurePhase(user); }