
using Godot;

[GlobalClass] [Tool]
public partial class FloatModifiers : Resource
{
    [Export] private float flat_value;
    [Export] private float percentage_value;
    [Export] private float mult_value;

    public static FloatModifiers Instantiate(float flat = 0.0f, float per = 0.0f, float mult = 1.0f)
    {
        FloatModifiers mod = new()
        {
            flat_value = flat,
            percentage_value = per,
            mult_value = mult
        };
        mod.ResourceLocalToScene = true;
        return mod;
    }

    public float GetValue() => flat_value * mult_value * (1.0f + percentage_value);

    public float GetFlat() => flat_value;

    public float GetPercentage() => percentage_value;

    public float GetMult() => mult_value;

    public void SetFlat(float value)
    {
        flat_value = value;
    }

    public void SetPercentage(float value)
    {
        percentage_value = value;
    }

    public void SetMult(float value)
    {
        mult_value = value;
    }

    public void ChangeFlat(float amount)
    {
        flat_value += amount;
    }

    public void ChangePercentage(float amount)
    {
        percentage_value += amount;
    }

    public void ChangeMult(float amount)
    {
        mult_value *= amount;
    }
}
