Fixes Bug Bite eaten berry not ignoring Unnerve (#6666)

This commit is contained in:
Alex 2025-04-22 00:38:39 +02:00 committed by GitHub
parent 007d7e712e
commit 72839fc002
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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);
}
}