public void ApplyPassiveEffect(PassiveEffect talentEffect) { foreach (var ab in talentEffect.AttributeBuffs) { GetAttributeByID(ab.AttributeID).SkillValue += ab.Amount; } foreach (var stat in talentEffect.StatisticBuffs) { GetStatByID(stat.StatisticID).SkillValue += stat.Amount; } foreach (var vit in talentEffect.VitalBuffs) { GetVitalByID(vit.VitalID).SkillValue += vit.Amount; } //skillimmunity/sus if (talentEffect.AddSkillImmunity) { if (SkillMetaImmunitiesID.FirstOrDefault(s => s.ID == talentEffect.SkillImmunityID) == null) { SkillMetaImmunitiesID.Add(new SkillImmunity() { ID = talentEffect.SkillImmunityID }); } } if (talentEffect.AddSkillSusceptibility) { var existing = SkillMetaSusceptibilities.FirstOrDefault(s => s.ID == talentEffect.SkillSusceptibilityID); if (existing != null) { existing.AdditionalDamage += talentEffect.SkillSusceptibilityAmount; } else { var newSus = new SkillMetaSusceptibility { ID = talentEffect.SkillSusceptibilityID, AdditionalDamage = talentEffect.SkillSusceptibilityAmount }; SkillMetaSusceptibilities.Add(newSus); } } foreach (var regenBonus in talentEffect.VitalRegenBonuses) { var existing = VitalRegenBonuses.FirstOrDefault(s => s.VitalID == regenBonus.VitalID); if (existing != null) { existing.RegenBonus += regenBonus.RegenBonus; } else { var newSus = new VitalRegenBonus { VitalID = regenBonus.VitalID, RegenBonus = regenBonus.RegenBonus }; VitalRegenBonuses.Add(newSus); } } foreach (var statusReduc in talentEffect.StatusDurationReduction) { var existing = StatusReductions.FirstOrDefault(s => s.StatusEffectID == statusReduc.StatusEffectID && s.IsPercentageDecrease == statusReduc.IsPercentageDecrease); if (existing != null) { existing.DecreaseAmount += statusReduc.DecreaseAmount; } else { var newReduc = new ReduceStatusDuration { StatusEffectID = statusReduc.StatusEffectID, IsPercentageDecrease = statusReduc.IsPercentageDecrease, DecreaseAmount = statusReduc.DecreaseAmount }; StatusReductions.Add(newReduc); } } }
public void AddVitalRegenBonus(VitalRegenBonus vitalRegenBonus) { VitalRegenBonuses.Add(vitalRegenBonus); FullUpdateStats(); }