Fix Enigma Berry checks

This commit is contained in:
Bassoonian 2024-02-02 13:18:47 +01:00
parent 495ee6698c
commit 9eacffe5bb
3 changed files with 20 additions and 0 deletions

View file

@ -4210,7 +4210,11 @@ static u32 GetMonHoldEffect(struct Pokemon *mon)
u32 item = GetMonData(mon, MON_DATA_HELD_ITEM);
if (item == ITEM_ENIGMA_BERRY_E_READER)
#if FREE_ENIGMA_BERRY == FALSE
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
holdEffect = 0;
#endif //FREE_ENIGMA_BERRY
else
holdEffect = ItemId_GetHoldEffect(item);

View file

@ -890,7 +890,11 @@ static const u8 *ItemId_GetPluralName(u16 itemId)
const u8 *ItemId_GetEffect(u32 itemId)
{
if (itemId == ITEM_ENIGMA_BERRY_E_READER)
#if FREE_ENIGMA_BERRY == FALSE
return gSaveBlock1Ptr->enigmaBerry.itemEffect;
#else
return 0;
#endif //FREE_ENIGMA_BERRY
else
return gItemsInfo[SanitizeItemId(itemId)].effect;
}

View file

@ -3438,7 +3438,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
// Get item hold effect
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL);
if (heldItem == ITEM_ENIGMA_BERRY_E_READER)
#if FREE_ENIGMA_BERRY == FALSE
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
holdEffect = 0;
#endif //FREE_ENIGMA_BERRY
else
holdEffect = ItemId_GetHoldEffect(heldItem);
@ -4092,7 +4096,11 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s
partnerHeldItem = GetMonData(tradePartner, MON_DATA_HELD_ITEM, 0);
if (partnerHeldItem == ITEM_ENIGMA_BERRY_E_READER)
#if FREE_ENIGMA_BERRY == FALSE
partnerHoldEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
partnerHoldEffect = 0;
#endif //FREE_ENIGMA_BERRY
else
partnerHoldEffect = ItemId_GetHoldEffect(partnerHeldItem);
}
@ -4847,7 +4855,11 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
if (gMain.inBattle)
holdEffect = gEnigmaBerries[0].holdEffect;
else
#if FREE_ENIGMA_BERRY == FALSE
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
#else
holdEffect = 0;
#endif //FREE_ENIGMA_BERRY
}
else
{