using PkmnLib.Plugin.Gen7.Scripts.Pokemon;

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "mean_look")]
public class MeanLook : Script, IScriptOnSecondaryEffect
{
    /// <inheritdoc />
    public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
    {
        var targetEffect = target.Volatile.Add(new MeanLookEffectTarget());
        if (targetEffect == null)
        {
            move.GetHitData(target, hit).Fail();
            return;
        }
        var userEffect = new MeanLookEffectUser(targetEffect);
        move.User.Volatile.Add(userEffect);
    }
}