using PkmnLib.Plugin.Gen7.Scripts.Pokemon;

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "razor_wind")]
public class RazorWind : Script, IScriptPreventMove, IScriptChangeCriticalStage
{
    /// <inheritdoc />
    public void PreventMove(IExecutingMove move, ref bool prevent)
    {
        var chargeMoveEffect = move.User.Volatile.Get<ChargeMoveEffect>();
        if (chargeMoveEffect != null && chargeMoveEffect.MoveName == move.UseMove.Name)
            return;
        prevent = true;
        move.User.Volatile.Add(new ChargeMoveEffect(move.UseMove.Name, move.User, move.MoveChoice.TargetSide,
            move.MoveChoice.TargetPosition));
    }

    /// <inheritdoc />
    public void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
    {
        stage += 1;
    }
}