Files

39 lines
1.5 KiB
C#
Raw Permalink Normal View History

2025-10-03 00:02:43 -04:00
using System.Collections.Generic;
using System.Linq;
using Continentis.MainGame.Equipment;
using UnityEngine;
namespace Continentis.MainGame.Character
{
public partial class EquipmentSubmodule : SubmoduleBase<CharacterBase>
{
public List<EquipmentBase> currentEquipments;
public EquipmentSubmodule(CharacterBase character) : base(character)
{
currentEquipments = new List<EquipmentBase>();
}
}
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<KeyValuePair<string, float>, float>(1, (current, change) => current * change.Value);
}
}
}