From 846427ac432942fb743850f06fcb9569bf26df5a Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Wed, 27 Nov 2024 20:08:38 +0100 Subject: [PATCH] Fixes gems triggering on confusion damage (#5723) --- src/battle_script_commands.c | 1 + test/battle/status2/confusion.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index b1dbcc6106..2ca3cd52f8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2119,6 +2119,7 @@ END: } if (gSpecialStatuses[gBattlerAttacker].gemBoost && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + && !(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && gBattleMons[gBattlerAttacker].item && gMovesInfo[gCurrentMove].effect != EFFECT_PLEDGE && gCurrentMove != MOVE_STRUGGLE) diff --git a/test/battle/status2/confusion.c b/test/battle/status2/confusion.c index 3c86e5d555..03a17bcfeb 100644 --- a/test/battle/status2/confusion.c +++ b/test/battle/status2/confusion.c @@ -26,3 +26,21 @@ SINGLE_BATTLE_TEST("Confusion adds a 50/33% chance to hit self with 40 power") EXPECT_EQ(damage[0], damage[1]); } } + +SINGLE_BATTLE_TEST("Confusion self hit does not consume Gems") +{ + PASSES_RANDOMLY(B_CONFUSION_SELF_DMG_CHANCE >= GEN_7 ? 33 : 50, 100, RNG_CONFUSION); + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_NORMAL_GEM); }; + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(opponent, MOVE_CONFUSE_RAY); MOVE(player, MOVE_TACKLE); } + } SCENE { + NONE_OF { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, player); + MESSAGE("Normal Gem strengthened Wobbuffet's power!"); + } + MESSAGE("It hurt itself in its confusion!"); + } +}