Cheek Pouch

This commit is contained in:
DizzyEggg 2020-07-16 15:20:03 +02:00
parent 60d5d00dba
commit 759bde46bb
4 changed files with 41 additions and 8 deletions

View File

@ -6607,15 +6607,26 @@ BattleScript_ReceiverActivates::
settracedability BS_ABILITY_BATTLER
return
BattleScript_RainDishActivates::
BattleScript_AbilityHpHeal:
call BattleScript_AbilityPopUp
printstring STRINGID_PKMNSXRESTOREDHPALITTLE2
waitmessage 0x40
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
healthbarupdate BS_ATTACKER
datahpupdate BS_ATTACKER
return
BattleScript_RainDishActivates::
call BattleScript_AbilityHpHeal
end3
BattleScript_CheekPouchActivates::
copybyte sSAVED_BATTLER, gBattlerAttacker
copybyte gBattlerAttacker, gBattlerAbility
call BattleScript_AbilityHpHeal
copybyte gBattlerAttacker, sSAVED_BATTLER
return
BattleScript_HarvestActivates::
pause 0x5
call BattleScript_AbilityPopUp

View File

@ -347,5 +347,6 @@ extern const u8 BattleScript_EmergencyExit[];
extern const u8 BattleScript_EmergencyExitNoPopUp[];
extern const u8 BattleScript_EmergencyExitWild[];
extern const u8 BattleScript_EmergencyExitWildNoPopUp[];
extern const u8 BattleScript_CheekPouchActivates[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -6247,21 +6247,42 @@ static void Cmd_setgravity(void)
}
else
{
u32 i;
gFieldStatuses |= STATUS_FIELD_GRAVITY;
gFieldTimers.gravityTimer = 5;
gBattlescriptCurrInstr += 5;
}
}
static bool32 TryCheekPouch(u32 battlerId, u32 itemId)
{
if (ItemId_GetPocket(itemId) == POCKET_BERRIES
&& GetBattlerAbility(battlerId) == ABILITY_CHEEK_POUCH
&& !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)
&& gBattleStruct->ateBerry[GetBattlerSide(battlerId)] & gBitTable[gBattlerPartyIndexes[battlerId]]
&& !BATTLER_MAX_HP(battlerId))
{
gBattleMoveDamage = gBattleMons[battlerId].maxHP / 3;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
gBattleMoveDamage *= -1;
gBattlerAbility = battlerId;
BattleScriptPush(gBattlescriptCurrInstr + 2);
gBattlescriptCurrInstr = BattleScript_CheekPouchActivates;
return TRUE;
}
return FALSE;
}
static void Cmd_removeitem(void)
{
u16 itemId = 0;
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
itemId = gBattleMons[gActiveBattler].item;
// Popped Air Balloon cannot be restored by no means.
if (GetBattlerHoldEffect(gActiveBattler, TRUE) != HOLD_EFFECT_AIR_BALLOON)
gBattleStruct->usedHeldItems[gActiveBattler] = gBattleMons[gActiveBattler].item;
gBattleStruct->usedHeldItems[gActiveBattler] = itemId;
gBattleMons[gActiveBattler].item = 0;
CheckSetUnburden(gActiveBattler);
@ -6270,8 +6291,8 @@ static void Cmd_removeitem(void)
MarkBattlerForControllerExec(gActiveBattler);
ClearBattlerItemEffectHistory(gActiveBattler);
gBattlescriptCurrInstr += 2;
if (!TryCheekPouch(gActiveBattler, itemId))
gBattlescriptCurrInstr += 2;
}
static void Cmd_atknameinbuff1(void)

View File

@ -4322,7 +4322,7 @@ static u8 RandomStatRaiseBerry(u32 battlerId, u32 itemId)
static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal)
{
if (HasEnoughHpToEatBerry(battlerId, 2, gLastUsedItem))
if (HasEnoughHpToEatBerry(battlerId, 2, itemId))
{
if (percentHeal)
gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1;