using UnityEngine;
[CreateAssetMenu(fileName = "StatEffect", menuName = "Stat Effect")]
public class EffectSO : ScriptableObject
{
///
/// Additive change applied before multiplicative scaling.
///
public long Base;
///
/// Multiplicative scaling in units of hundredth of a percent.
/// E.g., 625 permyriad is 6.25%.
///
public long Permyriad;
///
/// Additive change applied after multiplicative scaling.
///
public long Flat;
///
/// Create a new attribute effect instance.
///
///
///
///
///
public static EffectSO New(long baseBonus = 0, long permyriad = 0, long flat = 0)
{
var effect = ScriptableObject.CreateInstance();
effect.Base = baseBonus;
effect.Permyriad = permyriad;
effect.Flat = flat;
return effect;
}
///
/// Create a new EffectSO from a percentage.
///
/// Percentage. E.g., 6.25f results in a Permyriad of 625.
/// Effect with the given percentage.
public static EffectSO FromPercent(float p)
{
return New(permyriad: (long)(p * 100));
}
}