namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;

[Script(ScriptCategory.Pokemon, "flinch_effect")]
public class FlinchEffect : Script, IScriptPreventMove
{
    /// <inheritdoc />
    public void PreventMove(IExecutingMove move, ref bool prevent)
    {
        prevent = true;
        var args = new CustomTriggers.OnFlinchArgs(move);
        move.RunScriptHook<IScriptCustomTrigger>(x => x.CustomTrigger(CustomTriggers.OnFlinch, args));
        if (args.Prevent)
            return;

        RemoveSelf();
    }
}