This commit is contained in:
ghoulslash 2021-11-08 21:33:00 -05:00
parent 6f6e0d6baf
commit e635930a15
3 changed files with 5 additions and 5 deletions

View File

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

View File

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

View File

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