mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 09:24:19 +01:00
Implemented the effects of the Power Items
For more info: https://bulbapedia.bulbagarden.net/wiki/Power_item
This commit is contained in:
parent
e4635525e7
commit
2578a440a1
@ -5560,6 +5560,24 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
|
||||
u16 heldItem;
|
||||
u8 holdEffect;
|
||||
int i, multiplier;
|
||||
u8 stat;
|
||||
u8 bonus;
|
||||
|
||||
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0);
|
||||
if (heldItem == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
if (gMain.inBattle)
|
||||
holdEffect = gEnigmaBerries[0].holdEffect;
|
||||
else
|
||||
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
|
||||
}
|
||||
else
|
||||
{
|
||||
holdEffect = ItemId_GetHoldEffect(heldItem);
|
||||
}
|
||||
|
||||
stat = ItemId_GetSecondaryId(heldItem);
|
||||
bonus = ItemId_GetHoldEffectParam(heldItem);
|
||||
|
||||
for (i = 0; i < NUM_STATS; i++)
|
||||
{
|
||||
@ -5580,36 +5598,41 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
|
||||
switch (i)
|
||||
{
|
||||
case STAT_HP:
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_HP * multiplier;
|
||||
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_HP)
|
||||
evIncrease = (gBaseStats[defeatedSpecies].evYield_HP + bonus) * multiplier;
|
||||
else
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_HP * multiplier;
|
||||
break;
|
||||
case STAT_ATK:
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_Attack * multiplier;
|
||||
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_ATK)
|
||||
evIncrease = (gBaseStats[defeatedSpecies].evYield_Attack + bonus) * multiplier;
|
||||
else
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_Attack * multiplier;
|
||||
break;
|
||||
case STAT_DEF:
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_Defense * multiplier;
|
||||
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_DEF)
|
||||
evIncrease = (gBaseStats[defeatedSpecies].evYield_Defense + bonus) * multiplier;
|
||||
else
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_Defense * multiplier;
|
||||
break;
|
||||
case STAT_SPEED:
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_Speed * multiplier;
|
||||
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_SPEED)
|
||||
evIncrease = (gBaseStats[defeatedSpecies].evYield_Speed + bonus) * multiplier;
|
||||
else
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_Speed * multiplier;
|
||||
break;
|
||||
case STAT_SPATK:
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_SpAttack * multiplier;
|
||||
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_SPATK)
|
||||
evIncrease = (gBaseStats[defeatedSpecies].evYield_SpAttack + bonus) * multiplier;
|
||||
else
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_SpAttack * multiplier;
|
||||
break;
|
||||
case STAT_SPDEF:
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_SpDefense * multiplier;
|
||||
break;
|
||||
}
|
||||
|
||||
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0);
|
||||
if (heldItem == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
if (gMain.inBattle)
|
||||
holdEffect = gEnigmaBerries[0].holdEffect;
|
||||
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_SPDEF)
|
||||
evIncrease = (gBaseStats[defeatedSpecies].evYield_SpDefense + bonus) * multiplier;
|
||||
else
|
||||
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
|
||||
}
|
||||
else
|
||||
{
|
||||
holdEffect = ItemId_GetHoldEffect(heldItem);
|
||||
evIncrease = gBaseStats[defeatedSpecies].evYield_SpDefense * multiplier;
|
||||
break;
|
||||
}
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
|
||||
|
Loading…
x
Reference in New Issue
Block a user