From 82d09571fd6506b7ec5e9c2838cba18fd8b78114 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Thu, 13 Nov 2025 22:51:07 +0100 Subject: [PATCH] Fixes Shell Trap not activating on contact but no damage (#8243) --- src/battle_script_commands.c | 3 ++- test/battle/move_effect/shell_trap.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 112e0dc566..dbf0b0025f 100755 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6294,9 +6294,10 @@ static void Cmd_moveend(void) // Set ShellTrap to activate after the attacker's turn if target was hit by a physical move. if (GetMoveEffect(gChosenMoveByBattler[gBattlerTarget]) == EFFECT_SHELL_TRAP + && IsBattleMovePhysical(gCurrentMove) + && IsBattlerTurnDamaged(gBattlerTarget) && gBattlerTarget != gBattlerAttacker && !IsBattlerAlly(gBattlerTarget, gBattlerAttacker) - && gProtectStructs[gBattlerTarget].physicalDmg && gProtectStructs[gBattlerTarget].physicalBattlerId == gBattlerAttacker && !TestIfSheerForceAffected(gBattlerAttacker, gCurrentMove)) { diff --git a/test/battle/move_effect/shell_trap.c b/test/battle/move_effect/shell_trap.c index 435c79a652..903f984929 100644 --- a/test/battle/move_effect/shell_trap.c +++ b/test/battle/move_effect/shell_trap.c @@ -198,3 +198,19 @@ DOUBLE_BATTLE_TEST("Shell Trap targets correctly if one of the opponents has fai ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, playerLeft); } } + +SINGLE_BATTLE_TEST("Shell Trap activates if user is hit with a physical move but does no damage") +{ + GIVEN { + ASSUME(GetMoveEffect(MOVE_FALSE_SWIPE) == EFFECT_FALSE_SWIPE); + PLAYER(SPECIES_WOBBUFFET) { HP(1); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_SHELL_TRAP); MOVE(opponent, MOVE_FALSE_SWIPE); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_SHELL_TRAP_SETUP, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_FALSE_SWIPE, opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SHELL_TRAP, player); + HP_BAR(opponent); + } +}