Ejemplo n.º 1
0
        private static DmgDistributionDto BuildDMGDistDataMinionsInternal(ParsedEvtcLog log, FinalDPS dps, Minions minions, NPC target, int phaseIndex, Dictionary <long, SkillItem> usedSkills, Dictionary <long, Buff> usedBuffs)
        {
            var       dto   = new DmgDistributionDto();
            PhaseData phase = log.FightData.GetPhases(log)[phaseIndex];
            List <AbstractCastEvent>   casting    = minions.GetIntersectingCastLogs(log, phase.Start, phase.End);
            List <AbstractDamageEvent> damageLogs = minions.GetDamageLogs(target, log, phase.Start, phase.End);

            dto.ContributedDamage       = damageLogs.Count > 0 ? damageLogs.Sum(x => x.Damage) : 0;
            dto.ContributedShieldDamage = damageLogs.Count > 0 ? damageLogs.Sum(x => x.ShieldDamage) : 0;
            dto.TotalDamage             = dps.Damage;
            dto.TotalCasting            = casting.Sum(cl => Math.Min(cl.EndTime, phase.End) - Math.Max(cl.Time, phase.Start));
            dto.Distribution            = BuildDMGDistBodyData(log, casting, damageLogs, usedSkills, usedBuffs, phaseIndex);
            return(dto);
        }
        internal JsonMinions(Minions minions, ParsedEvtcLog log, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            List <PhaseData> phases      = log.FightData.GetPhases(log);
            bool             isNPCMinion = minions.Master is NPC;

            //
            Name = minions.Character;
            //
            var totalDamage       = new List <int>();
            var totalShieldDamage = new List <int>();

            foreach (PhaseData phase in phases)
            {
                int tot    = 0;
                int shdTot = 0;
                foreach (AbstractDamageEvent de in minions.GetDamageLogs(null, log, phase.Start, phase.End))
                {
                    tot   += de.Damage;
                    shdTot = de.ShieldDamage;
                }
                totalDamage.Add(tot);
                totalShieldDamage.Add(shdTot);
            }
            TotalDamage       = totalDamage;
            TotalShieldDamage = totalShieldDamage;
            if (!isNPCMinion)
            {
                var totalTargetDamage       = new List <int> [log.FightData.Logic.Targets.Count];
                var totalTargetShieldDamage = new List <int> [log.FightData.Logic.Targets.Count];
                for (int i = 0; i < log.FightData.Logic.Targets.Count; i++)
                {
                    NPC tar                  = log.FightData.Logic.Targets[i];
                    var totalTarDamage       = new List <int>();
                    var totalTarShieldDamage = new List <int>();
                    foreach (PhaseData phase in phases)
                    {
                        int tot    = 0;
                        int shdTot = 0;
                        foreach (AbstractDamageEvent de in minions.GetDamageLogs(tar, log, phase.Start, phase.End))
                        {
                            tot   += de.Damage;
                            shdTot = de.ShieldDamage;
                        }
                        totalTarDamage.Add(tot);
                        totalTarShieldDamage.Add(shdTot);
                    }
                    totalTargetDamage[i]       = totalTarDamage;
                    totalTargetShieldDamage[i] = totalTarShieldDamage;
                }
                TotalTargetShieldDamage = totalTargetShieldDamage;
                TotalTargetDamage       = totalTargetDamage;
            }
            //
            var skillByID = minions.GetIntersectingCastLogs(log, 0, log.FightData.FightEnd).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());

            if (skillByID.Any())
            {
                Rotation = JsonRotation.BuildJsonRotationList(log, skillByID, skillDesc);
            }
            //
            TotalDamageDist = new List <JsonDamageDist> [phases.Count];
            for (int i = 0; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                TotalDamageDist[i] = JsonDamageDist.BuildJsonDamageDistList(minions.GetDamageLogs(null, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc);
            }
            if (!isNPCMinion)
            {
                TargetDamageDist = new List <JsonDamageDist> [log.FightData.Logic.Targets.Count][];
                for (int i = 0; i < log.FightData.Logic.Targets.Count; i++)
                {
                    NPC target = log.FightData.Logic.Targets[i];
                    TargetDamageDist[i] = new List <JsonDamageDist> [phases.Count];
                    for (int j = 0; j < phases.Count; j++)
                    {
                        PhaseData phase = phases[j];
                        TargetDamageDist[i][j] = JsonDamageDist.BuildJsonDamageDistList(minions.GetDamageLogs(target, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc);
                    }
                }
            }
        }