add back accidentally deleted item theft battle type checks
This commit is contained in:
parent
a05d8f7d43
commit
66152538ec
3 changed files with 36 additions and 2 deletions
|
@ -133,5 +133,6 @@ u8 GetBattleMoveSplit(u32 moveId);
|
|||
void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
|
||||
bool32 TestSheerForceFlag(u8 battler, u16 move);
|
||||
void TryRestoreStolenItems(void);
|
||||
bool8 CanStealItem(u8 battlerId, u16 item);
|
||||
|
||||
#endif // GUARD_BATTLE_UTIL_H
|
||||
|
|
|
@ -2951,7 +2951,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||
break;
|
||||
case MOVE_EFFECT_STEAL_ITEM:
|
||||
{
|
||||
if (!CanBattlerGetOrLoseItem(gBattlerAttacker, gBattleMons[gBattlerTarget].item))
|
||||
if (!CanStealItem(gBattlerAttacker, gBattleMons[gBattlerTarget].item))
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
break;
|
||||
|
@ -5032,7 +5032,7 @@ static void Cmd_moveend(void)
|
|||
&& !DoesSubstituteBlockMove(gCurrentMove, gBattlerAttacker, battler) //subsitute unaffected
|
||||
&& IsBattlerAlive(battler) //battler must be alive to be pickpocketed
|
||||
&& 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;
|
||||
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…
Reference in a new issue