mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-31 23:00:42 +01:00
implementation of EXP candies
This commit is contained in:
parent
2983152358
commit
03c21c3b71
@ -1354,11 +1354,17 @@ const struct Item gItems[] =
|
||||
|
||||
// Candy
|
||||
|
||||
#define ONE_HUNDRED 1 << 4
|
||||
#define ONE_THOUSAND 1 << 5
|
||||
#define TEN_THOUSAND 1 << 6
|
||||
#define FULL_LEVEL 1 << 7
|
||||
|
||||
[ITEM_RARE_CANDY] =
|
||||
{
|
||||
.name = _("Rare Candy"),
|
||||
.itemId = ITEM_RARE_CANDY,
|
||||
.price = 10000,
|
||||
.holdEffectParam = FULL_LEVEL,
|
||||
.description = sRareCandyDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_PARTY_MENU,
|
||||
@ -1371,10 +1377,11 @@ const struct Item gItems[] =
|
||||
.name = _("Exp.Candy XS"),
|
||||
.itemId = ITEM_EXP_CANDY_XS,
|
||||
.price = 20,
|
||||
.holdEffectParam = 1 | ONE_HUNDRED,
|
||||
.description = sExpCandyXSDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo
|
||||
.type = ITEM_USE_PARTY_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_RareCandy, // Todo
|
||||
.flingPower = 30,
|
||||
},
|
||||
|
||||
@ -1383,10 +1390,11 @@ const struct Item gItems[] =
|
||||
.name = _("Exp.Candy S"),
|
||||
.itemId = ITEM_EXP_CANDY_S,
|
||||
.price = 240,
|
||||
.holdEffectParam = 8 | ONE_HUNDRED,
|
||||
.description = sExpCandyXSDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo
|
||||
.type = ITEM_USE_PARTY_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_RareCandy, // Todo
|
||||
.flingPower = 30,
|
||||
},
|
||||
|
||||
@ -1395,10 +1403,11 @@ const struct Item gItems[] =
|
||||
.name = _("Exp.Candy M"),
|
||||
.itemId = ITEM_EXP_CANDY_M,
|
||||
.price = 1000,
|
||||
.holdEffectParam = 3 | ONE_THOUSAND,
|
||||
.description = sExpCandyMDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo
|
||||
.type = ITEM_USE_PARTY_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_RareCandy, // Todo
|
||||
.flingPower = 30,
|
||||
},
|
||||
|
||||
@ -1407,10 +1416,11 @@ const struct Item gItems[] =
|
||||
.name = _("Exp.Candy L"),
|
||||
.itemId = ITEM_EXP_CANDY_L,
|
||||
.price = 3000,
|
||||
.holdEffectParam = 1 | TEN_THOUSAND,
|
||||
.description = sExpCandyLDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo
|
||||
.type = ITEM_USE_PARTY_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_RareCandy, // Todo
|
||||
.flingPower = 30,
|
||||
},
|
||||
|
||||
@ -1419,10 +1429,11 @@ const struct Item gItems[] =
|
||||
.name = _("Exp.Candy XL"),
|
||||
.itemId = ITEM_EXP_CANDY_XL,
|
||||
.price = 10000,
|
||||
.holdEffectParam = 3 | TEN_THOUSAND,
|
||||
.description = sExpCandyXLDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo
|
||||
.type = ITEM_USE_PARTY_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_RareCandy, // Todo
|
||||
.flingPower = 30,
|
||||
},
|
||||
|
||||
@ -1438,6 +1449,11 @@ const struct Item gItems[] =
|
||||
.flingPower = 30,
|
||||
},
|
||||
|
||||
#undef ONE_HUNDRED
|
||||
#undef ONE_THOUSAND
|
||||
#undef TEN_THOUSAND
|
||||
#undef FULL_LEVEL
|
||||
|
||||
// Medicinal Flutes
|
||||
|
||||
[ITEM_BLUE_FLUTE] =
|
||||
|
@ -532,11 +532,11 @@ const u8 *const gItemEffectTable[] =
|
||||
|
||||
// Candy
|
||||
[ITEM_RARE_CANDY - ITEM_POTION] = gItemEffect_RareCandy,
|
||||
//[ITEM_EXP_CANDY_XS - ITEM_POTION] = gItemEffect_ExpCandy, // Todo
|
||||
//[ITEM_EXP_CANDY_S - ITEM_POTION] = gItemEffect_ExpCandy, // Todo
|
||||
//[ITEM_EXP_CANDY_M - ITEM_POTION] = gItemEffect_ExpCandy, // Todo
|
||||
//[ITEM_EXP_CANDY_L - ITEM_POTION] = gItemEffect_ExpCandy, // Todo
|
||||
//[ITEM_EXP_CANDY_XL - ITEM_POTION] = gItemEffect_ExpCandy, // Todo
|
||||
[ITEM_EXP_CANDY_XS - ITEM_POTION] = gItemEffect_RareCandy, // Todo
|
||||
[ITEM_EXP_CANDY_S - ITEM_POTION] = gItemEffect_RareCandy, // Todo
|
||||
[ITEM_EXP_CANDY_M - ITEM_POTION] = gItemEffect_RareCandy, // Todo
|
||||
[ITEM_EXP_CANDY_L - ITEM_POTION] = gItemEffect_RareCandy, // Todo
|
||||
[ITEM_EXP_CANDY_XL - ITEM_POTION] = gItemEffect_RareCandy, // Todo
|
||||
//[ITEM_DYNAMAX_CANDY - ITEM_POTION] = gItemEffect_DynamaxCandy, // Todo
|
||||
|
||||
// Medicinal Flutes
|
||||
|
@ -4873,16 +4873,40 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
retVal = FALSE;
|
||||
}
|
||||
|
||||
#define ONE_HUNDRED 1 << 4
|
||||
#define ONE_THOUSAND 1 << 5
|
||||
#define TEN_THOUSAND 1 << 6
|
||||
#define FULL_LEVEL 1 << 7
|
||||
|
||||
// Rare Candy
|
||||
if ((itemEffect[i] & ITEM3_LEVEL_UP)
|
||||
&& GetMonData(mon, MON_DATA_LEVEL, NULL) != MAX_LEVEL)
|
||||
{
|
||||
dataUnsigned = gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1];
|
||||
if (ItemId_GetHoldEffectParam(item) & FULL_LEVEL)
|
||||
dataUnsigned = gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1];
|
||||
else
|
||||
{
|
||||
temp1 = ItemId_GetHoldEffectParam(item) & 0x0F;
|
||||
if (ItemId_GetHoldEffectParam(item) & ONE_HUNDRED)
|
||||
temp1 *= 100;
|
||||
if (ItemId_GetHoldEffectParam(item) & ONE_THOUSAND)
|
||||
temp1 *= 1000;
|
||||
if (ItemId_GetHoldEffectParam(item) & TEN_THOUSAND)
|
||||
temp1 *= 10000;
|
||||
dataUnsigned = temp1 + gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL)];
|
||||
if (dataUnsigned > gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][MAX_LEVEL])
|
||||
dataUnsigned = gExperienceTables[gBaseStats[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][MAX_LEVEL];
|
||||
}
|
||||
SetMonData(mon, MON_DATA_EXP, &dataUnsigned);
|
||||
CalculateMonStats(mon);
|
||||
retVal = FALSE;
|
||||
}
|
||||
|
||||
#undef ONE_HUNDRED
|
||||
#undef ONE_THOUSAND
|
||||
#undef TEN_THOUSAND
|
||||
#undef FULL_LEVEL
|
||||
|
||||
// Cure status
|
||||
if ((itemEffect[i] & ITEM3_SLEEP)
|
||||
&& HealStatusConditions(mon, partyIndex, STATUS1_SLEEP, battlerId) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user