namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "covet")]
public class Covet : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        if (target.HeldItem == null)
            return;
        if (move.User.HeldItem is not null)
            return;
        if (!target.TryStealHeldItem(out var item))
            return;
        _ = move.User.ForceSetHeldItem(item);
    }
}