예제 #1
0
파일: Report.cs 프로젝트: nemesv/swlsimNET
        private void SpellTypeReport(SpellType spellType)
        {
            var dSpells = _distinctSpellCast.Where(s => s.SpellType == spellType).ToList();

            if (!dSpells.Any())
            {
                return;
            }

            foreach (var dSpell in dSpells)
            {
                var allOfSameSpellDatas = _allSpellCast.Where(s => s.Spell.Name == dSpell.Name).ToList();
                var alldmg = allOfSameSpellDatas.Sum(s => s.Damage);
                var avgDmg = allOfSameSpellDatas.Average(s => s.Damage);
                var crits  = allOfSameSpellDatas.Count(s => s.IsCrit);
                var hits   = allOfSameSpellDatas.Count(s => s.IsHit);

                TotalSpellExecutes += hits / (double)_settings.Iterations;

                SpellBreakdownList.Add(new SpellResult
                {
                    Name       = dSpell.Name,
                    Dps        = Math.Round(alldmg / _settings.FightLength / _settings.Iterations, 2),
                    DpsPercent = Math.Round(alldmg / TotalDamage * 100, 2),
                    Dpe        = Math.Round(avgDmg, 2),
                    Executes   = Math.Round(hits / (double)_settings.Iterations, 2),
                    Ticks      = 0, // TODO: when implementing dot ticks / for channel ticks also?
                    CritChance = Math.Round(decimal.Divide(crits, hits) * 100, 2)
                });
            }
        }
예제 #2
0
        private void SpellTypeReport(SpellType spellType, string nameOverride = "")
        {
            var dSpells = _distinctSpellCast.Where(s => s.SpellType == spellType).ToList();

            if (!dSpells.Any())
            {
                return;
            }

            _twoBuilder.AppendLine(string.IsNullOrEmpty(nameOverride)
                ? $"\r\n----- {spellType} summary normalized per fight -----"
                : $"\r\n----- {nameOverride} summary normalized per fight -----");

            foreach (var dSpell in dSpells)
            {
                var allOfSameSpellDatas = _allSpellCast.Where(s => s.Spell.Name == dSpell.Name).ToList();
                var alldmg = allOfSameSpellDatas.Sum(s => s.Damage);
                var avgDmg = allOfSameSpellDatas.Average(s => s.Damage);
                var crits  = allOfSameSpellDatas.Count(s => s.IsCrit);
                var hits   = allOfSameSpellDatas.Count(s => s.IsHit);

                // Can't divide int with int, 4.9 will result in 4 etc, either print with decimal or do a correct rounding
                var avghits      = hits / (double)_settings.Iterations;
                var avgcrits     = crits / (double)_settings.Iterations;
                var cc           = decimal.Divide(crits, hits) * 100;
                var hdmg         = allOfSameSpellDatas.Max(s => s.Damage);
                var ldmg         = allOfSameSpellDatas.Where(s => s.IsHit).Min(s => s.Damage);
                var dmgPerSecond = alldmg / _settings.FightLength / _settings.Iterations;
                var executes     = (avghits + avgcrits);

                var ofTotal = alldmg / TotalDamage * 100;

                if (dSpell.BaseDamage == 0)
                {
                    _twoBuilder.AppendLine($"{ofTotal:0.0}% | {dSpell.Name}, hits: {avghits.ToString("#,0.0", nfi)}");
                }
                else
                {
                    _twoBuilder.AppendLine(
                        $"{ofTotal:0.0}% | {dSpell.Name}, dmg: {avgDmg.ToString("#,##0,.0K", nfi)}, " +
                        $"high: {hdmg.ToString("#,##0,.0K", nfi)}, low: {ldmg.ToString("#,##0,.0K", nfi)}," +
                        $" hits: {avghits.ToString("#,0.0", nfi)}, crits: {avgcrits.ToString("#,0.0", nfi)} ({cc:0.0}%)");
                }

                SpellBreakdownList.Add(new SpellResult
                {
                    Name               = dSpell.Name,
                    DamagePerSecond    = Math.Round(dmgPerSecond),
                    DpsPercentage      = ofTotal,
                    Executes           = executes,
                    DamagePerExecution = Math.Round(avgDmg),
                    SpellType          = string.IsNullOrWhiteSpace(nameOverride) ? dSpell.SpellType.ToString() : nameOverride,
                    Amount             = executes,
                    Average            = Math.Round(avgDmg),
                    CritChance         = cc
                });
            }
        }