From 72839fc002e805d4f38986c8b80e83814f31c742 Mon Sep 17 00:00:00 2001 From: Alex <93446519+AlexOn1ine@users.noreply.github.com> Date: Tue, 22 Apr 2025 00:38:39 +0200 Subject: [PATCH] Fixes Bug Bite eaten berry not ignoring Unnerve (#6666) --- src/battle_main.c | 3 +++ src/battle_util.c | 3 +++ test/battle/move_effect_secondary/bug_bite.c | 15 +++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/battle_main.c b/src/battle_main.c index 02cd58172d..85194a0d54 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5106,6 +5106,9 @@ static void TurnValuesCleanUp(bool8 var0) gProtectStructs[i].spikyShielded = FALSE; gProtectStructs[i].kingsShielded = FALSE; gProtectStructs[i].banefulBunkered = FALSE; + gProtectStructs[i].obstructed = FALSE; + gProtectStructs[i].silkTrapped = FALSE; + gProtectStructs[i].burningBulwarked = FALSE; gProtectStructs[i].quash = FALSE; gProtectStructs[i].usedCustapBerry = FALSE; gProtectStructs[i].quickDraw = FALSE; diff --git a/src/battle_util.c b/src/battle_util.c index b1e479f06b..d9e64c969c 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7234,6 +7234,9 @@ static u32 ItemHealHp(u32 battler, u32 itemId, enum ItemCaseId caseID, bool32 pe static bool32 UnnerveOn(u32 battler, u32 itemId) { + if (gBattleScripting.overrideBerryRequirements > 0) // Berries that aren't eaten naturally ignore unnerve + return FALSE; + if (ItemId_GetPocket(itemId) == POCKET_BERRIES && IsUnnerveAbilityOnOpposingSide(battler)) return TRUE; return FALSE; diff --git a/test/battle/move_effect_secondary/bug_bite.c b/test/battle/move_effect_secondary/bug_bite.c index e086941a5e..70e0966caa 100644 --- a/test/battle/move_effect_secondary/bug_bite.c +++ b/test/battle/move_effect_secondary/bug_bite.c @@ -133,3 +133,18 @@ SINGLE_BATTLE_TEST("Tanga Berry activates before Bug Bite") EXPECT_EQ(player->item, ITEM_NONE); } } + +SINGLE_BATTLE_TEST("Bug Bite ignores Unnerve") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { HP(1); } + OPPONENT(SPECIES_TYRANITAR) { Ability(ABILITY_UNNERVE); Item(ITEM_ORAN_BERRY); } + } WHEN { + TURN { MOVE(player, MOVE_BUG_BITE); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BUG_BITE, player); + HP_BAR(player); + } THEN { + EXPECT_EQ(opponent->item, ITEM_NONE); + } +}