using PkmnLib.Plugin.Gen7.Scripts.Pokemon;

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

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

        if (battleData.Battle.Random.EffectChance(10, move, target, hit))
        {
            target.SetStatus("frozen", move.User);
        }
        if (battleData.Battle.Random.EffectChance(10, move, target, hit))
        {
            target.Volatile.Add(new FlinchEffect());
        }
    }
}