mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-02-23 20:55:30 +01:00
add back accidentally deleted item theft battle type checks
This commit is contained in:
parent
a05d8f7d43
commit
66152538ec
@ -133,5 +133,6 @@ u8 GetBattleMoveSplit(u32 moveId);
|
|||||||
void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
|
void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
|
||||||
bool32 TestSheerForceFlag(u8 battler, u16 move);
|
bool32 TestSheerForceFlag(u8 battler, u16 move);
|
||||||
void TryRestoreStolenItems(void);
|
void TryRestoreStolenItems(void);
|
||||||
|
bool8 CanStealItem(u8 battlerId, u16 item);
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_UTIL_H
|
#endif // GUARD_BATTLE_UTIL_H
|
||||||
|
@ -2951,7 +2951,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||||||
break;
|
break;
|
||||||
case MOVE_EFFECT_STEAL_ITEM:
|
case MOVE_EFFECT_STEAL_ITEM:
|
||||||
{
|
{
|
||||||
if (!CanBattlerGetOrLoseItem(gBattlerAttacker, gBattleMons[gBattlerTarget].item))
|
if (!CanStealItem(gBattlerAttacker, gBattleMons[gBattlerTarget].item))
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr++;
|
gBattlescriptCurrInstr++;
|
||||||
break;
|
break;
|
||||||
@ -5032,7 +5032,7 @@ static void Cmd_moveend(void)
|
|||||||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler) //subsitute unaffected
|
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler) //subsitute unaffected
|
||||||
&& IsBattlerAlive(battler) //battler must be alive to be pickpocketed
|
&& IsBattlerAlive(battler) //battler must be alive to be pickpocketed
|
||||||
&& gBattleMons[battler].item == ITEM_NONE //pickpocketer can't have an item already
|
&& gBattleMons[battler].item == ITEM_NONE //pickpocketer can't have an item already
|
||||||
&& CanBattlerGetOrLoseItem(battler, gBattleMons[gBattlerAttacker].item)) //cannot steal plates, mega stones, etc
|
&& CanStealItem(battler, gBattleMons[gBattlerAttacker].item)) //cannot steal plates, mega stones, etc
|
||||||
{
|
{
|
||||||
gBattlerTarget = gBattlerAbility = battler;
|
gBattlerTarget = gBattlerAbility = battler;
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
|
@ -7826,3 +7826,36 @@ void TryRestoreStolenItems(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool8 CanStealItem(u8 battlerId, u16 item)
|
||||||
|
{
|
||||||
|
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_HILL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT
|
||||||
|
&& !(gBattleTypeFlags &
|
||||||
|
(BATTLE_TYPE_EREADER_TRAINER
|
||||||
|
| BATTLE_TYPE_FRONTIER
|
||||||
|
| BATTLE_TYPE_LINK
|
||||||
|
| BATTLE_TYPE_x2000000
|
||||||
|
| BATTLE_TYPE_SECRET_BASE
|
||||||
|
#if B_TRAINERS_STEAL_ITEMS
|
||||||
|
| BATTLE_TYPE_TRAINER
|
||||||
|
#endif
|
||||||
|
)))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else if (!(gBattleTypeFlags &
|
||||||
|
(BATTLE_TYPE_EREADER_TRAINER
|
||||||
|
| BATTLE_TYPE_FRONTIER
|
||||||
|
| BATTLE_TYPE_LINK
|
||||||
|
| BATTLE_TYPE_x2000000
|
||||||
|
| BATTLE_TYPE_SECRET_BASE))
|
||||||
|
&& (gWishFutureKnock.knockedOffMons[GetBattlerSide(gBattlerAttacker)] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CanBattlerGetOrLoseItem(battlerId, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user