Modified and moved IsPinchBerryItemEffect

This commit is contained in:
LOuroboros 2022-01-26 21:45:24 -03:00
parent b33f7aed8d
commit 21244d6393
3 changed files with 24 additions and 24 deletions

View file

@ -75,6 +75,5 @@ ItemUseFunc ItemId_GetFieldFunc(u16 itemId);
u8 ItemId_GetBattleUsage(u16 itemId);
ItemUseFunc ItemId_GetBattleFunc(u16 itemId);
u8 ItemId_GetSecondaryId(u16 itemId);
bool32 IsPinchBerryItemEffect(u16 holdEffect);
#endif // GUARD_ITEM_H

View file

@ -41,6 +41,7 @@ enum
static u8 ChooseMoveOrAction_Singles(void);
static u8 ChooseMoveOrAction_Doubles(void);
static void BattleAI_DoAIProcessing(void);
static bool32 IsPinchBerryItemEffect(u16 holdEffect);
// ewram
EWRAM_DATA const u8 *gAIScriptPtr = NULL; // Still used in contests
@ -2928,6 +2929,29 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
return score;
}
static bool32 IsPinchBerryItemEffect(u16 holdEffect)
{
switch (holdEffect)
{
case HOLD_EFFECT_ATTACK_UP:
case HOLD_EFFECT_DEFENSE_UP:
case HOLD_EFFECT_SPEED_UP:
case HOLD_EFFECT_SP_ATTACK_UP:
case HOLD_EFFECT_SP_DEFENSE_UP:
case HOLD_EFFECT_CRITICAL_UP:
case HOLD_EFFECT_RANDOM_STAT_UP:
#ifdef HOLD_EFFECT_CUSTAP_BERRY
case HOLD_EFFECT_CUSTAP_BERRY:
#endif
#ifdef HOLD_EFFECT_MICLE_BERRY
case HOLD_EFFECT_MICLE_BERRY:
#endif
return TRUE;
}
return FALSE;
}
// AI_FLAG_CHECK_VIABILITY - a weird mix of increasing and decreasing scores
static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
{

View file

@ -947,26 +947,3 @@ u8 ItemId_GetSecondaryId(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].secondaryId;
}
bool32 IsPinchBerryItemEffect(u16 holdEffect)
{
switch (holdEffect)
{
case HOLD_EFFECT_ATTACK_UP:
case HOLD_EFFECT_DEFENSE_UP:
case HOLD_EFFECT_SPEED_UP:
case HOLD_EFFECT_SP_ATTACK_UP:
case HOLD_EFFECT_SP_DEFENSE_UP:
case HOLD_EFFECT_CRITICAL_UP:
case HOLD_EFFECT_RANDOM_STAT_UP:
#ifdef HOLD_EFFECT_CUSTAP_BERRY
case HOLD_EFFECT_CUSTAP_BERRY:
#endif
#ifdef HOLD_EFFECT_MICLE_BERRY
case HOLD_EFFECT_MICLE_BERRY:
#endif
return TRUE;
}
return FALSE;
}