ripen & hp restoring berries

This commit is contained in:
Evan 2021-01-05 21:15:21 -07:00
parent 73a7800f72
commit f046a25ce0
2 changed files with 18 additions and 2 deletions

View file

@ -7461,6 +7461,11 @@ BattleScript_WhiteHerbRet::
return
BattleScript_ItemHealHP_RemoveItemRet::
jumpifability BS_SCRIPTING, ABILITY_RIPEN, BattleScript_ItemHealHP_RemoveItemRet_AbilityPopUp
goto BattleScript_ItemHealHP_RemoveItemRet_Anim
BattleScript_ItemHealHP_RemoveItemRet_AbilityPopUp:
call BattleScript_AbilityPopUp
BattleScript_ItemHealHP_RemoveItemRet_Anim:
playanimation BS_SCRIPTING, B_ANIM_HELD_ITEM_EFFECT, NULL
printstring STRINGID_PKMNSITEMRESTOREDHEALTH
waitmessage 0x40
@ -7470,6 +7475,11 @@ BattleScript_ItemHealHP_RemoveItemRet::
removeitem BS_SCRIPTING
return
BattleScript_ItemHealHP_RemoveItemEnd2::
jumpifability BS_ATTACKER, ABILITY_RIPEN BattleScript_ItemHealHP_RemoveItemEnd2_AbilityPopUp
goto BattleScript_ItemHealHP_RemoveItemEnd2_Anim
BattleScript_ItemHealHP_RemoveItemEnd2_AbilityPopUp:
call BattleScript_AbilityPopUp
BattleScript_ItemHealHP_RemoveItemEnd2_Anim:
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT, NULL
printstring STRINGID_PKMNSITEMRESTOREDHEALTH
waitmessage 0x40

View file

@ -4980,7 +4980,7 @@ enum
static bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId)
{
bool32 isBerry = (ItemId_GetPocket(itemId) == POCKET_BERRIES);
if (gBattleMons[battlerId].hp == 0)
return FALSE;
// Unnerve prevents consumption of opponents' berries.
@ -5073,6 +5073,7 @@ static u8 RandomStatRaiseBerry(u32 battlerId, u32 itemId)
return 0;
}
// berries, berry juice
static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal)
{
if (HasEnoughHpToEatBerry(battlerId, 2, itemId))
@ -5081,7 +5082,12 @@ static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal)
gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1;
else
gBattleMoveDamage = GetBattlerHoldEffectParam(battlerId) * -1;
// check ripen
if (ItemId_GetPocket(itemId) == POCKET_BERRIES && GetBattlerAbility(battlerId) == ABILITY_RIPEN)
gBattleMoveDamage *= 2;
gBattlerAbility = battlerId; // in SWSH, berry juice shows ability pop up but has no effect. This is mimicked here
if (end2)
{
BattleScriptExecute(BattleScript_ItemHealHP_RemoveItemEnd2);