namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "quash")]
public class Quash : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        var battleData = move.User.BattleData;
        if (battleData == null)
            return;

        if (battleData.Battle.ChoiceQueue?.MovePokemonChoiceLast(target) == false)
        {
            move.GetHitData(target, hit).Fail();
        }
    }
}