diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 504896d63d..d470fc1b61 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7688,3 +7688,10 @@ BattleScript_PrintPlayerForfeitedLinkBattle:: atk57 waitmessage 0x40 end2 + +BattleScript_Pickpocket:: + call BattleScript_AbilityPopUp + swapattackerwithtarget + seteffectsecondary + swapattackerwithtarget + return diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 84a7ba2ef8..1ff245d290 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -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 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d0811e77de..d721a91023 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -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 diff --git a/src/battle_util.c b/src/battle_util.c index d23e85542a..3f9dd81ece 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -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