From fc510a6b44b96838e24f8311b208d7e335d5c0a9 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 8 Jul 2020 17:22:10 +0200 Subject: [PATCH] oran berry doesnt activate when mons is kill --- src/battle_util.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index 608e191a5..5cfc88051 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4199,12 +4199,13 @@ enum // second argument is 1/X of current hp compared to max hp static bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId) { + if (gBattleMons[battlerId].hp == 0) + return FALSE; if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / hpFraction) - { return TRUE; - } - else if (hpFraction <= 4 && GetBattlerAbility(battlerId) == ABILITY_GLUTTONY && ItemId_GetPocket(itemId) == POCKET_BERRIES - && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2) + + if (hpFraction <= 4 && GetBattlerAbility(battlerId) == ABILITY_GLUTTONY && ItemId_GetPocket(itemId) == POCKET_BERRIES + && gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2) { RecordAbilityBattle(battlerId, ABILITY_GLUTTONY); return TRUE;