From 0b2393ff8e32624bb95613378855178b3678b573 Mon Sep 17 00:00:00 2001 From: AlexOn1ine Date: Mon, 6 Jan 2025 14:28:47 +0100 Subject: [PATCH] Fixes Shell Bell inlcuding heal amount from Future Sight when triggered --- src/battle_script_commands.c | 4 +++- test/battle/hold_effect/shell_bell.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 test/battle/hold_effect/shell_bell.c diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 2f31b230ae..92221bf3a0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2456,7 +2456,9 @@ static void Cmd_datahpupdate(void) } // Record damage for Shell Bell - if (gSpecialStatuses[battler].shellBellDmg == 0 && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) + if (gSpecialStatuses[gBattlerTarget].shellBellDmg == IGNORE_SHELL_BELL) + gSpecialStatuses[battler].shellBellDmg = 0; + else if (gSpecialStatuses[battler].shellBellDmg == 0 && !(gHitMarker & HITMARKER_PASSIVE_DAMAGE)) gSpecialStatuses[battler].shellBellDmg = gHpDealt; // Note: While physicalDmg/specialDmg below are only distinguished between for Counter/Mirror Coat, they are diff --git a/test/battle/hold_effect/shell_bell.c b/test/battle/hold_effect/shell_bell.c new file mode 100644 index 0000000000..68e3b8319f --- /dev/null +++ b/test/battle/hold_effect/shell_bell.c @@ -0,0 +1,28 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Shell Bell does not activate on Future Sight if the original user is on the field") +{ + s16 damage = 0; + s16 healed = 0; + + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); Item(ITEM_SHELL_BELL); } + OPPONENT(SPECIES_WYNAUT); + } WHEN { + TURN { MOVE(player, MOVE_FUTURE_SIGHT); } + TURN {} + TURN {} + TURN { MOVE(player, MOVE_DRAGON_RAGE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_FUTURE_SIGHT, player); + MESSAGE("The opposing Wynaut took the Future Sight attack!"); + HP_BAR(opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_RAGE, player); + HP_BAR(opponent, captureDamage: &damage); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); + HP_BAR(player, captureDamage: &healed); + } THEN { + EXPECT_MUL_EQ(damage, Q_4_12(-0.25), healed); + } +}