using PkmnLib.Plugin.Gen7.Scripts.Side;

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "wide_guard")]
public class WideGuard : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        if (move.Battle.ChoiceQueue?.HasNext() != true)
        {
            move.GetHitData(target, hit).Fail();
            return;
        }
        move.User.BattleData?.BattleSide.VolatileScripts.Add(new WideGuardEffect());
    }
}