public void RemoveRawBonus(CRawBonus bonus) { if (_rawBonuses.ContainsKey(bonus.Name)) { _rawBonuses.Remove(bonus.Name); } }
public void AddRawBonus(CRawBonus bonus) { if (!_rawBonuses.ContainsKey(bonus.Name)) { _rawBonuses.Add(bonus.Name, bonus); } }
public void SetOrAddRawBonus(CRawBonus bonus) { if (!_rawBonuses.ContainsKey(bonus.Name)) { _rawBonuses.Add(bonus.Name, bonus); } else { _rawBonuses[bonus.Name] = new CRawBonus(bonus.Name, bonus.BaseValue, bonus.BaseMultiplier); } }
protected void ApplyRawBonuses() { // Adding value from raw float rawBonusValue = 0; float rawBonusMultiplier = 0; foreach (KeyValuePair <string, CRawBonus> kvp in _rawBonuses) { CRawBonus bonus = kvp.Value; rawBonusValue += bonus.BaseValue; rawBonusMultiplier += bonus.BaseMultiplier; } _finalValue += rawBonusValue; _finalValue *= (1 + rawBonusMultiplier); }