using System.Collections; namespace Milimoe.FunGame.Core.Entity { public class UserStatistics { /** * Key为赛季(long),每个key代表第key赛季,key = 0时为生涯数据。 */ public int Id { get; set; } public User User { get; set; } = new User(); public Dictionary DamageStats { get; set; } = new Dictionary(); public Dictionary PhysicalDamageStats { get; set; } = new Dictionary(); public Dictionary MagicDamageStats { get; set; } = new Dictionary(); public Dictionary RealDamageStats { get; set; } = new Dictionary(); public Dictionary AvgDamageStats { get { Dictionary avgdamage = new Dictionary(); foreach (long key in Plays.Keys) { long plays = Plays[key]; decimal total = 0; if (DamageStats.ContainsKey(key)) { total = DamageStats.Values.Sum(); } avgdamage.Add(key, total / plays); } return avgdamage; } } public Dictionary AvgPhysicalDamageStats { get { Dictionary avgdamage = new Dictionary(); foreach (long key in Plays.Keys) { long plays = Plays[key]; decimal total = 0; if (PhysicalDamageStats.ContainsKey(key)) { total = PhysicalDamageStats.Values.Sum(); } avgdamage.Add(key, total / plays); } return avgdamage; } } public Dictionary AvgMagicDamageStats { get { Dictionary avgdamage = new Dictionary(); foreach (long key in Plays.Keys) { long plays = Plays[key]; decimal total = 0; if (MagicDamageStats.ContainsKey(key)) { total = MagicDamageStats.Values.Sum(); } avgdamage.Add(key, total / plays); } return avgdamage; } } public Dictionary AvgRealDamageStats { get { Dictionary avgdamage = new Dictionary(); foreach (long key in Plays.Keys) { long plays = Plays[key]; decimal total = 0; if (RealDamageStats.ContainsKey(key)) { total = RealDamageStats.Values.Sum(); } avgdamage.Add(key, total / plays); } return avgdamage; } } public Dictionary Kills { get; set; } = new Dictionary(); public Dictionary Deaths { get; set; } = new Dictionary(); public Dictionary Assists { get; set; } = new Dictionary(); public Dictionary Plays { get; set; } = new Dictionary(); public Dictionary Wins { get; set; } = new Dictionary(); public Dictionary Loses { get; set; } = new Dictionary(); public Dictionary Winrates { get { Dictionary winrates = new Dictionary(); foreach (long key in Plays.Keys) { long plays = Plays[key]; long wins = 0; if (Wins.ContainsKey(key)) { wins = Wins[key]; } winrates.Add(key, wins / plays * 0.01M); } return winrates; } } public Dictionary RatingStats { get; set; } = new Dictionary(); public Dictionary EloStats { get; set; } = new Dictionary(); public Dictionary RankStats { get; set; } = new Dictionary(); } }