using System.Collections.Generic; using System.Linq; using Continentis.MainGame.Equipment; using UnityEngine; namespace Continentis.MainGame.Character { public partial class EquipmentSubmodule : SubmoduleBase { public List currentEquipments; public EquipmentSubmodule(CharacterBase character) : base(character) { currentEquipments = new List(); } } public partial class EquipmentSubmodule { public void GetGeneralAttributeChange(string attributeName, out float numericChanges, out float percentageChangesOfAccumulation, out float percentChangesOfMultiplication) { numericChanges = currentEquipments .SelectMany(eq => eq.generalAttributeSubmodule.numericChange) .Where(change => change.Key == attributeName) .Sum(change => change.Value); percentageChangesOfAccumulation = currentEquipments .SelectMany(eq => eq.generalAttributeSubmodule.percentageChangeOfAccumulation) .Where(change => change.Key == attributeName) .Sum(change => change.Value); percentChangesOfMultiplication = currentEquipments .SelectMany(ew => ew.generalAttributeSubmodule.percentageChangeOfMultiplication) .Where(change => change.Key == attributeName) .Aggregate, float>(1, (current, change) => current * change.Value); } } }