This commit is contained in:
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pickpocket.cs
Normal file
20
Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Pickpocket.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
|
||||
/// <summary>
|
||||
/// Pickpocket is an ability that steals an item from a Pokémon that makes contact.
|
||||
///
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Pickpocket_(Ability)">Bulbapedia - Pickpocket</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "pickpocket")]
|
||||
public class Pickpocket : Script
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.GetHitData(target, hit).IsContact && target.HeldItem is null && move.User.HeldItem is not null)
|
||||
{
|
||||
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(target));
|
||||
_ = target.SetHeldItem(move.User.RemoveHeldItemForBattle());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user