mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
add bug bite
This commit is contained in:
parent
e6a2d2226f
commit
4ca6d76160
@ -1768,6 +1768,11 @@
|
|||||||
.macro tryactivategrimneigh, battler:req
|
.macro tryactivategrimneigh, battler:req
|
||||||
various \battler, VARIOUS_TRY_ACTIVATE_GRIM_NEIGH
|
various \battler, VARIOUS_TRY_ACTIVATE_GRIM_NEIGH
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro consumeberry battler:req, restoreItem=FALSE
|
||||||
|
various \battler, VARIOUS_CONSUME_BERRY
|
||||||
|
.byte \restoreItem
|
||||||
|
.endm
|
||||||
|
|
||||||
@ helpful macros
|
@ helpful macros
|
||||||
.macro setstatchanger stat:req, stages:req, down:req
|
.macro setstatchanger stat:req, stages:req, down:req
|
||||||
|
@ -508,6 +508,11 @@ BattleScript_MoveEffectIncinerate::
|
|||||||
BattleScript_MoveEffectBugBite::
|
BattleScript_MoveEffectBugBite::
|
||||||
printstring STRINGID_BUGBITE
|
printstring STRINGID_BUGBITE
|
||||||
waitmessage B_WAIT_TIME_LONG
|
waitmessage B_WAIT_TIME_LONG
|
||||||
|
orword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||||
|
setbyte sBERRY_OVERRIDE, TRUE @ override the requirements for eating berries
|
||||||
|
consumeberry BS_ATTACKER, TRUE @ consume the berry, then restore the item from changedItems
|
||||||
|
bicword gHitMarker, HITMARKER_NO_ANIMATIONS
|
||||||
|
setbyte sBERRY_OVERRIDE, FALSE
|
||||||
return
|
return
|
||||||
|
|
||||||
BattleScript_EffectCoreEnforcer:
|
BattleScript_EffectCoreEnforcer:
|
||||||
|
@ -659,6 +659,7 @@ struct BattleScripting
|
|||||||
u8 illusionNickHack; // To properly display nick in STRINGID_ENEMYABOUTTOSWITCHPKMN.
|
u8 illusionNickHack; // To properly display nick in STRINGID_ENEMYABOUTTOSWITCHPKMN.
|
||||||
bool8 fixedPopup; // force ability popup to stick until manually called back
|
bool8 fixedPopup; // force ability popup to stick until manually called back
|
||||||
u16 abilityPopupOverwrite;
|
u16 abilityPopupOverwrite;
|
||||||
|
u8 overrideBerryRequirements;
|
||||||
};
|
};
|
||||||
|
|
||||||
// rom_80A5C6C
|
// rom_80A5C6C
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4
|
#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4
|
||||||
#define ITEMEFFECT_TARGET 0x5
|
#define ITEMEFFECT_TARGET 0x5
|
||||||
#define ITEMEFFECT_ORBS 0x6
|
#define ITEMEFFECT_ORBS 0x6
|
||||||
|
#define ITEMEFFECT_BATTLER_MOVE_END 0x7 // move end effects for just the battler, not whole field
|
||||||
|
|
||||||
#define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK)))
|
#define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK)))
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#define sILLUSION_NICK_HACK gBattleScripting + 0x32
|
#define sILLUSION_NICK_HACK gBattleScripting + 0x32
|
||||||
#define sFIXED_ABILITY_POPUP gBattleScripting + 0x33
|
#define sFIXED_ABILITY_POPUP gBattleScripting + 0x33
|
||||||
#define sABILITY_OVERWRITE gBattleScripting + 0x34
|
#define sABILITY_OVERWRITE gBattleScripting + 0x34
|
||||||
|
#define sBERRY_OVERRIDE gBattleScripting + 0x36
|
||||||
|
|
||||||
#define cMULTISTRING_CHOOSER gBattleCommunication + 5
|
#define cMULTISTRING_CHOOSER gBattleCommunication + 5
|
||||||
#define cMISS_TYPE gBattleCommunication + 6
|
#define cMISS_TYPE gBattleCommunication + 6
|
||||||
@ -173,6 +174,7 @@
|
|||||||
#define VARIOUS_DESTROY_ABILITY_POPUP 102
|
#define VARIOUS_DESTROY_ABILITY_POPUP 102
|
||||||
#define VARIOUS_TOTEM_BOOST 103
|
#define VARIOUS_TOTEM_BOOST 103
|
||||||
#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104
|
#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104
|
||||||
|
#define VARIOUS_CONSUME_BERRY 105
|
||||||
|
|
||||||
// Cmd_manipulatedamage
|
// Cmd_manipulatedamage
|
||||||
#define DMG_CHANGE_SIGN 0
|
#define DMG_CHANGE_SIGN 0
|
||||||
|
@ -3284,16 +3284,22 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MOVE_EFFECT_BUG_BITE:
|
case MOVE_EFFECT_BUG_BITE:
|
||||||
if ((gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX)
|
if (ItemId_GetPocket(gBattleMons[gEffectBattler].item) == POCKET_BERRIES
|
||||||
&& GetBattlerAbility(gEffectBattler) != ABILITY_STICKY_HOLD)
|
&& GetBattlerAbility(gEffectBattler) != ABILITY_STICKY_HOLD)
|
||||||
{
|
{
|
||||||
|
// target loses their berry
|
||||||
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
gLastUsedItem = gBattleMons[gEffectBattler].item;
|
||||||
gBattleMons[gEffectBattler].item = 0;
|
gBattleMons[gEffectBattler].item = 0;
|
||||||
CheckSetUnburden(gEffectBattler);
|
CheckSetUnburden(gEffectBattler);
|
||||||
|
|
||||||
gActiveBattler = gEffectBattler;
|
gActiveBattler = gEffectBattler;
|
||||||
|
|
||||||
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gEffectBattler].item);
|
BtlController_EmitSetMonData(0, REQUEST_HELDITEM_BATTLE, 0, 2, &gBattleMons[gEffectBattler].item);
|
||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
|
|
||||||
|
// attacker temporarily gains their item
|
||||||
|
gBattleStruct->changedItems[gBattlerAttacker] = gBattleMons[gBattlerAttacker].item;
|
||||||
|
gBattleMons[gBattlerAttacker].item = gLastUsedItem;
|
||||||
|
|
||||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||||
gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite;
|
gBattlescriptCurrInstr = BattleScript_MoveEffectBugBite;
|
||||||
}
|
}
|
||||||
@ -8422,6 +8428,27 @@ static void Cmd_various(void)
|
|||||||
gBattlescriptCurrInstr += 7; // exit if loop failed (failsafe)
|
gBattlescriptCurrInstr += 7; // exit if loop failed (failsafe)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
case VARIOUS_CONSUME_BERRY:
|
||||||
|
if (ItemId_GetHoldEffect(gBattleMons[gActiveBattler].item) == HOLD_EFFECT_NONE)
|
||||||
|
{
|
||||||
|
gBattlescriptCurrInstr += 4;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gBattleScripting.battler = gEffectBattler = gBattlerTarget = gActiveBattler; // cover all berry effect battlerId cases. e.g. ChangeStatBuffs uses target ID
|
||||||
|
// do move end berry effects for just a single battler, instead of looping through all battlers
|
||||||
|
if (ItemBattleEffects(ITEMEFFECT_BATTLER_MOVE_END, gActiveBattler, FALSE))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gBattlescriptCurrInstr[3])
|
||||||
|
{
|
||||||
|
gBattleMons[gActiveBattler].item = gBattleStruct->changedItems[gActiveBattler];
|
||||||
|
gBattleStruct->changedItems[gActiveBattler] = ITEM_NONE;
|
||||||
|
gBattleResources->flags->flags[gActiveBattler] &= ~(RESOURCE_FLAG_UNBURDEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
gBattlescriptCurrInstr += 4;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBattlescriptCurrInstr += 3;
|
gBattlescriptCurrInstr += 3;
|
||||||
|
@ -5385,6 +5385,8 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId)
|
|||||||
|
|
||||||
if (gBattleMons[battlerId].hp == 0)
|
if (gBattleMons[battlerId].hp == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
if (gBattleScripting.overrideBerryRequirements)
|
||||||
|
return TRUE;
|
||||||
// Unnerve prevents consumption of opponents' berries.
|
// Unnerve prevents consumption of opponents' berries.
|
||||||
if (isBerry && IsUnnerveAbilityOnOpposingSide(battlerId))
|
if (isBerry && IsUnnerveAbilityOnOpposingSide(battlerId))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -6095,11 +6097,14 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ITEMEFFECT_BATTLER_MOVE_END:
|
||||||
|
goto DO_ITEMEFFECT_MOVE_END; // this hurts a bit to do, but is an easy solution
|
||||||
case ITEMEFFECT_MOVE_END:
|
case ITEMEFFECT_MOVE_END:
|
||||||
for (battlerId = 0; battlerId < gBattlersCount; battlerId++)
|
for (battlerId = 0; battlerId < gBattlersCount; battlerId++)
|
||||||
{
|
{
|
||||||
gLastUsedItem = gBattleMons[battlerId].item;
|
gLastUsedItem = gBattleMons[battlerId].item;
|
||||||
battlerHoldEffect = GetBattlerHoldEffect(battlerId, TRUE);
|
battlerHoldEffect = GetBattlerHoldEffect(battlerId, TRUE);
|
||||||
|
DO_ITEMEFFECT_MOVE_END:
|
||||||
switch (battlerHoldEffect)
|
switch (battlerHoldEffect)
|
||||||
{
|
{
|
||||||
case HOLD_EFFECT_MICLE_BERRY:
|
case HOLD_EFFECT_MICLE_BERRY:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user