using PkmnLib.Plugin.Gen7.Scripts.Pokemon;

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "pursuit")]
public class Pursuit : Script, IScriptOnBeforeTurnStart, IScriptOnAfterMove, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnBeforeTurnStart(ITurnChoice choice)
    {
        if (choice is IMoveChoice moveChoice)
            choice.User.Volatile.Add(new PursuitEffect(moveChoice));
    }

    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) =>
        move.User.Volatile.Remove<PursuitEffect>();

    /// <inheritdoc />
    public void OnAfterMove(IExecutingMove move) => move.User.Volatile.Remove<PursuitEffect>();
}