From 06151cf0511c2bf24c6d90a000e4f6858dafd5ff Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Fri, 10 Mar 2023 21:35:19 -0800 Subject: [PATCH] Max Guard actually protects / Max Moves bypass protect --- src/battle_script_commands.c | 3 ++- src/battle_util.c | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index af018f4066..268dd2c9d6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1601,7 +1601,8 @@ static void Cmd_attackcanceler(void) } // Z-moves and Max Moves bypass protection, but deal reduced damage (factored in CalcFinalDmg) - if (gBattleStruct->zmove.active && IS_BATTLER_PROTECTED(gBattlerTarget)) + if ((gBattleStruct->zmove.active || IsMaxMove(gCurrentMove)) + && IS_BATTLER_PROTECTED(gBattlerTarget)) { BattleScriptPush(cmd->nextInstr); gBattlescriptCurrInstr = BattleScript_CouldntFullyProtect; diff --git a/src/battle_util.c b/src/battle_util.c index 01e9399c97..da706afa7d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8312,13 +8312,11 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move) } // Z-Moves and Max Moves bypass protection (except Max Guard for Max Moves). - if (IsMaxMove(move) - && !(gProtectStructs[battlerId].maxGuarded - && gBattleMoves[move].argument != MAX_EFFECT_BYPASS_PROTECT) + if ((IsMaxMove(move) + && !(gProtectStructs[battlerId].maxGuarded + && gBattleMoves[move].argument != MAX_EFFECT_BYPASS_PROTECT)) || gBattleStruct->zmove.active) - { return FALSE; - } if (move == MOVE_TEATIME) return FALSE; @@ -8345,6 +8343,8 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move) return TRUE; else if (gProtectStructs[battlerId].kingsShielded && gBattleMoves[move].power != 0) return TRUE; + else if (gProtectStructs[battlerId].maxGuarded) + return TRUE; else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_QUICK_GUARD && GetChosenMovePriority(gBattlerAttacker) > 0) return TRUE; @@ -9689,7 +9689,8 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move } // Z-Moves and Max Moves bypass Protect and do 25% of their original damage - if (gBattleStruct->zmove.active && IS_BATTLER_PROTECTED(battlerDef)) + if ((gBattleStruct->zmove.active || IsMaxMove(move)) + && IS_BATTLER_PROTECTED(battlerDef)) { MulModifier(&finalModifier, UQ_4_12(0.25)); }