diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index cc626fa5e..4fe36c48d 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -52,7 +52,7 @@ bool32 ShouldRecover(u8 battlerAtk, u8 battlerDef, u16 move, u8 healPercent); bool32 ShouldSetScreen(u8 battlerAtk, u8 battlerDef, u16 moveEffect); bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 moveIndex); bool32 IsRecycleEncouragedItem(u16 item); -bool32 IsHpRestoringBerry(u16 item); +bool32 ShouldRestoreHpBerry(u8 battlerAtk, u16 item); bool32 IsStatBoostingBerry(u16 item); bool32 CanKnockOffItem(u8 battler, u16 item); bool32 IsAbilityOfRating(u16 ability, s8 rating); diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 1dcb86805..fcd11d1c3 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -4115,9 +4115,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) if (IsStatBoostingBerry(item) && atkHpPercent > 60) score++; - else if (IsHpRestoringBerry(item) && !CanAIFaintTarget(battlerAtk, battlerDef, 0) + else if (ShouldRestoreHpBerry(battlerAtk, item) && !CanAIFaintTarget(battlerAtk, battlerDef, 0) && ((GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) == 0 && CanTargetFaintAiWithMod(battlerDef, battlerAtk, 0, 0)) - || !CanTargetFaintAiWithMod(battlerDef, battlerAtk, toheal, 0))) + || !CanTargetFaintAiWithMod(battlerDef, battlerAtk, toHeal, 0))) score++; // Recycle healing berry if we can't otherwise faint the target and the target wont kill us after we activate the berry } break; diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index dc85901e3..c90c9cdab 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -3389,12 +3389,12 @@ bool32 IsStatBoostingBerry(u16 item) } } -bool32 IsHpRestoringBerry(u8 battlerAtk, u16 item) +bool32 ShouldRestoreHpBerry(u8 battlerAtk, u16 item) { switch (item) { case ITEM_ORAN_BERRY: - if (gBattleMons[battlerAtk].maxHp <= 50) + if (gBattleMons[battlerAtk].maxHP <= 50) return TRUE; // Only worth it in the early game return FALSE; case ITEM_SITRUS_BERRY: