diff --git a/include/item.h b/include/item.h index 33f8ea9ee0..1388daca85 100644 --- a/include/item.h +++ b/include/item.h @@ -13,6 +13,7 @@ struct Item u16 secondaryId; ItemUseFunc fieldUseFunc; const u8 *description; + const u8 *effect; u8 name[ITEM_NAME_LENGTH]; u8 holdEffect; u8 holdEffectParam; @@ -63,6 +64,7 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count); bool8 RemovePyramidBagItem(u16 itemId, u16 count); const u8 *ItemId_GetName(u16 itemId); u32 ItemId_GetPrice(u16 itemId); +const u8 *ItemId_GetEffect(u32 itemId); u32 ItemId_GetHoldEffect(u32 itemId); u32 ItemId_GetHoldEffectParam(u32 itemId); const u8 *ItemId_GetDescription(u16 itemId); diff --git a/include/party_menu.h b/include/party_menu.h index 1352f54a43..9027dd65e9 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -71,7 +71,6 @@ void ItemUseCB_FormChange_ConsumedOnUse(u8 taskId, TaskFunc task); void ItemUseCB_RotomCatalog(u8 taskId, TaskFunc task); void ItemUseCB_ZygardeCube(u8 taskId, TaskFunc task); void ItemUseCB_Fusion(u8 taskId, TaskFunc task); -const u8* GetItemEffect(u16 item); u8 GetItemEffectType(u16 item); void CB2_PartyMenuFromStartMenu(void); void CB2_ChooseMonToGiveItem(void); diff --git a/include/pokemon.h b/include/pokemon.h index 772ab5d3c7..62b1cd1632 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -600,7 +600,6 @@ extern const struct BattleMove gBattleMoves[]; extern const u8 gFacilityClassToPicIndex[]; extern const u8 gFacilityClassToTrainerClass[]; extern const struct SpeciesInfo gSpeciesInfo[]; -extern const u8 *const gItemEffectTable[ITEMS_COUNT]; extern const u32 gExperienceTables[][MAX_LEVEL + 1]; extern const u8 gPPUpGetMask[]; extern const u8 gPPUpClearMask[]; diff --git a/src/battle_ai_switch_items.c b/src/battle_ai_switch_items.c index 43450089c4..299d420de9 100644 --- a/src/battle_ai_switch_items.c +++ b/src/battle_ai_switch_items.c @@ -2052,7 +2052,7 @@ static bool32 ShouldUseItem(u32 battler) item = gBattleResources->battleHistory->trainerItems[i]; if (item == ITEM_NONE) continue; - itemEffects = GetItemEffect(item); + itemEffects = ItemId_GetEffect(item); if (itemEffects == NULL) continue; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index dd84a15d44..c47305c08b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -15856,7 +15856,7 @@ void BS_ItemRestoreHP(void) NATIVE_ARGS(); u16 healAmount; u32 battler = MAX_BATTLERS_COUNT; - u32 healParam = GetItemEffect(gLastUsedItem)[6]; + u32 healParam = ItemId_GetEffect(gLastUsedItem)[6]; u32 side = GetBattlerSide(gBattlerAttacker); struct Pokemon *party = GetSideParty(side); u16 hp = GetMonData(&party[gBattleStruct->itemPartyIndex[gBattlerAttacker]], MON_DATA_HP); @@ -15947,7 +15947,7 @@ void BS_ItemCureStatus(void) void BS_ItemIncreaseStat(void) { NATIVE_ARGS(); - u16 statId = GetItemEffect(gLastUsedItem)[1]; + u16 statId = ItemId_GetEffect(gLastUsedItem)[1]; u16 stages = ItemId_GetHoldEffectParam(gLastUsedItem); SET_STATCHANGER(statId, stages, FALSE); gBattlescriptCurrInstr = cmd->nextInstr; @@ -15956,7 +15956,7 @@ void BS_ItemIncreaseStat(void) void BS_ItemRestorePP(void) { NATIVE_ARGS(); - const u8 *effect = GetItemEffect(gLastUsedItem); + const u8 *effect = ItemId_GetEffect(gLastUsedItem); u32 i, pp, maxPP, moveId, loopEnd; u32 battler = MAX_BATTLERS_COUNT; struct Pokemon *mon = (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER) ? &gPlayerParty[gBattleStruct->itemPartyIndex[gBattlerAttacker]] : &gEnemyParty[gBattleStruct->itemPartyIndex[gBattlerAttacker]]; diff --git a/src/data/items.h b/src/data/items.h index bda247bf2b..cc9372e72e 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -536,6 +536,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_Potion, .flingPower = 30, }, @@ -557,6 +558,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_SuperPotion, .flingPower = 30, }, @@ -578,6 +580,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_HyperPotion, .flingPower = 30, }, @@ -592,6 +595,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_MaxPotion, .flingPower = 30, }, @@ -607,6 +611,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_HEAL_AND_CURE_STATUS, + .effect = gItemEffect_FullRestore, .flingPower = 30, }, @@ -621,6 +626,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_REVIVE, + .effect = gItemEffect_Revive, .flingPower = 30, }, @@ -633,6 +639,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_REVIVE, + .effect = gItemEffect_MaxRevive, .flingPower = 30, }, @@ -654,6 +661,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_FreshWater, .flingPower = 30, }, @@ -675,6 +683,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_SodaPop, .flingPower = 30, }, @@ -696,6 +705,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_Lemonade, .flingPower = 30, }, @@ -711,6 +721,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_MoomooMilk, .flingPower = 30, }, @@ -731,6 +742,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_EnergyPowder, .flingPower = 30, }, @@ -751,6 +763,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_EnergyRoot, .flingPower = 30, }, @@ -765,6 +778,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_HealPowder, .flingPower = 30, }, @@ -779,6 +793,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_REVIVE, + .effect = gItemEffect_RevivalHerb, .flingPower = 30, }, @@ -792,6 +807,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_Antidote, .flingPower = 30, }, @@ -805,6 +821,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_ParalyzeHeal, .flingPower = 30, }, @@ -818,6 +835,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_BurnHeal, .flingPower = 30, }, @@ -831,6 +849,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_IceHeal, .flingPower = 30, }, @@ -844,6 +863,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_Awakening, .flingPower = 30, }, @@ -856,6 +876,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 30, }, @@ -871,6 +892,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU_MOVES, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, .battleUsage = EFFECT_ITEM_RESTORE_PP, + .effect = gItemEffect_Ether, .flingPower = 30, }, @@ -886,6 +908,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU_MOVES, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, .battleUsage = EFFECT_ITEM_RESTORE_PP, + .effect = gItemEffect_MaxEther, .flingPower = 30, }, @@ -900,6 +923,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, .battleUsage = EFFECT_ITEM_RESTORE_PP, + .effect = gItemEffect_Elixir, .flingPower = 30, }, @@ -915,6 +939,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, .battleUsage = EFFECT_ITEM_RESTORE_PP, + .effect = gItemEffect_MaxElixir, .flingPower = 30, }, @@ -931,6 +956,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_Potion, .flingPower = 30, }, @@ -944,6 +970,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_SacredAsh, + .effect = gItemEffect_SacredAsh, .flingPower = 30, }, @@ -959,6 +986,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_Potion, .flingPower = 30, }, @@ -971,6 +999,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_REVIVE, + .effect = gItemEffect_MaxRevive, .flingPower = 30, }, @@ -985,6 +1014,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 30, }, @@ -997,6 +1027,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 30, }, @@ -1011,6 +1042,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 30, }, @@ -1023,6 +1055,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 30, }, @@ -1035,6 +1068,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 30, }, @@ -1047,6 +1081,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 30, }, @@ -1059,6 +1094,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 30, }, @@ -1071,6 +1107,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 30, }, @@ -1085,6 +1122,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_HPUp, .flingPower = 30, }, @@ -1098,6 +1136,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_Protein, .flingPower = 30, }, @@ -1111,6 +1150,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_Iron, .flingPower = 30, }, @@ -1124,6 +1164,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_Calcium, .flingPower = 30, }, @@ -1137,6 +1178,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_Zinc, .flingPower = 30, }, @@ -1150,6 +1192,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_Carbos, .flingPower = 30, }, @@ -1163,6 +1206,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPUp, + .effect = gItemEffect_PPUp, .flingPower = 30, }, @@ -1176,6 +1220,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_PPUp, + .effect = gItemEffect_PPMax, .flingPower = 30, }, @@ -1189,6 +1234,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_HpFeather, .flingPower = 20, }, @@ -1200,6 +1246,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_AtkFeather, .flingPower = 20, }, @@ -1211,6 +1258,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_DefFeather, .flingPower = 20, }, @@ -1222,6 +1270,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_SpatkFeather, .flingPower = 20, }, @@ -1233,6 +1282,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_SpdefFeather, .flingPower = 20, }, @@ -1244,6 +1294,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_SpeedFeather, .flingPower = 20, }, @@ -1582,6 +1633,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_RareCandy, + .effect = gItemEffect_RareCandy, .flingPower = 30, }, @@ -1596,6 +1648,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_RareCandy, + .effect = gItemEffect_RareCandy, .flingPower = 30, }, @@ -1610,6 +1663,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_RareCandy, + .effect = gItemEffect_RareCandy, .flingPower = 30, }, @@ -1624,6 +1678,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_RareCandy, + .effect = gItemEffect_RareCandy, .flingPower = 30, }, @@ -1638,6 +1693,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_RareCandy, + .effect = gItemEffect_RareCandy, .flingPower = 30, }, @@ -1652,6 +1708,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_RareCandy, + .effect = gItemEffect_RareCandy, .flingPower = 30, }, @@ -1681,6 +1738,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_Awakening, .flingPower = 30, }, @@ -1695,6 +1753,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_YellowFlute, .flingPower = 30, }, @@ -1709,6 +1768,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_RedFlute, .flingPower = 30, }, @@ -1869,6 +1929,7 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_INCREASE_STAT, + .effect = gItemEffect_XAttack, .flingPower = 30, }, @@ -1890,6 +1951,7 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_INCREASE_STAT, + .effect = gItemEffect_XDefense, .flingPower = 30, }, @@ -1911,6 +1973,7 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_INCREASE_STAT, + .effect = gItemEffect_XSpecialAttack, .flingPower = 30, }, @@ -1932,6 +1995,7 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_INCREASE_STAT, + .effect = gItemEffect_XSpecialDefense, .flingPower = 30, }, @@ -1953,6 +2017,7 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_INCREASE_STAT, + .effect = gItemEffect_XSpeed, .flingPower = 30, }, @@ -1974,6 +2039,7 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_INCREASE_STAT, + .effect = gItemEffect_XAccuracy, .flingPower = 30, }, @@ -1988,6 +2054,7 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_SET_FOCUS_ENERGY, + .effect = gItemEffect_DireHit, .flingPower = 30, }, @@ -2002,6 +2069,7 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_SET_MIST, + .effect = gItemEffect_GuardSpec, .flingPower = 30, }, @@ -3128,6 +3196,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3139,6 +3208,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3150,6 +3220,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3161,6 +3232,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3172,6 +3244,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3183,6 +3256,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3194,6 +3268,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3205,6 +3280,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3216,6 +3292,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -3227,6 +3304,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -3240,6 +3318,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3253,6 +3332,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3266,6 +3346,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -3279,6 +3360,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -3292,6 +3374,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3305,6 +3388,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3320,6 +3404,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3333,6 +3418,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3346,6 +3432,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -3359,6 +3446,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -3372,6 +3460,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -3385,6 +3474,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 50, }, @@ -3398,6 +3488,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 10, }, @@ -3411,6 +3502,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -3424,6 +3516,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -3437,6 +3530,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -3450,6 +3544,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -5783,6 +5878,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -5797,6 +5893,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 90, }, @@ -6412,6 +6509,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -6782,6 +6880,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -7164,6 +7263,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -7177,6 +7277,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = EVO_HELD_ITEM_TYPE, .fieldUseFunc = EVO_HELD_ITEM_FIELD_FUNC, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -7482,6 +7583,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_ParalyzeHeal, .flingPower = 10, }, @@ -7497,6 +7599,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_Awakening, .flingPower = 10, }, @@ -7512,6 +7615,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_Antidote, .flingPower = 10, }, @@ -7527,6 +7631,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_BurnHeal, .flingPower = 10, }, @@ -7542,6 +7647,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_IceHeal, .flingPower = 10, }, @@ -7558,6 +7664,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU_MOVES, .fieldUseFunc = ItemUseOutOfBattle_PPRecovery, .battleUsage = EFFECT_ITEM_RESTORE_PP, + .effect = gItemEffect_LeppaBerry, .flingPower = 10, }, @@ -7574,6 +7681,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_OranBerry, .flingPower = 10, }, @@ -7589,6 +7697,7 @@ const struct Item gItems[] = .type = ITEM_USE_BAG_MENU, .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_PersimBerry, .flingPower = 10, }, @@ -7604,6 +7713,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_CURE_STATUS, + .effect = gItemEffect_FullHeal, .flingPower = 10, }, @@ -7628,6 +7738,7 @@ const struct Item gItems[] = .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, .battleUsage = EFFECT_ITEM_RESTORE_HP, + .effect = gItemEffect_SitrusBerry, .flingPower = 10, }, @@ -7771,6 +7882,7 @@ const struct Item gItems[] = .pocket = POCKET_BERRIES, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, + .effect = gItemEffect_PomegBerry, .flingPower = 10, }, @@ -7784,6 +7896,7 @@ const struct Item gItems[] = .pocket = POCKET_BERRIES, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, + .effect = gItemEffect_KelpsyBerry, .flingPower = 10, }, @@ -7797,6 +7910,7 @@ const struct Item gItems[] = .pocket = POCKET_BERRIES, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, + .effect = gItemEffect_QualotBerry, .flingPower = 10, }, @@ -7810,6 +7924,7 @@ const struct Item gItems[] = .pocket = POCKET_BERRIES, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, + .effect = gItemEffect_HondewBerry, .flingPower = 10, }, @@ -7823,6 +7938,7 @@ const struct Item gItems[] = .pocket = POCKET_BERRIES, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, + .effect = gItemEffect_GrepaBerry, .flingPower = 10, }, @@ -7836,6 +7952,7 @@ const struct Item gItems[] = .pocket = POCKET_BERRIES, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ReduceEV, + .effect = gItemEffect_TamatoBerry, .flingPower = 10, }, @@ -10835,6 +10952,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -10899,6 +11017,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -10927,6 +11046,7 @@ const struct Item gItems[] = .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, }, [ITEM_SCROLL_OF_WATERS] = @@ -10940,6 +11060,7 @@ const struct Item gItems[] = .pocket = POCKET_KEY_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, }, [ITEM_TERA_ORB] = @@ -11197,6 +11318,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -11210,6 +11332,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -11223,6 +11346,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -11265,6 +11389,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 30, }, @@ -11278,6 +11403,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -11291,6 +11417,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, .flingPower = 80, }, @@ -11338,6 +11465,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_HpMochi, .flingPower = 30, }, @@ -11349,6 +11477,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_AtkMochi, .flingPower = 30, }, @@ -11360,6 +11489,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_DefMochi, .flingPower = 30, }, @@ -11371,6 +11501,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_SpatkMochi, .flingPower = 30, }, @@ -11382,6 +11513,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_SpdefMochi, .flingPower = 30, }, @@ -11393,6 +11525,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_Medicine, + .effect = gItemEffect_SpeedMochi, .flingPower = 30, }, @@ -11406,6 +11539,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_ResetEVs, + .effect = gItemEffect_ResetMochi, .flingPower = 30, }, @@ -11432,6 +11566,7 @@ const struct Item gItems[] = .pocket = POCKET_ITEMS, .type = ITEM_USE_PARTY_MENU, .fieldUseFunc = ItemUseOutOfBattle_EvolutionStone, + .effect = gItemEffect_EvoItem, }, [ITEM_STELLAR_TERA_SHARD] = diff --git a/src/data/pokemon/item_effects.h b/src/data/pokemon/item_effects.h index 4273610b5e..a590d44926 100644 --- a/src/data/pokemon/item_effects.h +++ b/src/data/pokemon/item_effects.h @@ -36,20 +36,12 @@ const u8 gItemEffect_MaxPotion[7] = { const u8 gItemEffect_HyperPotion[7] = { [4] = ITEM4_HEAL_HP, -#if I_HEALTH_RECOVERY >= GEN_7 - [6] = 120, // Amount of HP to recover -#else - [6] = 200, // Amount of HP to recover -#endif + [6] = I_HEALTH_RECOVERY >= GEN_7 ? 120 : 200, // Amount of HP to recover }; const u8 gItemEffect_SuperPotion[7] = { [4] = ITEM4_HEAL_HP, -#if I_HEALTH_RECOVERY >= GEN_7 - [6] = 60, // Amount of HP to recover -#else - [6] = 50, // Amount of HP to recover -#endif + [6] = I_HEALTH_RECOVERY >= GEN_7 ? 60 : 50, // Amount of HP to recover }; const u8 gItemEffect_FullHeal[6] = { @@ -68,29 +60,17 @@ const u8 gItemEffect_MaxRevive[7] = { const u8 gItemEffect_FreshWater[7] = { [4] = ITEM4_HEAL_HP, -#if I_HEALTH_RECOVERY >= GEN_7 - [6] = 30, // Amount of HP to recover -#else - [6] = 50, // Amount of HP to recover -#endif + [6] = I_HEALTH_RECOVERY >= GEN_7 ? 30 : 50, // Amount of HP to recover }; const u8 gItemEffect_SodaPop[7] = { [4] = ITEM4_HEAL_HP, -#if I_HEALTH_RECOVERY >= GEN_7 - [6] = 50, // Amount of HP to recover -#else - [6] = 60, // Amount of HP to recover -#endif + [6] = I_HEALTH_RECOVERY >= GEN_7 ? 50 : 60, // Amount of HP to recover }; const u8 gItemEffect_Lemonade[7] = { [4] = ITEM4_HEAL_HP, -#if I_HEALTH_RECOVERY >= GEN_7 - [6] = 70, // Amount of HP to recover -#else - [6] = 80, // Amount of HP to recover -#endif + [6] = I_HEALTH_RECOVERY >= GEN_7 ? 70 : 80, // Amount of HP to recover }; const u8 gItemEffect_MoomooMilk[7] = { @@ -101,11 +81,7 @@ const u8 gItemEffect_MoomooMilk[7] = { const u8 gItemEffect_EnergyPowder[10] = { [4] = ITEM4_HEAL_HP, [5] = ITEM5_FRIENDSHIP_ALL, -#if I_HEALTH_RECOVERY >= GEN_7 - [6] = 60, // Amount of HP to recover -#else - [6] = 50, // Amount of HP to recover -#endif + [6] = I_HEALTH_RECOVERY >= GEN_7 ? 60 : 50, // Amount of HP to recover [7] = -5, // Friendship change, low [8] = -5, // Friendship change, mid [9] = -10, // Friendship change, high @@ -114,11 +90,7 @@ const u8 gItemEffect_EnergyPowder[10] = { const u8 gItemEffect_EnergyRoot[10] = { [4] = ITEM4_HEAL_HP, [5] = ITEM5_FRIENDSHIP_ALL, -#if I_HEALTH_RECOVERY >= GEN_7 - [6] = 120, // Amount of HP to recover -#else - [6] = 200, // Amount of HP to recover -#endif + [6] = I_HEALTH_RECOVERY >= GEN_7 ? 120 : 200, // Amount of HP to recover [7] = -10, // Friendship change, low [8] = -10, // Friendship change, mid [9] = -15, // Friendship change, high @@ -161,10 +133,6 @@ const u8 gItemEffect_MaxElixir[7] = { [6] = ITEM6_HEAL_PP_FULL, }; -const u8 gItemEffect_BlueFlute[6] = { - [3] = ITEM3_SLEEP, -}; - const u8 gItemEffect_YellowFlute[6] = { [3] = ITEM3_CONFUSION, }; @@ -173,11 +141,6 @@ const u8 gItemEffect_RedFlute[6] = { [0] = ITEM0_INFATUATION, }; -const u8 gItemEffect_BerryJuice[7] = { - [4] = ITEM4_HEAL_HP, - [6] = 20, // Amount of HP to recover -}; - const u8 gItemEffect_SacredAsh[7] = { [0] = ITEM0_SACRED_ASH, [4] = ITEM4_REVIVE | ITEM4_HEAL_HP, @@ -404,26 +367,6 @@ const u8 gItemEffect_EvoItem[6] = { [4] = ITEM4_EVO_STONE, }; -const u8 gItemEffect_CheriBerry[6] = { - [3] = ITEM3_PARALYSIS, -}; - -const u8 gItemEffect_ChestoBerry[6] = { - [3] = ITEM3_SLEEP, -}; - -const u8 gItemEffect_PechaBerry[6] = { - [3] = ITEM3_POISON, -}; - -const u8 gItemEffect_RawstBerry[6] = { - [3] = ITEM3_BURN, -}; - -const u8 gItemEffect_AspearBerry[6] = { - [3] = ITEM3_FREEZE, -}; - const u8 gItemEffect_LeppaBerry[7] = { [4] = ITEM4_HEAL_PP_ONE | ITEM4_HEAL_PP, [6] = 10, // Amount of PP to recover @@ -489,164 +432,3 @@ const u8 gItemEffect_TamatoBerry[10] = { [6] = ITEM6_SUBTRACT_EV, EV_BERRY_FRIENDSHIP_CHANGE, }; - -const u8 *const gItemEffectTable[ITEMS_COUNT] = -{ - // Medicine - [ITEM_POTION] = gItemEffect_Potion, - [ITEM_SUPER_POTION] = gItemEffect_SuperPotion, - [ITEM_HYPER_POTION] = gItemEffect_HyperPotion, - [ITEM_MAX_POTION] = gItemEffect_MaxPotion, - [ITEM_FULL_RESTORE] = gItemEffect_FullRestore, - [ITEM_REVIVE] = gItemEffect_Revive, - [ITEM_MAX_REVIVE] = gItemEffect_MaxRevive, - [ITEM_FRESH_WATER] = gItemEffect_FreshWater, - [ITEM_SODA_POP] = gItemEffect_SodaPop, - [ITEM_LEMONADE] = gItemEffect_Lemonade, - [ITEM_MOOMOO_MILK] = gItemEffect_MoomooMilk, - [ITEM_ENERGY_POWDER] = gItemEffect_EnergyPowder, - [ITEM_ENERGY_ROOT] = gItemEffect_EnergyRoot, - [ITEM_HEAL_POWDER] = gItemEffect_HealPowder, - [ITEM_REVIVAL_HERB] = gItemEffect_RevivalHerb, - [ITEM_ANTIDOTE] = gItemEffect_Antidote, - [ITEM_PARALYZE_HEAL] = gItemEffect_ParalyzeHeal, - [ITEM_BURN_HEAL] = gItemEffect_BurnHeal, - [ITEM_ICE_HEAL] = gItemEffect_IceHeal, - [ITEM_AWAKENING] = gItemEffect_Awakening, - [ITEM_FULL_HEAL] = gItemEffect_FullHeal, - [ITEM_ETHER] = gItemEffect_Ether, - [ITEM_MAX_ETHER] = gItemEffect_MaxEther, - [ITEM_ELIXIR] = gItemEffect_Elixir, - [ITEM_MAX_ELIXIR] = gItemEffect_MaxElixir, - [ITEM_BERRY_JUICE] = gItemEffect_BerryJuice, - [ITEM_SACRED_ASH] = gItemEffect_SacredAsh, - [ITEM_SWEET_HEART] = gItemEffect_Potion, - [ITEM_MAX_HONEY] = gItemEffect_MaxRevive, - - // Regional Specialties - [ITEM_PEWTER_CRUNCHIES] = gItemEffect_FullHeal, - [ITEM_RAGE_CANDY_BAR] = gItemEffect_FullHeal, - [ITEM_LAVA_COOKIE] = gItemEffect_FullHeal, - [ITEM_OLD_GATEAU] = gItemEffect_FullHeal, - [ITEM_CASTELIACONE] = gItemEffect_FullHeal, - [ITEM_LUMIOSE_GALETTE] = gItemEffect_FullHeal, - [ITEM_SHALOUR_SABLE] = gItemEffect_FullHeal, - [ITEM_BIG_MALASADA] = gItemEffect_FullHeal, - - // Vitamins - [ITEM_HP_UP] = gItemEffect_HPUp, - [ITEM_PROTEIN] = gItemEffect_Protein, - [ITEM_IRON] = gItemEffect_Iron, - [ITEM_CALCIUM] = gItemEffect_Calcium, - [ITEM_ZINC] = gItemEffect_Zinc, - [ITEM_CARBOS] = gItemEffect_Carbos, - [ITEM_PP_UP] = gItemEffect_PPUp, - [ITEM_PP_MAX] = gItemEffect_PPMax, - - // EV Feathers - [ITEM_HEALTH_FEATHER] = gItemEffect_HpFeather, - [ITEM_MUSCLE_FEATHER] = gItemEffect_AtkFeather, - [ITEM_RESIST_FEATHER] = gItemEffect_DefFeather, - [ITEM_GENIUS_FEATHER] = gItemEffect_SpatkFeather, - [ITEM_CLEVER_FEATHER] = gItemEffect_SpdefFeather, - [ITEM_SWIFT_FEATHER] = gItemEffect_SpeedFeather, - - //Mochi - [ITEM_HEALTH_MOCHI] = gItemEffect_HpMochi, - [ITEM_MUSCLE_MOCHI] = gItemEffect_AtkMochi, - [ITEM_RESIST_MOCHI] = gItemEffect_DefMochi, - [ITEM_GENIUS_MOCHI] = gItemEffect_SpatkMochi, - [ITEM_CLEVER_MOCHI] = gItemEffect_SpdefMochi, - [ITEM_SWIFT_MOCHI] = gItemEffect_SpeedMochi, - [ITEM_FRESH_START_MOCHI] = gItemEffect_ResetMochi, - - // Candy - [ITEM_RARE_CANDY] = gItemEffect_RareCandy, - [ITEM_EXP_CANDY_XS] = gItemEffect_RareCandy, - [ITEM_EXP_CANDY_S] = gItemEffect_RareCandy, - [ITEM_EXP_CANDY_M] = gItemEffect_RareCandy, - [ITEM_EXP_CANDY_L] = gItemEffect_RareCandy, - [ITEM_EXP_CANDY_XL] = gItemEffect_RareCandy, - //[ITEM_DYNAMAX_CANDY] = gItemEffect_DynamaxCandy, // Todo - - // Medicinal Flutes - [ITEM_BLUE_FLUTE] = gItemEffect_BlueFlute, - [ITEM_YELLOW_FLUTE] = gItemEffect_YellowFlute, - [ITEM_RED_FLUTE] = gItemEffect_RedFlute, - - // X Items - [ITEM_X_ATTACK] = gItemEffect_XAttack, - [ITEM_X_DEFENSE] = gItemEffect_XDefense, - [ITEM_X_SPEED] = gItemEffect_XSpeed, - [ITEM_X_ACCURACY] = gItemEffect_XAccuracy, - [ITEM_X_SP_ATK] = gItemEffect_XSpecialAttack, - [ITEM_X_SP_DEF] = gItemEffect_XSpecialDefense, - - [ITEM_DIRE_HIT] = gItemEffect_DireHit, - [ITEM_GUARD_SPEC] = gItemEffect_GuardSpec, - - // Evolution Items - [ITEM_FIRE_STONE] = gItemEffect_EvoItem, - [ITEM_WATER_STONE] = gItemEffect_EvoItem, - [ITEM_THUNDER_STONE] = gItemEffect_EvoItem, - [ITEM_LEAF_STONE] = gItemEffect_EvoItem, - [ITEM_ICE_STONE] = gItemEffect_EvoItem, - [ITEM_SUN_STONE] = gItemEffect_EvoItem, - [ITEM_MOON_STONE] = gItemEffect_EvoItem, - [ITEM_SHINY_STONE] = gItemEffect_EvoItem, - [ITEM_DUSK_STONE] = gItemEffect_EvoItem, - [ITEM_DAWN_STONE] = gItemEffect_EvoItem, - [ITEM_SWEET_APPLE] = gItemEffect_EvoItem, - [ITEM_TART_APPLE] = gItemEffect_EvoItem, - [ITEM_CRACKED_POT] = gItemEffect_EvoItem, - [ITEM_CHIPPED_POT] = gItemEffect_EvoItem, - [ITEM_GALARICA_CUFF] = gItemEffect_EvoItem, - [ITEM_GALARICA_WREATH] = gItemEffect_EvoItem, - [ITEM_DRAGON_SCALE] = gItemEffect_EvoItem, - [ITEM_UPGRADE] = gItemEffect_EvoItem, - [ITEM_PROTECTOR] = gItemEffect_EvoItem, - [ITEM_ELECTIRIZER] = gItemEffect_EvoItem, - [ITEM_MAGMARIZER] = gItemEffect_EvoItem, - [ITEM_DUBIOUS_DISC] = gItemEffect_EvoItem, - [ITEM_REAPER_CLOTH] = gItemEffect_EvoItem, - [ITEM_PRISM_SCALE] = gItemEffect_EvoItem, - [ITEM_WHIPPED_DREAM] = gItemEffect_EvoItem, - [ITEM_SACHET] = gItemEffect_EvoItem, - [ITEM_OVAL_STONE] = gItemEffect_EvoItem, - [ITEM_DEEP_SEA_SCALE] = gItemEffect_EvoItem, - [ITEM_DEEP_SEA_TOOTH] = gItemEffect_EvoItem, - [ITEM_METAL_COAT] = gItemEffect_EvoItem, - [ITEM_KINGS_ROCK] = gItemEffect_EvoItem, - [ITEM_RAZOR_CLAW] = gItemEffect_EvoItem, - [ITEM_RAZOR_FANG] = gItemEffect_EvoItem, - [ITEM_AUSPICIOUS_ARMOR] = gItemEffect_EvoItem, - [ITEM_MALICIOUS_ARMOR] = gItemEffect_EvoItem, - [ITEM_SCROLL_OF_DARKNESS] = gItemEffect_EvoItem, - [ITEM_SCROLL_OF_WATERS] = gItemEffect_EvoItem, - [ITEM_BLACK_AUGURITE] = gItemEffect_EvoItem, - [ITEM_LINKING_CORD] = gItemEffect_EvoItem, - [ITEM_PEAT_BLOCK] = gItemEffect_EvoItem, - [ITEM_SYRUPY_APPLE] = gItemEffect_EvoItem, - [ITEM_UNREMARKABLE_TEACUP] = gItemEffect_EvoItem, - [ITEM_MASTERPIECE_TEACUP] = gItemEffect_EvoItem, - [ITEM_METAL_ALLOY] = gItemEffect_EvoItem, - - // Berries - [ITEM_CHERI_BERRY] = gItemEffect_CheriBerry, - [ITEM_CHESTO_BERRY] = gItemEffect_ChestoBerry, - [ITEM_PECHA_BERRY] = gItemEffect_PechaBerry, - [ITEM_RAWST_BERRY] = gItemEffect_RawstBerry, - [ITEM_ASPEAR_BERRY] = gItemEffect_AspearBerry, - [ITEM_LEPPA_BERRY] = gItemEffect_LeppaBerry, - [ITEM_ORAN_BERRY] = gItemEffect_OranBerry, - [ITEM_PERSIM_BERRY] = gItemEffect_PersimBerry, - [ITEM_LUM_BERRY] = gItemEffect_FullHeal, - [ITEM_SITRUS_BERRY] = gItemEffect_SitrusBerry, - [ITEM_POMEG_BERRY] = gItemEffect_PomegBerry, - [ITEM_KELPSY_BERRY] = gItemEffect_KelpsyBerry, - [ITEM_QUALOT_BERRY] = gItemEffect_QualotBerry, - [ITEM_HONDEW_BERRY] = gItemEffect_HondewBerry, - [ITEM_GREPA_BERRY] = gItemEffect_GrepaBerry, - [ITEM_TAMATO_BERRY] = gItemEffect_TamatoBerry, - [LAST_BERRY_INDEX] = NULL, -}; diff --git a/src/item.c b/src/item.c index e751624747..de49ad706c 100644 --- a/src/item.c +++ b/src/item.c @@ -23,6 +23,7 @@ static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count); EWRAM_DATA struct BagPocket gBagPockets[POCKETS_COUNT] = {0}; +#include "data/pokemon/item_effects.h" #include "data/items.h" static u16 GetBagItemQuantity(u16 *quantity) @@ -883,6 +884,14 @@ u32 ItemId_GetPrice(u16 itemId) return gItems[SanitizeItemId(itemId)].price; } +const u8 *ItemId_GetEffect(u32 itemId) +{ + if (itemId == ITEM_ENIGMA_BERRY_E_READER) + return gSaveBlock1Ptr->enigmaBerry.itemEffect; + else + return gItems[SanitizeItemId(itemId)].effect; +} + u32 ItemId_GetHoldEffect(u32 itemId) { return gItems[SanitizeItemId(itemId)].holdEffect; @@ -963,7 +972,7 @@ u32 ItemId_GetFlingPower(u32 itemId) u32 GetItemStatus1Mask(u16 itemId) { - const u8 *effect = GetItemEffect(itemId); + const u8 *effect = ItemId_GetEffect(itemId); switch (effect[3]) { case ITEM3_PARALYSIS: @@ -984,7 +993,7 @@ u32 GetItemStatus1Mask(u16 itemId) u32 GetItemStatus2Mask(u16 itemId) { - const u8 *effect = GetItemEffect(itemId); + const u8 *effect = ItemId_GetEffect(itemId); if (effect[3] & ITEM3_STATUS_ALL) return STATUS2_INFATUATION | STATUS2_CONFUSION; else if (effect[0] & ITEM0_INFATUATION) diff --git a/src/item_use.c b/src/item_use.c index 585f5c754a..5ebc79670e 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -1185,7 +1185,7 @@ bool32 CannotUseItemsInBattle(u16 itemId, struct Pokemon *mon) switch (battleUsage) { case EFFECT_ITEM_INCREASE_STAT: - if (gBattleMons[gBattlerInMenuId].statStages[gItemEffectTable[itemId][1]] == MAX_STAT_STAGE) + if (gBattleMons[gBattlerInMenuId].statStages[ItemId_GetEffect(itemId)[1]] == MAX_STAT_STAGE) cannotUse = TRUE; break; case EFFECT_ITEM_SET_FOCUS_ENERGY: @@ -1251,7 +1251,7 @@ bool32 CannotUseItemsInBattle(u16 itemId, struct Pokemon *mon) cannotUse = TRUE; break; case EFFECT_ITEM_RESTORE_PP: - if (GetItemEffect(itemId)[6] == ITEM4_HEAL_PP) + if (ItemId_GetEffect(itemId)[6] == ITEM4_HEAL_PP) { for (i = 0; i < MAX_MON_MOVES; i++) { diff --git a/src/party_menu.c b/src/party_menu.c index 54d8ec41b7..07e4b405ff 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4464,7 +4464,7 @@ static void Task_SetSacredAshCB(u8 taskId) static bool8 IsHPRecoveryItem(u16 item) { - const u8 *effect = GetItemEffect(item); + const u8 *effect = ItemId_GetEffect(item); if (effect == NULL) return FALSE; @@ -5130,7 +5130,7 @@ static void Task_HandleWhichMoveInput(u8 taskId) void ItemUseCB_PPRecovery(u8 taskId, TaskFunc task) { - const u8 *effect = GetItemEffect(gSpecialVar_ItemId); + const u8 *effect = ItemId_GetEffect(gSpecialVar_ItemId); if (effect == NULL || !(effect[4] & ITEM4_HEAL_PP_ONE)) { @@ -6551,18 +6551,10 @@ void TryItemHoldFormChange(struct Pokemon *mon) #undef tAnimWait #undef tNextFunc -const u8* GetItemEffect(u16 item) -{ - if (item == ITEM_ENIGMA_BERRY_E_READER) - return gSaveBlock1Ptr->enigmaBerry.itemEffect; - else - return gItemEffectTable[item]; -} - u8 GetItemEffectType(u16 item) { u32 statusCure; - const u8 *itemEffect = GetItemEffect(item); + const u8 *itemEffect = ItemId_GetEffect(item); if (itemEffect == NULL) return ITEM_EFFECT_NONE; diff --git a/src/pokemon.c b/src/pokemon.c index 8f3f5630cb..cf89c88799 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -361,8 +361,6 @@ const struct SpindaSpot gSpindaSpotGraphics[] = {.x = 34, .y = 26, .image = INCBIN_U16("graphics/pokemon/spinda/spots/spot_3.1bpp")} }; -#include "data/pokemon/item_effects.h" - const u8 *const gNatureNamePointers[NUM_NATURES] = { [NATURE_HARDY] = COMPOUND_STRING("Hardy"), @@ -3413,11 +3411,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov holdEffect = ItemId_GetHoldEffect(heldItem); // Skip using the item if it won't do anything - if (gItemEffectTable[item] == NULL && item != ITEM_ENIGMA_BERRY_E_READER) + if (ItemId_GetEffect(item) == NULL && item != ITEM_ENIGMA_BERRY_E_READER) return TRUE; // Get item effect - itemEffect = GetItemEffect(item); + itemEffect = ItemId_GetEffect(item); // Do item effect for (i = 0; i < ITEM_EFFECT_ARG_START; i++) @@ -3841,7 +3839,7 @@ u8 GetItemEffectParamOffset(u32 battler, u16 itemId, u8 effectByte, u8 effectBit offset = ITEM_EFFECT_ARG_START; - temp = gItemEffectTable[itemId]; + temp = ItemId_GetEffect(itemId); if (temp != NULL && !temp && itemId != ITEM_ENIGMA_BERRY_E_READER) return 0; @@ -3973,7 +3971,7 @@ u8 *UseStatIncreaseItem(u16 itemId) } else { - itemEffect = gItemEffectTable[itemId]; + itemEffect = ItemId_GetEffect(itemId); } gPotentialItemEffectBattler = gBattlerInMenuId;