add pickpocket

This commit is contained in:
Evan 2020-11-11 18:08:46 -07:00
parent 0912577ea1
commit 520f00f4ae
4 changed files with 28 additions and 1 deletions

View file

@ -7688,3 +7688,10 @@ BattleScript_PrintPlayerForfeitedLinkBattle::
atk57
waitmessage 0x40
end2
BattleScript_Pickpocket::
call BattleScript_AbilityPopUp
swapattackerwithtarget
seteffectsecondary
swapattackerwithtarget
return

View file

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

View file

@ -2931,7 +2931,8 @@ void SetMoveEffect(bool32 primary, u32 certain)
}
side = GetBattlerSide(gBattlerAttacker);
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT
if (gLastUsedAbility != ABILITY_PICKPOCKET //we need to swap attacker and target so this check otherwise fails
&& GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT
&& !(gBattleTypeFlags &
(BATTLE_TYPE_EREADER_TRAINER
| BATTLE_TYPE_FRONTIER

View file

@ -4518,6 +4518,24 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
effect++;
}
break;
case ABILITY_PICKPOCKET:
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& IsBattlerAlive(gBattlerAttacker)
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
&& (gBattleMoves[move].flags & FLAG_MAKES_CONTACT)
&& TARGET_TURN_DAMAGED
&& IsBattlerAlive(gBattlerTarget)
&& gBattleMons[gBattlerAttacker].item != ITEM_NONE
&& gBattleMons[gBattlerTarget].item == ITEM_NONE
&& GetBattlerAbility(gBattlerAttacker) != ABILITY_STICKY_HOLD)
{
gBattleScripting.moveEffect = MOVE_EFFECT_STEAL_ITEM;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_Pickpocket;
gHitMarker |= HITMARKER_IGNORE_SAFEGUARD;
effect++;
}
break;
}
break;
case ABILITYEFFECT_MOVE_END_ATTACKER: // Same as above, but for attacker