LLib/Gear/EquipmentStats.cs

34 lines
889 B
C#
Raw Normal View History

2024-11-21 23:28:38 +00:00
using System.Collections.Generic;
using System.Linq;
namespace LLib.Gear;
public sealed record EquipmentStats(Dictionary<EBaseParam, StatInfo> Stats, byte MateriaCount)
{
public short Get(EBaseParam param)
{
return (short)(GetEquipment(param) + GetMateria(param));
}
public short GetEquipment(EBaseParam param)
{
Stats.TryGetValue(param, out StatInfo? v);
return v?.EquipmentValue ?? 0;
}
public short GetMateria(EBaseParam param)
{
Stats.TryGetValue(param, out StatInfo? v);
return v?.MateriaValue ?? 0;
}
public bool IsOvercapped(EBaseParam param)
{
Stats.TryGetValue(param, out StatInfo? v);
return v?.Overcapped ?? false;
}
public bool Has(EBaseParam substat) => Stats.ContainsKey(substat);
public bool HasMateria() => Stats.Values.Any(x => x.MateriaValue > 0);
}