From fb1f12aa1b6fbe31875a3aa565160fa5b04ca49d Mon Sep 17 00:00:00 2001 From: hedara90 <90hedara@gmail.com> Date: Mon, 2 Sep 2024 13:58:10 +0200 Subject: [PATCH] Fixed Max Attacks into Max Guards message printing (#5312) * Fixed Max Attacks into Max Guards message printing * Updated the solution --------- Co-authored-by: Hedara --- src/battle_script_commands.c | 7 ++++++- test/battle/gimmick/dynamax.c | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6509dab069..9d8c0d4491 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1730,7 +1730,12 @@ static void AccuracyCheck(bool32 recalcDragonDarts, const u8 *nextInstr, const u else if (!JumpIfMoveAffectedByProtect(gCurrentMove)) gBattlescriptCurrInstr = nextInstr; if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_DYNAMAX) - AbilityBattleEffects(ABILITYEFFECT_ABSORBING, gBattlerTarget, 0, 0, gCurrentMove); + { + if (gProtectStructs[gBattlerTarget].maxGuarded) + gBattlescriptCurrInstr = nextInstr; + else + AbilityBattleEffects(ABILITYEFFECT_ABSORBING, gBattlerTarget, 0, 0, gCurrentMove); + } } else if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_2ND_HIT || (gSpecialStatuses[gBattlerAttacker].multiHitOn diff --git a/test/battle/gimmick/dynamax.c b/test/battle/gimmick/dynamax.c index 599ae4d454..f9865f7b6c 100644 --- a/test/battle/gimmick/dynamax.c +++ b/test/battle/gimmick/dynamax.c @@ -400,6 +400,7 @@ SINGLE_BATTLE_TEST("(DYNAMAX) Max Moves deal 1/4 damage through protect", s16 da } } +// This test will fail if it's the first test a thread runs SINGLE_BATTLE_TEST("(DYNAMAX) Max Moves don't bypass Max Guard") { GIVEN { @@ -1477,6 +1478,20 @@ SINGLE_BATTLE_TEST("(DYNAMAX) Moxie clones can be triggered by Max Moves faintin } } +// This test will fail if it's the first test a thread runs +SINGLE_BATTLE_TEST("(DYNAMAX) Max Attacks prints a message when hitting into Max Guard") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_GROWL, gimmick: GIMMICK_DYNAMAX); MOVE(opponent, MOVE_TACKLE, gimmick: GIMMICK_DYNAMAX); } + } SCENE { + MESSAGE("Wobbuffet used Max Guard!"); + MESSAGE("Foe Wobbuffet used Max Strike!"); + } +} + SINGLE_BATTLE_TEST("(DYNAMAX) Max Moves don't bypass absorbing abilities") { u32 move, ability, species; @@ -1512,4 +1527,4 @@ SINGLE_BATTLE_TEST("(DYNAMAX) Max Moves don't bypass absorbing abilities") } ABILITY_POPUP(opponent, ability); } -} +} \ No newline at end of file