diff --git a/Entity/Statistics/GameStatistics.cs b/Entity/Statistics/GameStatistics.cs index 8bc6688..79fe591 100644 --- a/Entity/Statistics/GameStatistics.cs +++ b/Entity/Statistics/GameStatistics.cs @@ -12,10 +12,54 @@ namespace Milimoe.FunGame.Core.Entity public Dictionary PhysicalDamageStats { get; } = new(); public Dictionary MagicDamageStats { get; } = new(); public Dictionary RealDamageStats { get; } = new(); - public Dictionary AvgDamageStats { get; } = new(); - public Dictionary AvgPhysicalDamageStats { get; } = new(); - public Dictionary AvgMagicDamageStats { get; } = new(); - public Dictionary AvgRealDamageStats { get; } = new(); + public decimal AvgDamageStats + { + get + { + decimal total = 0; + foreach (User user in DamageStats.Keys) + { + total += DamageStats[user]; + } + return Math.Round(total / DamageStats.Count, 2); + } + } + public decimal AvgPhysicalDamageStats + { + get + { + decimal total = 0; + foreach (User user in PhysicalDamageStats.Keys) + { + total += PhysicalDamageStats[user]; + } + return Math.Round(total / PhysicalDamageStats.Count, 2); + } + } + public decimal AvgMagicDamageStats + { + get + { + decimal total = 0; + foreach (User user in MagicDamageStats.Keys) + { + total += MagicDamageStats[user]; + } + return Math.Round(total / MagicDamageStats.Count, 2); + } + } + public decimal AvgRealDamageStats + { + get + { + decimal total = 0; + foreach (User user in RealDamageStats.Keys) + { + total += RealDamageStats[user]; + } + return Math.Round(total / RealDamageStats.Count, 2); + } + } public Dictionary KillStats { get; } = new(); public Dictionary> KillDetailStats { get; } = new(); // 子字典记录的是被击杀者以及被击杀次数 public Dictionary DeathStats { get; } = new();