Sitrus berry gen4 effect code
This commit is contained in:
parent
89ed5bc8bb
commit
08a5ba0db2
2 changed files with 42 additions and 19 deletions
|
@ -103,6 +103,7 @@
|
||||||
#define HOLD_EFFECT_GRACIDEA 97
|
#define HOLD_EFFECT_GRACIDEA 97
|
||||||
#define HOLD_EFFECT_RESIST_BERRY 98
|
#define HOLD_EFFECT_RESIST_BERRY 98
|
||||||
#define HOLD_EFFECT_EV_BOOST 99
|
#define HOLD_EFFECT_EV_BOOST 99
|
||||||
|
#define HOLD_EFFECT_RESTORE_PCT_HP 100
|
||||||
|
|
||||||
// Gen5 hold effects
|
// Gen5 hold effects
|
||||||
#define HOLD_EFFECT_FLOAT_STONE 115
|
#define HOLD_EFFECT_FLOAT_STONE 115
|
||||||
|
|
|
@ -4287,6 +4287,29 @@ static u8 RandomStatRaiseBerry(u32 battlerId, u32 itemId)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal)
|
||||||
|
{
|
||||||
|
if (HasEnoughHpToEatBerry(battlerId, 2, gLastUsedItem))
|
||||||
|
{
|
||||||
|
if (percentHeal)
|
||||||
|
gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1;
|
||||||
|
else
|
||||||
|
gBattleMoveDamage = GetBattlerHoldEffectParam(battlerId) * -1;
|
||||||
|
|
||||||
|
if (end2)
|
||||||
|
{
|
||||||
|
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItemEnd2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BattleScriptPushCursor();
|
||||||
|
gBattlescriptCurrInstr = BattleScript_ItemHealHP_RemoveItemRet;
|
||||||
|
}
|
||||||
|
return ITEM_HP_CHANGE;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||||
{
|
{
|
||||||
int i = 0, moveType;
|
int i = 0, moveType;
|
||||||
|
@ -4470,12 +4493,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_RESTORE_HP:
|
case HOLD_EFFECT_RESTORE_HP:
|
||||||
if (B_BERRIES_INSTANT >= GEN_4 && HasEnoughHpToEatBerry(battlerId, 2, gLastUsedItem))
|
if (B_BERRIES_INSTANT >= GEN_4)
|
||||||
{
|
effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE);
|
||||||
gBattleMoveDamage = GetBattlerHoldEffectParam(battlerId) * -1;
|
break;
|
||||||
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItemEnd2);
|
case HOLD_EFFECT_RESTORE_PCT_HP:
|
||||||
effect = ITEM_HP_CHANGE;
|
if (B_BERRIES_INSTANT >= GEN_4)
|
||||||
}
|
effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE);
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_AIR_BALLOON:
|
case HOLD_EFFECT_AIR_BALLOON:
|
||||||
effect = ITEM_EFFECT_OTHER;
|
effect = ITEM_EFFECT_OTHER;
|
||||||
|
@ -4509,12 +4532,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||||
switch (battlerHoldEffect)
|
switch (battlerHoldEffect)
|
||||||
{
|
{
|
||||||
case HOLD_EFFECT_RESTORE_HP:
|
case HOLD_EFFECT_RESTORE_HP:
|
||||||
if (!moveTurn && HasEnoughHpToEatBerry(battlerId, 2, gLastUsedItem))
|
if (!moveTurn)
|
||||||
{
|
effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE);
|
||||||
gBattleMoveDamage = GetBattlerHoldEffectParam(battlerId) *-1;
|
break;
|
||||||
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItemEnd2);
|
case HOLD_EFFECT_RESTORE_PCT_HP:
|
||||||
effect = ITEM_HP_CHANGE;
|
if (B_BERRIES_INSTANT >= GEN_4)
|
||||||
}
|
effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE);
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_RESTORE_PP:
|
case HOLD_EFFECT_RESTORE_PP:
|
||||||
if (!moveTurn)
|
if (!moveTurn)
|
||||||
|
@ -4780,13 +4803,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||||
switch (battlerHoldEffect)
|
switch (battlerHoldEffect)
|
||||||
{
|
{
|
||||||
case HOLD_EFFECT_RESTORE_HP:
|
case HOLD_EFFECT_RESTORE_HP:
|
||||||
if (B_HP_BERRIES >= GEN_4 && HasEnoughHpToEatBerry(battlerId, 2, gLastUsedItem))
|
if (B_HP_BERRIES >= GEN_4)
|
||||||
{
|
effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE);
|
||||||
gBattleMoveDamage = GetBattlerHoldEffectParam(battlerId) *-1;
|
break;
|
||||||
BattleScriptPushCursor();
|
case HOLD_EFFECT_RESTORE_PCT_HP:
|
||||||
gBattlescriptCurrInstr = BattleScript_ItemHealHP_RemoveItemRet;
|
if (B_BERRIES_INSTANT >= GEN_4)
|
||||||
effect = ITEM_HP_CHANGE;
|
effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_CURE_PAR:
|
case HOLD_EFFECT_CURE_PAR:
|
||||||
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS)
|
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS)
|
||||||
|
|
Loading…
Reference in a new issue