public override void AddBonus(uint bonusIndex, Bonus bonus) { var bonuses = Bonuses.ContainsKey(bonusIndex) ? Bonuses[bonusIndex] : new List <Bonus>(); bonuses.Add(bonus); Bonuses[bonusIndex] = bonuses; }
public int GetBonus(EquipableBonusType bonusType) { if (!Bonuses.ContainsKey(bonusType)) { return(0); } return(Bonuses[bonusType]); }
public override void RemoveBonus(uint bonusIndex, UnitAttribute attribute) { if (!Bonuses.ContainsKey(bonusIndex)) { return; } var bonuses = Bonuses[bonusIndex]; foreach (var bonus in new List <Bonus>(bonuses)) { if (bonus.Template != null && bonus.Template.Attribute == attribute) { bonuses.Remove(bonus); } } }