From 8faa77cfbfbaee2bd43e74f17e79c1f1fc7da760 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sat, 20 Apr 2024 19:43:48 -0400 Subject: [PATCH] Fix struggle damage blockable by Magic Guard --- src/data/move.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 2b2698968..c19c822a5 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -665,12 +665,14 @@ export class SurviveDamageAttr extends ModifiedDamageAttr { export class RecoilAttr extends MoveEffectAttr { private useHp: boolean; private damageRatio: number; + private unblockable: boolean; - constructor(useHp?: boolean, damageRatio?: number) { + constructor(useHp: boolean = false, damageRatio: number = 0.25, unblockable: boolean = false) { super(true); this.useHp = useHp; - this.damageRatio = (damageRatio !== undefined ? damageRatio : 0.25) || 0.25; + this.damageRatio = damageRatio; + this.unblockable = unblockable; } apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { @@ -678,7 +680,8 @@ export class RecoilAttr extends MoveEffectAttr { return false; const cancelled = new Utils.BooleanHolder(false); - applyAbAttrs(BlockRecoilDamageAttr, user, cancelled); + if (!this.unblockable) + applyAbAttrs(BlockRecoilDamageAttr, user, cancelled); if (cancelled.value) return false; @@ -4073,7 +4076,7 @@ export function initMoves() { .attr(RecoilAttr) .unimplemented(), new AttackMove(Moves.STRUGGLE, Type.NORMAL, MoveCategory.PHYSICAL, 50, -1, 1, -1, 0, 1) - .attr(RecoilAttr, true) + .attr(RecoilAttr, true, 0.25, true) .attr(TypelessAttr) .ignoresVirtual() .target(MoveTarget.RANDOM_NEAR_ENEMY),