private void CallChangedAll(Trait trait)
 {
     foreach (var item in trait.UsedAttributs())
     {
         AttributeChanged(this, item);
     }
     foreach (var item in trait.UsedValues())
     {
         ValueChanged(this, item);
     }
     foreach (var item in trait.UsedResources())
     {
         ResourceChanged(this, item);
     }
     foreach (var item in trait.GetTawBonus())
     {
         TaWChanged?.Invoke(this, item.Key);
     }
     foreach (var item in trait.GetATBonus())
     {
         ATChanged?.Invoke(this, item.Key);
     }
     foreach (var item in trait.GetPABonus())
     {
         PAChanged?.Invoke(this, item.Key);
     }
     foreach (var item in trait.GetBLBonus())
     {
         BLChanged?.Invoke(this, item.Key);
     }
     APInvestChanged?.Invoke(this, GetAPInvested());
     APEarnedChanged?.Invoke(this, GetAPEarned());
 }
        public void AddTrait(Trait item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            if (!traits.Contains(item))
            {
                traits.Add(item);
            }
            item.AttributeChanged += (sender, args) =>
            {
                AttributeChanged?.Invoke(this, args);
            };
            item.ResourceChanged += (sender, args) =>
            {
                ResourceChanged?.Invoke(this, args);
            };
            item.ValueChanged += (sender, args) =>
            {
                ValueChanged?.Invoke(this, args);
            };
            item.TaWChanged += (sender, args) =>
            {
                TaWChanged?.Invoke(this, args);
            };
            item.ATChanged += (sender, args) =>
            {
                ATChanged?.Invoke(this, args);
            };
            item.PAChanged += (sender, args) =>
            {
                PAChanged?.Invoke(this, args);
            };
            item.APInvestChanged += (sender, args) =>
            {
                APInvestChanged?.Invoke(this, GetAPInvested());
            };
            item.APEarnedChanged += (sender, args) =>
            {
                APEarnedChanged?.Invoke(this, GetAPEarned());
            };

            CallChangedAll(item);
        }
        public void SetTAW(ITalent talent, int taw)
        {
            if (talent == null)
            {
                throw new ArgumentNullException(nameof(talent));
            }

            if (TAWDictionary.TryGetValue(talent, out int innerTAW))
            {
                TAWDictionary.Remove(talent);
            }
            TAWDictionary.Add(talent, taw);

            if (innerTAW != taw)
            {
                TaWChanged?.Invoke(this, talent);
            }
        }
        private void SetDeductionValue(TalentDeductionTalent deduction, bool add)
        {
            var value = -1;

            if (add)
            {
                value = 1;
            }

            var talent       = deduction.Talent;
            var currentValue = GetDeductionValue(deduction.Talent) + value;

            if (deductionDictionary.ContainsKey(talent))
            {
                deductionDictionary.Remove(talent);
            }
            deductionDictionary.Add(talent, currentValue);


            TaWChanged?.Invoke(this, talent);
        }