using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public struct Attribute
{
public long Base;
public Attribute(long stat) { Base = stat; }
///
/// Calculates the stat value with accumulated buff and debuff modifiers.
///
/// (base + baseBonus) * (100% + permyriadBonus) + flatBonus, bounded below by 0.
public long Calc(EffectSO effect)
{
var r = Base + effect.Base;
var m = effect.Permyriad + 10000;
r = r * (m / 10000) + (r / 10000) * (m % 10000) + effect.Flat;
if (r <= 0)
{
return 0;
}
return r;
}
}