public CombatActor(string name) { Name = name; DamageCausedStats = new DamageCausedStats(); ParryCounts = new Parry(); TargetPreferenceCounts = new TargetPreference(); EvadedCounts = new Evasion(); }
string BuildDamageStats(DamageCausedStats damageCausedStats) { var aggregation = damageCausedStats.Attacks.GroupBy(attack => new { attack.Damage, attack.AttackType }) .Select(attacks => new { DamageCaused = attacks.Key.Damage, DamageType = attacks.Key.AttackType, AttackStrength = string.Join(", ", attacks.GroupBy(attack => attack.Strength) .Select( grouping => grouping.Key + " x" + grouping.Count())) }); return(string.Join(Environment.NewLine, aggregation.Select( arg => string.Format("{0}: {1} ({2})", arg.DamageCaused, arg.AttackStrength, arg.DamageType)))); }