示例#1
0
 private void SetTargets(JsonLog log)
 {
     log.targets = new List <JsonTarget>();
     foreach (Target target in _log.FightData.Logic.Targets)
     {
         JsonTarget jsTarget = new JsonTarget
         {
             id                  = target.ID,
             name                = target.Character,
             totalHealth         = target.Health,
             avgBoons            = _statistics.AvgTargetBoons[target],
             avgConditions       = _statistics.AvgTargetConditions[target],
             dps                 = BuildDPS(_statistics.TargetDps[target]),
             buffs               = BuildTargetBuffs(_statistics.TargetBuffs[target], target),
             hitboxHeight        = target.HitboxHeight,
             hitboxWidth         = target.HitboxWidth,
             damage1S            = BuildTotal1SDamage(target),
             rotation            = BuildRotation(target.GetCastLogs(_log, 0, _log.FightData.FightDuration)),
             firstAware          = (int)(_log.FightData.ToFightSpace(target.FirstAware)),
             lastAware           = (int)(_log.FightData.ToFightSpace(target.LastAware)),
             minions             = BuildMinions(target),
             totalDamageDist     = BuildDamageDist(target, null),
             totalDamageTaken    = BuildDamageTaken(target),
             avgBoonsStates      = BuildBuffStates(target.GetBoonGraphs(_log)[Boon.NumberOfBoonsID]),
             avgConditionsStates = BuildBuffStates(target.GetBoonGraphs(_log)[Boon.NumberOfConditionsID])
         };
         int finalTargetHealth = target.HealthOverTime.Count > 0
             ? target.HealthOverTime.Last().Y
             : 10000;
         jsTarget.finalHealth         = target.Health * (finalTargetHealth * 0.01);
         jsTarget.healthPercentBurned = 100.0 - finalTargetHealth * 0.01;
         log.targets.Add(jsTarget);
     }
 }
示例#2
0
        public void jsonTest()
        {
            JsonTarget target = new JsonTarget()
            {
                i = 1
            };
            string json = target.ToJson();

            Debug.Log(json);
            //object obj = BsonSerializer.Deserialize(json);
            //Debug.Log(obj + ",Type:" + obj.GetType().Name);
            //Assert.True(obj is JsonTarget t && t.i == 1);
        }
示例#3
0
 private void SetTargets(JsonLog log)
 {
     log.Targets = new List <JsonTarget>();
     foreach (Target target in _log.FightData.Logic.Targets)
     {
         JsonTarget jsTarget = new JsonTarget
         {
             Id               = target.ID,
             Name             = target.Character,
             Toughness        = target.Toughness,
             Healing          = target.Healing,
             Concentration    = target.Concentration,
             Condition        = target.Condition,
             TotalHealth      = target.GetHealth(_log.CombatData),
             AvgBoons         = target.GetAverageBoons(_log),
             AvgConditions    = target.GetAverageConditions(_log),
             DpsAll           = target.GetDPSAll(_log).Select(x => new JsonDPS(x)).ToArray(),
             Buffs            = BuildTargetBuffs(target.GetBuffs(_log), target),
             HitboxHeight     = target.HitboxHeight,
             HitboxWidth      = target.HitboxWidth,
             Damage1S         = BuildTotal1SDamage(target),
             Rotation         = BuildRotation(target.GetCastLogs(_log, 0, _log.FightData.FightDuration)),
             FirstAware       = (int)(_log.FightData.ToFightSpace(target.FirstAwareLogTime)),
             LastAware        = (int)(_log.FightData.ToFightSpace(target.LastAwareLogTime)),
             Minions          = BuildMinions(target),
             TotalDamageDist  = BuildDamageDist(target, null),
             TotalDamageTaken = BuildDamageTaken(target),
             BoonsStates      = BuildBuffStates(target.GetBoonGraphs(_log)[ProfHelper.NumberOfBoonsID]),
             ConditionsStates = BuildBuffStates(target.GetBoonGraphs(_log)[ProfHelper.NumberOfConditionsID]),
             HealthPercents   = _log.CombatData.GetHealthUpdateEvents(target.AgentItem).Select(x => new double[2] {
                 x.Time, x.HPPercent
             }).ToList()
         };
         double hpLeft = 0.0;
         if (_log.FightData.Success)
         {
             hpLeft = 0;
         }
         else
         {
             List <HealthUpdateEvent> hpUpdates = _log.CombatData.GetHealthUpdateEvents(target.AgentItem);
             if (hpUpdates.Count > 0)
             {
                 hpLeft = hpUpdates.Last().HPPercent;
             }
         }
         jsTarget.HealthPercentBurned = 100.0 - hpLeft;
         jsTarget.FinalHealth         = (int)Math.Round(target.GetHealth(_log.CombatData) * hpLeft / 100.0);
         log.Targets.Add(jsTarget);
     }
 }
示例#4
0
 private void SetTargets(JsonLog log)
 {
     log.Targets = new List <JsonTarget>();
     foreach (Target target in _log.FightData.Logic.Targets)
     {
         JsonTarget jsTarget = new JsonTarget
         {
             Id               = target.ID,
             Name             = target.Character,
             Toughness        = target.Toughness,
             Healing          = target.Healing,
             Concentration    = target.Concentration,
             Condition        = target.Condition,
             TotalHealth      = target.Health,
             AvgBoons         = target.GetAverageBoons(_log),
             AvgConditions    = target.GetAverageConditions(_log),
             DpsAll           = target.GetDPSAll(_log).Select(x => new JsonDPS(x)).ToArray(),
             Buffs            = BuildTargetBuffs(target.GetBuffs(_log), target),
             HitboxHeight     = target.HitboxHeight,
             HitboxWidth      = target.HitboxWidth,
             Damage1S         = BuildTotal1SDamage(target),
             Rotation         = BuildRotation(target.GetCastLogs(_log, 0, _log.FightData.FightDuration)),
             FirstAware       = (int)(_log.FightData.ToFightSpace(target.FirstAware)),
             LastAware        = (int)(_log.FightData.ToFightSpace(target.LastAware)),
             Minions          = BuildMinions(target),
             TotalDamageDist  = BuildDamageDist(target, null),
             TotalDamageTaken = BuildDamageTaken(target),
             BoonsStates      = BuildBuffStates(target.GetBoonGraphs(_log)[Boon.NumberOfBoonsID]),
             ConditionsStates = BuildBuffStates(target.GetBoonGraphs(_log)[Boon.NumberOfConditionsID])
         };
         int finalTargetHealth = target.HealthOverTime.Count > 0
             ? target.HealthOverTime.Last().hp
             : 10000;
         jsTarget.FinalHealth         = (int)Math.Round(target.Health * (finalTargetHealth * 0.01));
         jsTarget.HealthPercentBurned = 100.0 - finalTargetHealth * 0.01;
         log.Targets.Add(jsTarget);
     }
 }