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!"); + } +}