namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

[Script(ScriptCategory.Pokemon, "embargo")]
public class EmbargoEffect : Script, IScriptOnEndTurn, IScriptStack, IScriptPreventHeldItemConsume
{
    private int _turns = 5;

    /// <inheritdoc />
    public void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
    {
        prevented = true;
    }

    /// <inheritdoc />
    public void Stack()
    {
        _turns = 5;
    }

    /// <inheritdoc />
    public void OnEndTurn(IScriptSource owner, IBattle battle)
    {
        _turns--;
        if (_turns == 0)
        {
            RemoveSelf();
        }
    }
}