From 093e2655158dc41d0c853e5fa4efc53b35be7aa9 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Sun, 30 Mar 2025 14:18:21 +0200 Subject: [PATCH] Fixes Destiny Bond against Dynamax no failing (#6501) --- src/battle_script_commands.c | 21 ++++++++++++++++++++- test/battle/gimmick/dynamax.c | 12 ++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index da25d9672f..34e78a3890 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -13864,10 +13864,29 @@ static void Cmd_trychoosesleeptalkmove(void) } } +static inline bool32 IsDanamaxMonPresent(void) +{ + for (u32 battler = 0; battler < gBattlersCount; battler++) + { + if (battler == gBattlerAttacker) + continue; + + if (GetActiveGimmick(battler) == GIMMICK_DYNAMAX) + return TRUE; + } + + return FALSE; +} + static void Cmd_trysetdestinybond(void) { CMD_ARGS(const u8 *failInstr); - if (DoesDestinyBondFail(gBattlerAttacker)) + + if (IsDanamaxMonPresent()) + { + gBattlescriptCurrInstr = BattleScript_MoveBlockedByDynamax; + } + else if (DoesDestinyBondFail(gBattlerAttacker)) { gBattlescriptCurrInstr = cmd->failInstr; } diff --git a/test/battle/gimmick/dynamax.c b/test/battle/gimmick/dynamax.c index 791973f893..ea8957e474 100644 --- a/test/battle/gimmick/dynamax.c +++ b/test/battle/gimmick/dynamax.c @@ -1624,3 +1624,15 @@ SINGLE_BATTLE_TEST("Dynamax: Dynamax is reverted before switch out") MESSAGE("Wobbuffet used Tackle!"); } } + +SINGLE_BATTLE_TEST("Dynamax: Destiny Bond if a dynamaxed battler is present on field") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_DESTINY_BOND); MOVE(player, MOVE_TACKLE, gimmick: GIMMICK_DYNAMAX); } + } SCENE { + MESSAGE("The move was blocked by the power of Dynamax!"); + } +}