public static JsonMinions BuildJsonMinions(Minions minions, ParsedEvtcLog log, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            var jsonMinions = new JsonMinions();
            IReadOnlyList <PhaseData> phases = log.FightData.GetNonDummyPhases(log);
            bool isNPCMinion = minions.Master is NPC;

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

            foreach (PhaseData phase in phases)
            {
                int tot    = 0;
                int shdTot = 0;
                foreach (AbstractHealthDamageEvent de in minions.GetDamageEvents(null, log, phase.Start, phase.End))
                {
                    tot   += de.HealthDamage;
                    shdTot = de.ShieldDamage;
                }
                totalDamage.Add(tot);
                totalShieldDamage.Add(shdTot);
                totalBreakbarDamage.Add(Math.Round(minions.GetBreakbarDamageEvents(null, log, phase.Start, phase.End).Sum(x => x.BreakbarDamage), 1));
            }
            jsonMinions.TotalDamage         = totalDamage;
            jsonMinions.TotalShieldDamage   = totalShieldDamage;
            jsonMinions.TotalBreakbarDamage = totalBreakbarDamage;
            if (!isNPCMinion)
            {
                var totalTargetDamage         = new IReadOnlyList <int> [log.FightData.Logic.Targets.Count];
                var totalTargetShieldDamage   = new IReadOnlyList <int> [log.FightData.Logic.Targets.Count];
                var totalTargetBreakbarDamage = new IReadOnlyList <double> [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>();
                    var totalTarBreakbarDamage = new List <double>();
                    foreach (PhaseData phase in phases)
                    {
                        int tot    = 0;
                        int shdTot = 0;
                        foreach (AbstractHealthDamageEvent de in minions.GetDamageEvents(tar, log, phase.Start, phase.End))
                        {
                            tot   += de.HealthDamage;
                            shdTot = de.ShieldDamage;
                        }
                        totalTarDamage.Add(tot);
                        totalTarShieldDamage.Add(shdTot);
                        totalTarBreakbarDamage.Add(Math.Round(minions.GetBreakbarDamageEvents(tar, log, phase.Start, phase.End).Sum(x => x.BreakbarDamage), 1));
                    }
                    totalTargetDamage[i]         = totalTarDamage;
                    totalTargetShieldDamage[i]   = totalTarShieldDamage;
                    totalTargetBreakbarDamage[i] = totalTarBreakbarDamage;
                }
                jsonMinions.TotalTargetShieldDamage   = totalTargetShieldDamage;
                jsonMinions.TotalTargetDamage         = totalTargetDamage;
                jsonMinions.TotalTargetBreakbarDamage = totalTargetBreakbarDamage;
            }
            //
            var skillByID = minions.GetIntersectingCastEvents(log, 0, log.FightData.FightEnd).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());

            if (skillByID.Any())
            {
                jsonMinions.Rotation = JsonRotationBuilder.BuildJsonRotationList(log, skillByID, skillDesc);
            }
            //
            var totalDamageDist = new IReadOnlyList <JsonDamageDist> [phases.Count];

            for (int i = 0; i < phases.Count; i++)
            {
                PhaseData phase = phases[i];
                totalDamageDist[i] = JsonDamageDistBuilder.BuildJsonDamageDistList(minions.GetDamageEvents(null, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc);
            }
            jsonMinions.TotalDamageDist = totalDamageDist;
            if (!isNPCMinion)
            {
                var targetDamageDist = new IReadOnlyList <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 IReadOnlyList <JsonDamageDist> [phases.Count];
                    for (int j = 0; j < phases.Count; j++)
                    {
                        PhaseData phase = phases[j];
                        targetDamageDist[i][j] = JsonDamageDistBuilder.BuildJsonDamageDistList(minions.GetDamageEvents(target, log, phase.Start, phase.End).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList()), log, skillDesc, buffDesc);
                    }
                }
                jsonMinions.TargetDamageDist = targetDamageDist;
            }
            return(jsonMinions);
        }
        public static void FillJsonActor(JsonActor jsonActor, AbstractSingleActor actor, ParsedEvtcLog log, RawFormatSettings settings, Dictionary <string, JsonLog.SkillDesc> skillDesc, Dictionary <string, JsonLog.BuffDesc> buffDesc)
        {
            IReadOnlyList <PhaseData> phases = log.FightData.GetNonDummyPhases(log);

            //
            jsonActor.Name          = actor.Character;
            jsonActor.TotalHealth   = actor.GetHealth(log.CombatData);
            jsonActor.Toughness     = actor.Toughness;
            jsonActor.Healing       = actor.Healing;
            jsonActor.Concentration = actor.Concentration;
            jsonActor.Condition     = actor.Condition;
            jsonActor.HitboxHeight  = actor.HitboxHeight;
            jsonActor.HitboxWidth   = actor.HitboxWidth;
            jsonActor.InstanceID    = actor.AgentItem.InstID;
            jsonActor.IsFake        = actor.IsFakeActor;
            //
            jsonActor.DpsAll   = phases.Select(phase => JsonStatisticsBuilder.BuildJsonDPS(actor.GetDPSStats(log, phase.Start, phase.End))).ToArray();
            jsonActor.StatsAll = phases.Select(phase => JsonStatisticsBuilder.BuildJsonGameplayStatsAll(actor.GetGameplayStats(log, phase.Start, phase.End))).ToArray();
            jsonActor.Defenses = phases.Select(phase => JsonStatisticsBuilder.BuildJsonDefensesAll(actor.GetDefenseStats(log, phase.Start, phase.End))).ToArray();
            //
            IReadOnlyDictionary <long, Minions> minionsList = actor.GetMinions(log);

            if (minionsList.Values.Any())
            {
                jsonActor.Minions = minionsList.Values.Select(x => JsonMinionsBuilder.BuildJsonMinions(x, log, skillDesc, buffDesc)).ToList();
            }
            //
            var skillByID = actor.GetIntersectingCastEvents(log, 0, log.FightData.FightEnd).GroupBy(x => x.SkillId).ToDictionary(x => x.Key, x => x.ToList());

            if (skillByID.Any())
            {
                jsonActor.Rotation = JsonRotationBuilder.BuildJsonRotationList(log, skillByID, skillDesc);
            }
            //
            if (settings.RawFormatTimelineArrays)
            {
                var damage1S          = new IReadOnlyList <int> [phases.Count];
                var powerDamage1S     = new IReadOnlyList <int> [phases.Count];
                var conditionDamage1S = new IReadOnlyList <int> [phases.Count];
                var breakbarDamage1S  = new IReadOnlyList <double> [phases.Count];
                for (int i = 0; i < phases.Count; i++)
                {
                    PhaseData phase = phases[i];
                    damage1S[i]          = actor.Get1SDamageList(log, phase.Start, phase.End, null, ParserHelper.DamageType.All);
                    powerDamage1S[i]     = actor.Get1SDamageList(log, phase.Start, phase.End, null, ParserHelper.DamageType.Power);
                    conditionDamage1S[i] = actor.Get1SDamageList(log, phase.Start, phase.End, null, ParserHelper.DamageType.Condition);
                    breakbarDamage1S[i]  = actor.Get1SBreakbarDamageList(log, phase.Start, phase.End, null);
                }
                jsonActor.Damage1S          = damage1S;
                jsonActor.PowerDamage1S     = powerDamage1S;
                jsonActor.ConditionDamage1S = conditionDamage1S;
                jsonActor.BreakbarDamage1S  = breakbarDamage1S;
            }
            if (!log.CombatData.HasBreakbarDamageData)
            {
                jsonActor.BreakbarDamage1S = null;
            }
            //
            jsonActor.TotalDamageDist  = BuildDamageDistData(actor, phases, log, skillDesc, buffDesc);
            jsonActor.TotalDamageTaken = BuildDamageTakenDistData(actor, phases, log, skillDesc, buffDesc);
            //
            if (settings.RawFormatTimelineArrays)
            {
                Dictionary <long, BuffsGraphModel> buffGraphs = actor.GetBuffGraphs(log);
                jsonActor.BoonsStates      = JsonBuffsUptimeBuilder.GetBuffStates(buffGraphs[Buff.NumberOfBoonsID]);
                jsonActor.ConditionsStates = JsonBuffsUptimeBuilder.GetBuffStates(buffGraphs[Buff.NumberOfConditionsID]);
                if (buffGraphs.TryGetValue(Buff.NumberOfActiveCombatMinionsID, out BuffsGraphModel states))
                {
                    jsonActor.ActiveCombatMinions = JsonBuffsUptimeBuilder.GetBuffStates(states);
                }
                // Health
                jsonActor.HealthPercents = actor.GetHealthUpdates(log).Select(x => new double[2] {
                    x.Start, x.Value
                }).ToList();
                jsonActor.BarrierPercents = actor.GetBarrierUpdates(log).Select(x => new double[2] {
                    x.Start, x.Value
                }).ToList();
            }
            if (log.CanCombatReplay)
            {
                jsonActor.CombatReplayData = JsonActorCombatReplayDataBuilder.BuildJsonActorCombatReplayDataBuilder(actor, log, settings);
            }
        }