Ejemplo n.º 1
0
 private Dictionary <string, DamageModifierStat> ComputeDamageModifierStats(AbstractSingleActor target, ParsedEvtcLog log, long start, long end)
 {
     // Check if damage mods against target
     if (_damageModifierEventsPerTargets.TryGetValue(0, log.FightData.FightEnd, target, out Dictionary <string, List <DamageModifierEvent> > events))
     {
         var res = new Dictionary <string, DamageModifierStat>();
         foreach (KeyValuePair <string, List <DamageModifierEvent> > pair in events)
         {
             DamageModifier damageMod = pair.Value.FirstOrDefault()?.DamageModifier;
             if (damageMod != null)
             {
                 var eventsToUse = pair.Value.Where(x => x.Time >= start && x.Time <= end).ToList();
                 int totalDamage = damageMod.GetTotalDamage(Actor, log, target, start, end);
                 IReadOnlyList <AbstractHealthDamageEvent> typeHits = damageMod.GetHitDamageEvents(Actor, log, target, start, end);
                 res[pair.Key] = new DamageModifierStat(eventsToUse.Count, typeHits.Count, eventsToUse.Sum(x => x.DamageGain), totalDamage);
             }
         }
         _damageModifiersPerTargets.Set(start, end, target, res);
         return(res);
     }
     // Check if we already filled the cache, that means no damage modifiers against given target
     else if (_damageModifierEventsPerTargets.TryGetValue(0, log.FightData.FightEnd, null, out events))
     {
         var res = new Dictionary <string, DamageModifierStat>();
         _damageModifiersPerTargets.Set(start, end, target, res);
         return(res);
     }
     return(null);
 }
 internal IReadOnlyList <AbstractHealthDamageEvent> GetConditionHitDamageEvents(AbstractActor target, ParsedEvtcLog log, long start, long end)
 {
     if (_conditionHitDamageEventsPerPhasePerTarget == null)
     {
         _conditionHitDamageEventsPerPhasePerTarget = new CachingCollectionWithTarget <List <AbstractHealthDamageEvent> >(log);
     }
     if (!_conditionHitDamageEventsPerPhasePerTarget.TryGetValue(start, end, target, out List <AbstractHealthDamageEvent> dls))
     {
         dls = GetHitDamageEvents(target, log, start, end).Where(x => x.ConditionDamageBased(log)).ToList();
         _conditionHitDamageEventsPerPhasePerTarget.Set(start, end, target, dls);
     }
     return(dls);
 }
Ejemplo n.º 3
0
 public FinalSupport GetSupportStats(AbstractSingleActor target, ParsedEvtcLog log, long start, long end)
 {
     if (_supportStats == null)
     {
         _supportStats = new CachingCollectionWithTarget <FinalSupport>(log);
     }
     if (!_supportStats.TryGetValue(start, end, target, out FinalSupport value))
     {
         value = target != null ? new FinalSupport(log, start, end, this, target) : new FinalSupportAll(log, start, end, this);
         _supportStats.Set(start, end, target, value);
     }
     return(value);
 }
Ejemplo n.º 4
0
 public FinalGameplayStats GetGameplayStats(AbstractSingleActor target, ParsedEvtcLog log, long start, long end)
 {
     if (_gameplayStats == null)
     {
         _gameplayStats = new CachingCollectionWithTarget <FinalGameplayStats>(log);
     }
     if (!_gameplayStats.TryGetValue(start, end, target, out FinalGameplayStats value))
     {
         value = target != null ? new FinalGameplayStats(log, start, end, this, target) : new FinalGameplayStatsAll(log, start, end, this);
         _gameplayStats.Set(start, end, target, value);
     }
     return(value);
 }
Ejemplo n.º 5
0
        // DPS Stats

        public FinalDPS GetDPSStats(AbstractSingleActor target, ParsedEvtcLog log, long start, long end)
        {
            if (_dpsStats == null)
            {
                _dpsStats = new CachingCollectionWithTarget <FinalDPS>(log);
            }
            if (!_dpsStats.TryGetValue(start, end, target, out FinalDPS value))
            {
                value = new FinalDPS(log, start, end, this, target);
                _dpsStats.Set(start, end, target, value);
            }
            return(value);
        }
Ejemplo n.º 6
0
 public FinalOffensiveStats GetOffensiveStats(AbstractSingleActor target, ParsedEvtcLog log, long start, long end)
 {
     if (_offensiveStats == null)
     {
         _offensiveStats = new CachingCollectionWithTarget <FinalOffensiveStats>(log);
     }
     if (!_offensiveStats.TryGetValue(start, end, target, out FinalOffensiveStats value))
     {
         value = new FinalOffensiveStats(log, start, end, this, target);
         _offensiveStats.Set(start, end, target, value);
     }
     return(value);
 }
Ejemplo n.º 7
0
        public IReadOnlyDictionary <string, DamageModifierStat> GetDamageModifierStats(AbstractSingleActor target, ParsedEvtcLog log, long start, long end)
        {
            if (!log.ParserSettings.ComputeDamageModifiers || Actor.IsFakeActor)
            {
                return(new Dictionary <string, DamageModifierStat>());
            }
            if (_damageModifiersPerTargets == null)
            {
                _damageModifiersPerTargets      = new CachingCollectionWithTarget <Dictionary <string, DamageModifierStat> >(log);
                _damageModifierEventsPerTargets = new CachingCollectionWithTarget <Dictionary <string, List <DamageModifierEvent> > >(log);
            }
            if (_damageModifiersPerTargets.TryGetValue(start, end, target, out Dictionary <string, DamageModifierStat> res))
            {
                return(res);
            }
            res = ComputeDamageModifierStats(target, log, start, end);
            if (res != null)
            {
                return(res);
            }
            //
            var damageMods = new List <DamageModifier>();

            if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(Source.Item, out IReadOnlyList <DamageModifier> list))
            {
                damageMods.AddRange(list);
            }
            if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(Source.Gear, out list))
            {
                damageMods.AddRange(list);
            }
            if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(Source.Common, out list))
            {
                damageMods.AddRange(list);
            }
            if (log.DamageModifiers.DamageModifiersPerSource.TryGetValue(Source.FightSpecific, out list))
            {
                damageMods.AddRange(list);
            }
            damageMods.AddRange(log.DamageModifiers.GetModifiersPerSpec(Actor.Spec));
            //
            var damageModifierEvents = new List <DamageModifierEvent>();

            foreach (DamageModifier damageMod in damageMods)
            {
                damageModifierEvents.AddRange(damageMod.ComputeDamageModifier(Actor, log));
            }
            damageModifierEvents.Sort((x, y) => x.Time.CompareTo(y.Time));
            var damageModifiersEvents = damageModifierEvents.GroupBy(y => y.DamageModifier.Name).ToDictionary(y => y.Key, y => y.ToList());

            _damageModifierEventsPerTargets.Set(0, log.FightData.FightEnd, null, damageModifiersEvents);
            var damageModifiersEventsByTarget = damageModifierEvents.GroupBy(x => x.Dst).ToDictionary(x => x.Key, x => x.GroupBy(y => y.DamageModifier.Name).ToDictionary(y => y.Key, y => y.ToList()));

            foreach (AgentItem actor in damageModifiersEventsByTarget.Keys)
            {
                _damageModifierEventsPerTargets.Set(0, log.FightData.FightEnd, log.FindActor(actor), damageModifiersEventsByTarget[actor]);
            }
            //
            res = ComputeDamageModifierStats(target, log, start, end);
            return(res);
        }