namespace PkmnLib.Plugin.Gen7.Scripts.Items.Pokeballs;

[ItemScript("timer_ball")]
public class TimerBall : PokeballScript
{
    /// <inheritdoc />
    public TimerBall(IItem item) : base(item)
    {
    }

    /// <inheritdoc />
    public override void ChangeCatchRate(IPokemon target, ref byte catchRate)
    {
        var battleData = target.BattleData;
        if (battleData is null)
            return;

        var turns = battleData.Battle.CurrentTurnNumber;
        var modifier = 1 + turns * (1229 / 4096f);
        if (modifier > 4f)
            modifier = 4f;
        catchRate = catchRate.MultiplyOrMax(modifier);
    }
}