namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "one_hit_ko")]
public class OneHitKo : Script, IScriptChangeMoveDamage, IScriptChangeAccuracy
{
    /// <inheritdoc />
    public void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref int modifiedAccuracy)
    {
        var levelDifference = executingMove.User.Level - target.Level;
        if (levelDifference < 0)
        {
            executingMove.GetHitData(target, hitIndex).Fail();
            return;
        }
        modifiedAccuracy = 30 + levelDifference;
    }

    /// <inheritdoc />
    public void ChangeMoveDamage(IExecutingMove move, IPokemon target, byte hit, ref uint damage)
    {
        damage = target.BoostedStats.Hp.MultiplyOrMax(10);
    }
}