public void RemoveFinalBonus(CFinalBonus bonus) { if (_finalBonuses.ContainsKey(bonus.Name)) { _finalBonuses.Remove(bonus.Name); } }
public void AddFinalBonus(CFinalBonus bonus) { if (!_finalBonuses.ContainsKey(bonus.Name)) { _finalBonuses.Add(bonus.Name, bonus); } }
public void SetOrAddFinalBonus(CFinalBonus bonus) { if (!_finalBonuses.ContainsKey(bonus.Name)) { _finalBonuses.Add(bonus.Name, bonus); } else { _finalBonuses[bonus.Name] = new CFinalBonus(bonus.Name, bonus.BaseValue, bonus.BaseMultiplier); } }
protected void ApplyFinalBonuses() { // Adding value from final float finalBonusValue = 0; float finalBonusMultiplier = 0; foreach (KeyValuePair <string, CFinalBonus> kvp in _finalBonuses) { CFinalBonus bonus = kvp.Value; finalBonusValue += bonus.BaseValue; finalBonusMultiplier += bonus.BaseMultiplier; } _finalValue += finalBonusValue; _finalValue *= (1 + finalBonusMultiplier); }