/// <summary>
        /// </summary>
        /// <param name="name"> </param>
        public void SetDrop(string name)
        {
            StatGroup dropGroup = this.GetGroup("DropsByMonster");
            StatGroup subGroup;

            if (!dropGroup.TryGetGroup(name, out subGroup))
            {
                subGroup = new StatGroup(name);
                subGroup.Stats.AddStats(this.DropStatList());
                dropGroup.AddGroup(subGroup);
            }

            subGroup.Stats.IncrementStat("TotalDrops");
        }
        /// <summary>
        /// </summary>
        /// <param name="line"> </param>
        public void SetBuff(Line line)
        {
            if (this.Name == Constants.CharacterName)
            {
                // LineHistory.Add(new LineHistory(line));
            }

            StatGroup abilityGroup = this.GetGroup("BuffByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(this.BuffStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }

            StatGroup playerGroup = this.GetGroup("BuffToPlayers");
            StatGroup subPlayerGroup;

            if (!playerGroup.TryGetGroup(line.Target, out subPlayerGroup))
            {
                subPlayerGroup = new StatGroup(line.Target);
                subPlayerGroup.Stats.AddStats(this.BuffStatList(null));
                playerGroup.AddGroup(subPlayerGroup);
            }

            StatGroup abilities = subPlayerGroup.GetGroup("BuffToPlayersByAction");
            StatGroup subPlayerAbilityGroup;

            if (!abilities.TryGetGroup(line.Action, out subPlayerAbilityGroup))
            {
                subPlayerAbilityGroup = new StatGroup(line.Action);
                subPlayerAbilityGroup.Stats.AddStats(this.BuffStatList(subPlayerGroup, true));
                abilities.AddGroup(subPlayerAbilityGroup);
            }

            this.Stats.IncrementStat("TotalBuffTime");
            subAbilityGroup.Stats.IncrementStat("TotalBuffTime");
            subPlayerGroup.Stats.IncrementStat("TotalBuffTime");
            subPlayerAbilityGroup.Stats.IncrementStat("TotalBuffTime");
            this.AdjustBuffTime(this);
            this.AdjustBuffTime(subAbilityGroup);
            this.AdjustBuffTime(subPlayerGroup);
            this.AdjustBuffTime(subPlayerAbilityGroup);
        }
예제 #3
0
        /// <summary>
        /// </summary>
        /// <param name="line"></param>
        public void SetDamageOverTime(Line line)
        {
            if (this.Name == Constants.CharacterName)
            {
                // LineHistory.Add(new LineHistory(line));
            }

            if (LimitBreaks.IsLimit(line.Action) && Settings.Default.IgnoreLimitBreaks)
            {
                return;
            }

            var currentDamage = line.Crit
                                    ? line.Amount > 0
                                          ? ParseHelper.GetOriginalAmount(line.Amount, .5)
                                          : 0
                                    : line.Amount;

            if (currentDamage > 0)
            {
                ParseHelper.LastAmountByAction.EnsurePlayerAction(line.Source, line.Action, currentDamage);
            }

            StatGroup abilityGroup = this.GetGroup("DamageOverTimeByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(this.DamageOverTimeStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }

            StatGroup monsterGroup = this.GetGroup("DamageOverTimeToMonsters");
            StatGroup subMonsterGroup;

            if (!monsterGroup.TryGetGroup(line.Target, out subMonsterGroup))
            {
                subMonsterGroup = new StatGroup(line.Target);
                subMonsterGroup.Stats.AddStats(this.DamageOverTimeStatList(null));
                monsterGroup.AddGroup(subMonsterGroup);
            }

            StatGroup monsters = subMonsterGroup.GetGroup("DamageOverTimeToMonstersByAction");
            StatGroup subMonsterAbilityGroup;

            if (!monsters.TryGetGroup(line.Action, out subMonsterAbilityGroup))
            {
                subMonsterAbilityGroup = new StatGroup(line.Action);
                subMonsterAbilityGroup.Stats.AddStats(this.DamageOverTimeStatList(subMonsterGroup, true));
                monsters.AddGroup(subMonsterAbilityGroup);
            }

            this.Stats.IncrementStat("TotalDamageOverTimeActionsUsed");
            subAbilityGroup.Stats.IncrementStat("TotalDamageOverTimeActionsUsed");
            subMonsterGroup.Stats.IncrementStat("TotalDamageOverTimeActionsUsed");
            subMonsterAbilityGroup.Stats.IncrementStat("TotalDamageOverTimeActionsUsed");
            this.Stats.IncrementStat("TotalOverallDamageOverTime", line.Amount);
            subAbilityGroup.Stats.IncrementStat("TotalOverallDamageOverTime", line.Amount);
            subMonsterGroup.Stats.IncrementStat("TotalOverallDamageOverTime", line.Amount);
            subMonsterAbilityGroup.Stats.IncrementStat("TotalOverallDamageOverTime", line.Amount);
            if (line.Crit)
            {
                this.Stats.IncrementStat("DamageOverTimeCritHit");
                subAbilityGroup.Stats.IncrementStat("DamageOverTimeCritHit");
                subMonsterGroup.Stats.IncrementStat("DamageOverTimeCritHit");
                subMonsterAbilityGroup.Stats.IncrementStat("DamageOverTimeCritHit");
                this.Stats.IncrementStat("CriticalDamageOverTime", line.Amount);
                subAbilityGroup.Stats.IncrementStat("CriticalDamageOverTime", line.Amount);
                subMonsterGroup.Stats.IncrementStat("CriticalDamageOverTime", line.Amount);
                subMonsterAbilityGroup.Stats.IncrementStat("CriticalDamageOverTime", line.Amount);
            }
            else
            {
                this.Stats.IncrementStat("DamageOverTimeRegHit");
                subAbilityGroup.Stats.IncrementStat("DamageOverTimeRegHit");
                subMonsterGroup.Stats.IncrementStat("DamageOverTimeRegHit");
                subMonsterAbilityGroup.Stats.IncrementStat("DamageOverTimeRegHit");
                this.Stats.IncrementStat("RegularDamageOverTime", line.Amount);
                subAbilityGroup.Stats.IncrementStat("RegularDamageOverTime", line.Amount);
                subMonsterGroup.Stats.IncrementStat("RegularDamageOverTime", line.Amount);
                subMonsterAbilityGroup.Stats.IncrementStat("RegularDamageOverTime", line.Amount);
            }
        }
        /// <summary>
        /// </summary>
        /// <param name="line"> </param>
        public void SetHealingOverHealing(Line line)
        {
            if (this.Name == Constants.CharacterName)
            {
                // LineHistory.Add(new LineHistory(line));
            }

            var currentHealing = line.Crit
                                     ? line.Amount > 0
                                           ? ParseHelper.GetOriginalAmount(line.Amount, .5)
                                           : 0
                                     : line.Amount;

            if (currentHealing > 0)
            {
                ParseHelper.LastAmountByAction.EnsurePlayerAction(line.Source, line.Action, currentHealing);
            }

            StatGroup abilityGroup = this.GetGroup("HealingOverHealingByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(this.HealingOverHealingStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }

            StatGroup playerGroup = this.GetGroup("HealingOverHealingToPlayers");
            StatGroup subPlayerGroup;

            if (!playerGroup.TryGetGroup(line.Target, out subPlayerGroup))
            {
                subPlayerGroup = new StatGroup(line.Target);
                subPlayerGroup.Stats.AddStats(this.HealingOverHealingStatList(null));
                playerGroup.AddGroup(subPlayerGroup);
            }

            StatGroup abilities = subPlayerGroup.GetGroup("HealingOverHealingToPlayersByAction");
            StatGroup subPlayerAbilityGroup;

            if (!abilities.TryGetGroup(line.Action, out subPlayerAbilityGroup))
            {
                subPlayerAbilityGroup = new StatGroup(line.Action);
                subPlayerAbilityGroup.Stats.AddStats(this.HealingOverHealingStatList(subPlayerGroup, true));
                abilities.AddGroup(subPlayerAbilityGroup);
            }

            this.Stats.IncrementStat("TotalHealingOverHealingActionsUsed");
            subAbilityGroup.Stats.IncrementStat("TotalHealingOverHealingActionsUsed");
            subPlayerGroup.Stats.IncrementStat("TotalHealingOverHealingActionsUsed");
            subPlayerAbilityGroup.Stats.IncrementStat("TotalHealingOverHealingActionsUsed");
            this.Stats.IncrementStat("TotalOverallHealingOverHealing", line.Amount);
            subAbilityGroup.Stats.IncrementStat("TotalOverallHealingOverHealing", line.Amount);
            subPlayerGroup.Stats.IncrementStat("TotalOverallHealingOverHealing", line.Amount);
            subPlayerAbilityGroup.Stats.IncrementStat("TotalOverallHealingOverHealing", line.Amount);
            if (line.Crit)
            {
                this.Stats.IncrementStat("HealingOverHealingCritHit");
                this.Stats.IncrementStat("CriticalHealingOverHealing", line.Amount);
                subAbilityGroup.Stats.IncrementStat("HealingOverHealingCritHit");
                subAbilityGroup.Stats.IncrementStat("CriticalHealingOverHealing", line.Amount);
                subPlayerGroup.Stats.IncrementStat("HealingOverHealingCritHit");
                subPlayerGroup.Stats.IncrementStat("CriticalHealingOverHealing", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("HealingOverHealingCritHit");
                subPlayerAbilityGroup.Stats.IncrementStat("CriticalHealingOverHealing", line.Amount);
                if (line.Modifier != 0)
                {
                    var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                    var modStat = "HealingOverHealingCritMod";
                    this.Stats.IncrementStat(modStat, mod);
                    subAbilityGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                }
            }
            else
            {
                this.Stats.IncrementStat("HealingOverHealingRegHit");
                this.Stats.IncrementStat("RegularHealingOverHealing", line.Amount);
                subAbilityGroup.Stats.IncrementStat("HealingOverHealingRegHit");
                subAbilityGroup.Stats.IncrementStat("RegularHealingOverHealing", line.Amount);
                subPlayerGroup.Stats.IncrementStat("HealingOverHealingRegHit");
                subPlayerGroup.Stats.IncrementStat("RegularHealingOverHealing", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("HealingOverHealingRegHit");
                subPlayerAbilityGroup.Stats.IncrementStat("RegularHealingOverHealing", line.Amount);
                if (line.Modifier != 0)
                {
                    var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                    var modStat = "HealingOverHealingRegMod";
                    this.Stats.IncrementStat(modStat, mod);
                    subAbilityGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// </summary>
        /// <param name="line"> </param>
        public void SetHealingOverTime(Line line)
        {
            if (this.Name == Constants.CharacterName)
            {
                // LineHistory.Add(new LineHistory(line));
            }

            var currentHealing = line.Crit
                                     ? line.Amount > 0
                                           ? ParseHelper.GetOriginalAmount(line.Amount, .5)
                                           : 0
                                     : line.Amount;

            if (currentHealing > 0)
            {
                ParseHelper.LastAmountByAction.EnsurePlayerAction(line.Source, line.Action, currentHealing);
            }

            var unusedAmount   = 0;
            var originalAmount = line.Amount;

            // get curable of target
            try {
                var cleanedName = Regex.Replace(line.Target, @"\[[\w]+\]", string.Empty).Trim();
                var curable     = Controller.Timeline.TryGetPlayerCurable(cleanedName);
                if (line.Amount > curable)
                {
                    unusedAmount = (int)(line.Amount - curable);
                    line.Amount  = curable;
                }
            }
            catch (Exception ex) {
                Logging.Log(Logger, new LogItem(ex, true));
            }

            StatGroup abilityGroup = this.GetGroup("HealingOverTimeByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(this.HealingOverTimeStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }

            StatGroup playerGroup = this.GetGroup("HealingOverTimeToPlayers");
            StatGroup subPlayerGroup;

            if (!playerGroup.TryGetGroup(line.Target, out subPlayerGroup))
            {
                subPlayerGroup = new StatGroup(line.Target);
                subPlayerGroup.Stats.AddStats(this.HealingOverTimeStatList(null));
                playerGroup.AddGroup(subPlayerGroup);
            }

            StatGroup abilities = subPlayerGroup.GetGroup("HealingOverTimeToPlayersByAction");
            StatGroup subPlayerAbilityGroup;

            if (!abilities.TryGetGroup(line.Action, out subPlayerAbilityGroup))
            {
                subPlayerAbilityGroup = new StatGroup(line.Action);
                subPlayerAbilityGroup.Stats.AddStats(this.HealingOverTimeStatList(subPlayerGroup, true));
                abilities.AddGroup(subPlayerAbilityGroup);
            }

            this.Stats.IncrementStat("TotalHealingOverTimeActionsUsed");
            subAbilityGroup.Stats.IncrementStat("TotalHealingOverTimeActionsUsed");
            subPlayerGroup.Stats.IncrementStat("TotalHealingOverTimeActionsUsed");
            subPlayerAbilityGroup.Stats.IncrementStat("TotalHealingOverTimeActionsUsed");
            this.Stats.IncrementStat("TotalOverallHealingOverTime", line.Amount);
            subAbilityGroup.Stats.IncrementStat("TotalOverallHealingOverTime", line.Amount);
            subPlayerGroup.Stats.IncrementStat("TotalOverallHealingOverTime", line.Amount);
            subPlayerAbilityGroup.Stats.IncrementStat("TotalOverallHealingOverTime", line.Amount);
            if (line.Crit)
            {
                this.Stats.IncrementStat("HealingOverTimeCritHit");
                this.Stats.IncrementStat("CriticalHealingOverTime", line.Amount);
                subAbilityGroup.Stats.IncrementStat("HealingOverTimeCritHit");
                subAbilityGroup.Stats.IncrementStat("CriticalHealingOverTime", line.Amount);
                subPlayerGroup.Stats.IncrementStat("HealingOverTimeCritHit");
                subPlayerGroup.Stats.IncrementStat("CriticalHealingOverTime", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("HealingOverTimeCritHit");
                subPlayerAbilityGroup.Stats.IncrementStat("CriticalHealingOverTime", line.Amount);
                if (line.Modifier != 0)
                {
                    var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                    var modStat = "HealingOverTimeCritMod";
                    this.Stats.IncrementStat(modStat, mod);
                    subAbilityGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                }
            }
            else
            {
                this.Stats.IncrementStat("HealingOverTimeRegHit");
                this.Stats.IncrementStat("RegularHealingOverTime", line.Amount);
                subAbilityGroup.Stats.IncrementStat("HealingOverTimeRegHit");
                subAbilityGroup.Stats.IncrementStat("RegularHealingOverTime", line.Amount);
                subPlayerGroup.Stats.IncrementStat("HealingOverTimeRegHit");
                subPlayerGroup.Stats.IncrementStat("RegularHealingOverTime", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("HealingOverTimeRegHit");
                subPlayerAbilityGroup.Stats.IncrementStat("RegularHealingOverTime", line.Amount);
                if (line.Modifier != 0)
                {
                    var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                    var modStat = "HealingOverTimeRegMod";
                    this.Stats.IncrementStat(modStat, mod);
                    subAbilityGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                }
            }

            if (unusedAmount <= 0)
            {
                return;
            }

            line.Amount = originalAmount;
            this.SetupHealingOverHealing(line, HealingType.HealingOverTime);
        }
예제 #6
0
        /// <summary>
        /// </summary>
        /// <param name="line"></param>
        public void SetDamage(Line line)
        {
            if (this.Name == Constants.CharacterName)
            {
                // LineHistory.Add(new LineHistory(line));
            }

            this.Last20DamageActions.Add(new LineHistory(line));
            if (this.Last20DamageActions.Count > 20)
            {
                this.Last20DamageActions.RemoveAt(0);
            }

            if (LimitBreaks.IsLimit(line.Action) && Settings.Default.IgnoreLimitBreaks)
            {
                return;
            }

            PropertyInfo[] fields = line.GetType().GetProperties();

            var currentDamage = line.Crit
                                    ? line.Amount > 0
                                          ? ParseHelper.GetOriginalAmount(line.Amount, .5)
                                          : 0
                                    : line.Amount;

            if (currentDamage > 0)
            {
                ParseHelper.LastAmountByAction.EnsurePlayerAction(line.Source, line.Action, currentDamage);
            }

            StatGroup abilityGroup = this.GetGroup("DamageByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(this.DamageStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }

            StatGroup monsterGroup = this.GetGroup("DamageToMonsters");
            StatGroup subMonsterGroup;

            if (!monsterGroup.TryGetGroup(line.Target, out subMonsterGroup))
            {
                subMonsterGroup = new StatGroup(line.Target);
                subMonsterGroup.Stats.AddStats(this.DamageStatList(null));
                monsterGroup.AddGroup(subMonsterGroup);
            }

            StatGroup monsters = subMonsterGroup.GetGroup("DamageToMonstersByAction");
            StatGroup subMonsterAbilityGroup;

            if (!monsters.TryGetGroup(line.Action, out subMonsterAbilityGroup))
            {
                subMonsterAbilityGroup = new StatGroup(line.Action);
                subMonsterAbilityGroup.Stats.AddStats(this.DamageStatList(subMonsterGroup, true));
                monsters.AddGroup(subMonsterAbilityGroup);
            }

            this.Stats.IncrementStat("TotalDamageActionsUsed");
            subAbilityGroup.Stats.IncrementStat("TotalDamageActionsUsed");
            subMonsterGroup.Stats.IncrementStat("TotalDamageActionsUsed");
            subMonsterAbilityGroup.Stats.IncrementStat("TotalDamageActionsUsed");
            if (line.Hit)
            {
                this.Stats.IncrementStat("TotalOverallDamage", line.Amount);
                subAbilityGroup.Stats.IncrementStat("TotalOverallDamage", line.Amount);
                subMonsterGroup.Stats.IncrementStat("TotalOverallDamage", line.Amount);
                subMonsterAbilityGroup.Stats.IncrementStat("TotalOverallDamage", line.Amount);
                if (line.Crit)
                {
                    this.Stats.IncrementStat("DamageCritHit");
                    subAbilityGroup.Stats.IncrementStat("DamageCritHit");
                    subMonsterGroup.Stats.IncrementStat("DamageCritHit");
                    subMonsterAbilityGroup.Stats.IncrementStat("DamageCritHit");
                    this.Stats.IncrementStat("CriticalDamage", line.Amount);
                    subAbilityGroup.Stats.IncrementStat("CriticalDamage", line.Amount);
                    subMonsterGroup.Stats.IncrementStat("CriticalDamage", line.Amount);
                    subMonsterAbilityGroup.Stats.IncrementStat("CriticalDamage", line.Amount);
                    if (line.Modifier != 0)
                    {
                        var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                        var modStat = "DamageCritMod";
                        this.Stats.IncrementStat(modStat, mod);
                        subAbilityGroup.Stats.IncrementStat(modStat, mod);
                        subMonsterGroup.Stats.IncrementStat(modStat, mod);
                        subMonsterAbilityGroup.Stats.IncrementStat(modStat, mod);
                    }
                }
                else
                {
                    this.Stats.IncrementStat("DamageRegHit");
                    subAbilityGroup.Stats.IncrementStat("DamageRegHit");
                    subMonsterGroup.Stats.IncrementStat("DamageRegHit");
                    subMonsterAbilityGroup.Stats.IncrementStat("DamageRegHit");
                    this.Stats.IncrementStat("RegularDamage", line.Amount);
                    subAbilityGroup.Stats.IncrementStat("RegularDamage", line.Amount);
                    subMonsterGroup.Stats.IncrementStat("RegularDamage", line.Amount);
                    subMonsterAbilityGroup.Stats.IncrementStat("RegularDamage", line.Amount);
                    if (line.Modifier != 0)
                    {
                        var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                        var modStat = "DamageRegMod";
                        this.Stats.IncrementStat(modStat, mod);
                        subAbilityGroup.Stats.IncrementStat(modStat, mod);
                        subMonsterGroup.Stats.IncrementStat(modStat, mod);
                        subMonsterAbilityGroup.Stats.IncrementStat(modStat, mod);
                    }
                }
            }
            else
            {
                this.Stats.IncrementStat("DamageRegMiss");
                subAbilityGroup.Stats.IncrementStat("DamageRegMiss");
                subMonsterGroup.Stats.IncrementStat("DamageRegMiss");
                subMonsterAbilityGroup.Stats.IncrementStat("DamageRegMiss");
            }

            foreach (PropertyInfo stat in fields.Where(stat => LD.Contains(stat.Name)).Where(stat => Equals(stat.GetValue(line), true)))
            {
                var regStat = $"Damage{stat.Name}";
                this.Stats.IncrementStat(regStat);
                subAbilityGroup.Stats.IncrementStat(regStat);
                subMonsterGroup.Stats.IncrementStat(regStat);
                subMonsterAbilityGroup.Stats.IncrementStat(regStat);
                if (line.Modifier == 0)
                {
                    continue;
                }

                var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                var modStat = $"Damage{stat.Name}Mod";
                this.Stats.IncrementStat(modStat, mod);
                subAbilityGroup.Stats.IncrementStat(modStat, mod);
                subMonsterGroup.Stats.IncrementStat(modStat, mod);
                subMonsterAbilityGroup.Stats.IncrementStat(modStat, mod);
            }

            System.Console.WriteLine($"Dmg update: now: {line.Amount} (crit: {line.Crit}), Total: {this.Stats.GetStatValue("TotalDamageActionsUsed")}, crit: {this.Stats.GetStatValue("DamageCritHit")} ");
        }
        /// <summary>
        /// </summary>
        /// <param name="line"></param>
        public void SetDamageTaken(Line line)
        {
            if (this.Name == Constants.CharacterName)
            {
                // LineHistory.Add(new LineHistory(line));
            }

            this.Last20DamageTakenActions.Add(new LineHistory(line));
            if (this.Last20DamageTakenActions.Count > 20)
            {
                this.Last20DamageTakenActions.RemoveAt(0);
            }

            PropertyInfo[] fields = line.GetType().GetProperties();

            StatGroup abilityGroup = this.GetGroup("DamageTakenByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(this.DamageTakenStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }

            StatGroup damageGroup = this.GetGroup("DamageTakenByMonsters");
            StatGroup subMonsterGroup;

            if (!damageGroup.TryGetGroup(line.Source, out subMonsterGroup))
            {
                subMonsterGroup = new StatGroup(line.Source);
                subMonsterGroup.Stats.AddStats(this.DamageTakenStatList(null));
                damageGroup.AddGroup(subMonsterGroup);
            }

            StatGroup abilities = subMonsterGroup.GetGroup("DamageTakenByMonstersByAction");
            StatGroup subMonsterAbilityGroup;

            if (!abilities.TryGetGroup(line.Action, out subMonsterAbilityGroup))
            {
                subMonsterAbilityGroup = new StatGroup(line.Action);
                subMonsterAbilityGroup.Stats.AddStats(this.DamageTakenStatList(subMonsterGroup, true));
                abilities.AddGroup(subMonsterAbilityGroup);
            }

            this.Stats.IncrementStat("TotalDamageTakenActionsUsed");
            subAbilityGroup.Stats.IncrementStat("TotalDamageTakenActionsUsed");
            subMonsterGroup.Stats.IncrementStat("TotalDamageTakenActionsUsed");
            subMonsterAbilityGroup.Stats.IncrementStat("TotalDamageTakenActionsUsed");
            if (line.Hit)
            {
                this.Stats.IncrementStat("TotalOverallDamageTaken", line.Amount);
                subAbilityGroup.Stats.IncrementStat("TotalOverallDamageTaken", line.Amount);
                subMonsterGroup.Stats.IncrementStat("TotalOverallDamageTaken", line.Amount);
                subMonsterAbilityGroup.Stats.IncrementStat("TotalOverallDamageTaken", line.Amount);
                if (line.Crit)
                {
                    this.Stats.IncrementStat("DamageTakenCritHit");
                    subAbilityGroup.Stats.IncrementStat("DamageTakenCritHit");
                    subMonsterGroup.Stats.IncrementStat("DamageTakenCritHit");
                    subMonsterAbilityGroup.Stats.IncrementStat("DamageTakenCritHit");
                    this.Stats.IncrementStat("CriticalDamageTaken", line.Amount);
                    subAbilityGroup.Stats.IncrementStat("CriticalDamageTaken", line.Amount);
                    subMonsterGroup.Stats.IncrementStat("CriticalDamageTaken", line.Amount);
                    subMonsterAbilityGroup.Stats.IncrementStat("CriticalDamageTaken", line.Amount);
                    if (line.Modifier != 0)
                    {
                        var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                        var modStat = "DamageTakenCritMod";
                        this.Stats.IncrementStat(modStat, mod);
                        subAbilityGroup.Stats.IncrementStat(modStat, mod);
                        subMonsterGroup.Stats.IncrementStat(modStat, mod);
                        subMonsterAbilityGroup.Stats.IncrementStat(modStat, mod);
                    }
                }
                else
                {
                    this.Stats.IncrementStat("DamageTakenRegHit");
                    subAbilityGroup.Stats.IncrementStat("DamageTakenRegHit");
                    subMonsterGroup.Stats.IncrementStat("DamageTakenRegHit");
                    subMonsterAbilityGroup.Stats.IncrementStat("DamageTakenRegHit");
                    this.Stats.IncrementStat("RegularDamageTaken", line.Amount);
                    subAbilityGroup.Stats.IncrementStat("RegularDamageTaken", line.Amount);
                    subMonsterGroup.Stats.IncrementStat("RegularDamageTaken", line.Amount);
                    subMonsterAbilityGroup.Stats.IncrementStat("RegularDamageTaken", line.Amount);
                    if (line.Modifier != 0)
                    {
                        var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                        var modStat = "DamageTakenRegMod";
                        this.Stats.IncrementStat(modStat, mod);
                        subAbilityGroup.Stats.IncrementStat(modStat, mod);
                        subMonsterGroup.Stats.IncrementStat(modStat, mod);
                        subMonsterAbilityGroup.Stats.IncrementStat(modStat, mod);
                    }
                }
            }
            else
            {
                this.Stats.IncrementStat("DamageTakenRegMiss");
                subAbilityGroup.Stats.IncrementStat("DamageTakenRegMiss");
                subMonsterGroup.Stats.IncrementStat("DamageTakenRegMiss");
                subMonsterAbilityGroup.Stats.IncrementStat("DamageTakenRegMiss");
            }

            foreach (PropertyInfo stat in fields.Where(stat => LD.Contains(stat.Name)).Where(stat => Equals(stat.GetValue(line), true)))
            {
                var regStat = $"DamageTaken{stat.Name}";
                this.Stats.IncrementStat(regStat);
                subAbilityGroup.Stats.IncrementStat(regStat);
                subMonsterGroup.Stats.IncrementStat(regStat);
                subMonsterAbilityGroup.Stats.IncrementStat(regStat);
                if (line.Modifier == 0)
                {
                    continue;
                }

                var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                var modStat = $"DamageTaken{stat.Name}Mod";
                this.Stats.IncrementStat(modStat, mod);
                subAbilityGroup.Stats.IncrementStat(modStat, mod);
                subMonsterGroup.Stats.IncrementStat(modStat, mod);
                subMonsterAbilityGroup.Stats.IncrementStat(modStat, mod);
            }
        }
        /// <summary>
        /// </summary>
        /// <param name="line"> </param>
        public void SetHealing(Line line)
        {
            if (this.Name == Constants.CharacterName)
            {
                // LineHistory.Add(new LineHistory(line));
            }

            this.Last20HealingActions.Add(new LineHistory(line));
            if (this.Last20HealingActions.Count > 20)
            {
                this.Last20HealingActions.RemoveAt(0);
            }

            var currentHealing = line.Crit
                                     ? line.Amount > 0
                                           ? ParseHelper.GetOriginalAmount(line.Amount, .5)
                                           : 0
                                     : line.Amount;

            if (currentHealing > 0)
            {
                ParseHelper.LastAmountByAction.EnsurePlayerAction(line.Source, line.Action, currentHealing);
            }

            var unusedAmount   = 0;
            var originalAmount = line.Amount;

            // get curable of target
            try {
                var cleanedName = Regex.Replace(line.Target, @"\[[\w]+\]", string.Empty).Trim();
                var curable     = Controller.Timeline.TryGetPlayerCurable(cleanedName);
                if (line.Amount > curable)
                {
                    unusedAmount = (int)(line.Amount - curable);
                    line.Amount  = curable;
                }
            }
            catch (Exception ex) {
                Logging.Log(Logger, new LogItem(ex, true));
            }

            StatGroup abilityGroup = this.GetGroup("HealingByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(this.HealingStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }

            StatGroup playerGroup = this.GetGroup("HealingToPlayers");
            StatGroup subPlayerGroup;

            if (!playerGroup.TryGetGroup(line.Target, out subPlayerGroup))
            {
                subPlayerGroup = new StatGroup(line.Target);
                subPlayerGroup.Stats.AddStats(this.HealingStatList(null));
                playerGroup.AddGroup(subPlayerGroup);
            }

            StatGroup abilities = subPlayerGroup.GetGroup("HealingToPlayersByAction");
            StatGroup subPlayerAbilityGroup;

            if (!abilities.TryGetGroup(line.Action, out subPlayerAbilityGroup))
            {
                subPlayerAbilityGroup = new StatGroup(line.Action);
                subPlayerAbilityGroup.Stats.AddStats(this.HealingStatList(subPlayerGroup, true));
                abilities.AddGroup(subPlayerAbilityGroup);
            }

            this.Stats.IncrementStat("TotalHealingActionsUsed");
            subAbilityGroup.Stats.IncrementStat("TotalHealingActionsUsed");
            subPlayerGroup.Stats.IncrementStat("TotalHealingActionsUsed");
            subPlayerAbilityGroup.Stats.IncrementStat("TotalHealingActionsUsed");
            this.Stats.IncrementStat("TotalOverallHealing", line.Amount);
            subAbilityGroup.Stats.IncrementStat("TotalOverallHealing", line.Amount);
            subPlayerGroup.Stats.IncrementStat("TotalOverallHealing", line.Amount);
            subPlayerAbilityGroup.Stats.IncrementStat("TotalOverallHealing", line.Amount);
            if (line.Crit)
            {
                this.Stats.IncrementStat("HealingCritHit");
                this.Stats.IncrementStat("CriticalHealing", line.Amount);
                subAbilityGroup.Stats.IncrementStat("HealingCritHit");
                subAbilityGroup.Stats.IncrementStat("CriticalHealing", line.Amount);
                subPlayerGroup.Stats.IncrementStat("HealingCritHit");
                subPlayerGroup.Stats.IncrementStat("CriticalHealing", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("HealingCritHit");
                subPlayerAbilityGroup.Stats.IncrementStat("CriticalHealing", line.Amount);
                if (line.Modifier != 0)
                {
                    var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                    var modStat = "HealingCritMod";
                    this.Stats.IncrementStat(modStat, mod);
                    subAbilityGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                }
            }
            else
            {
                this.Stats.IncrementStat("HealingRegHit");
                this.Stats.IncrementStat("RegularHealing", line.Amount);
                subAbilityGroup.Stats.IncrementStat("HealingRegHit");
                subAbilityGroup.Stats.IncrementStat("RegularHealing", line.Amount);
                subPlayerGroup.Stats.IncrementStat("HealingRegHit");
                subPlayerGroup.Stats.IncrementStat("RegularHealing", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("HealingRegHit");
                subPlayerAbilityGroup.Stats.IncrementStat("RegularHealing", line.Amount);
                if (line.Modifier != 0)
                {
                    var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                    var modStat = "HealingRegMod";
                    this.Stats.IncrementStat(modStat, mod);
                    subAbilityGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerGroup.Stats.IncrementStat(modStat, mod);
                    subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                }
            }

            if (MagicBarrierHelper.Adloquium.Any(action => string.Equals(line.Action, action, Constants.InvariantComparer)))
            {
                line.Amount = originalAmount;
                this.SetupHealingMitigated(line, "adloquium");
            }

            if (MagicBarrierHelper.Succor.Any(action => string.Equals(line.Action, action, Constants.InvariantComparer)))
            {
                line.Amount = originalAmount;
                this.SetupHealingMitigated(line, "succor");
            }

            #region OverHealing Handler

            if (unusedAmount <= 0)
            {
                return;
            }

            line.Amount = unusedAmount;
            this.SetupHealingOverHealing(line, HealingType.Normal);

            #endregion
        }
예제 #9
0
        /// <summary>
        /// </summary>
        /// <param name="line"></param>
        public void SetDamageTakenOverTime(Line line)
        {
            if (LimitBreaks.IsLimit(line.Action) && Settings.Default.IgnoreLimitBreaks)
            {
                return;
            }

            // LineHistory.Add(new LineHistory(line));
            StatGroup abilityGroup = this.GetGroup("DamageTakenOverTimeByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(this.DamageTakenOverTimeStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }

            StatGroup damageGroup = this.GetGroup("DamageTakenOverTimeByPlayers");
            StatGroup subPlayerGroup;

            if (!damageGroup.TryGetGroup(line.Source, out subPlayerGroup))
            {
                subPlayerGroup = new StatGroup(line.Source);
                subPlayerGroup.Stats.AddStats(this.DamageTakenOverTimeStatList(null));
                damageGroup.AddGroup(subPlayerGroup);
            }

            StatGroup abilities = subPlayerGroup.GetGroup("DamageTakenOverTimeByPlayersByAction");
            StatGroup subPlayerAbilityGroup;

            if (!abilities.TryGetGroup(line.Action, out subPlayerAbilityGroup))
            {
                subPlayerAbilityGroup = new StatGroup(line.Action);
                subPlayerAbilityGroup.Stats.AddStats(this.DamageTakenOverTimeStatList(subPlayerGroup, true));
                abilities.AddGroup(subPlayerAbilityGroup);
            }

            this.Stats.IncrementStat("TotalDamageTakenOverTimeActionsUsed");
            subAbilityGroup.Stats.IncrementStat("TotalDamageTakenOverTimeActionsUsed");
            subPlayerGroup.Stats.IncrementStat("TotalDamageTakenOverTimeActionsUsed");
            subPlayerAbilityGroup.Stats.IncrementStat("TotalDamageTakenOverTimeActionsUsed");
            this.Stats.IncrementStat("TotalOverallDamageTakenOverTime", line.Amount);
            subAbilityGroup.Stats.IncrementStat("TotalOverallDamageTakenOverTime", line.Amount);
            subPlayerGroup.Stats.IncrementStat("TotalOverallDamageTakenOverTime", line.Amount);
            subPlayerAbilityGroup.Stats.IncrementStat("TotalOverallDamageTakenOverTime", line.Amount);
            if (line.Crit)
            {
                this.Stats.IncrementStat("DamageTakenOverTimeCritHit");
                subAbilityGroup.Stats.IncrementStat("DamageTakenOverTimeCritHit");
                subPlayerGroup.Stats.IncrementStat("DamageTakenOverTimeCritHit");
                subPlayerAbilityGroup.Stats.IncrementStat("DamageTakenOverTimeCritHit");
                this.Stats.IncrementStat("CriticalDamageTakenOverTime", line.Amount);
                subAbilityGroup.Stats.IncrementStat("CriticalDamageTakenOverTime", line.Amount);
                subPlayerGroup.Stats.IncrementStat("CriticalDamageTakenOverTime", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("CriticalDamageTakenOverTime", line.Amount);
            }
            else
            {
                this.Stats.IncrementStat("DamageTakenOverTimeRegHit");
                subAbilityGroup.Stats.IncrementStat("DamageTakenOverTimeRegHit");
                subPlayerGroup.Stats.IncrementStat("DamageTakenOverTimeRegHit");
                subPlayerAbilityGroup.Stats.IncrementStat("DamageTakenOverTimeRegHit");
                this.Stats.IncrementStat("RegularDamageTakenOverTime", line.Amount);
                subAbilityGroup.Stats.IncrementStat("RegularDamageTakenOverTime", line.Amount);
                subPlayerGroup.Stats.IncrementStat("RegularDamageTakenOverTime", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("RegularDamageTakenOverTime", line.Amount);
            }
        }
        /// <summary>
        /// </summary>
        /// <param name="line"></param>
        /// <param name="isDamageOverTime"></param>
        public void SetDamage(Line line, bool isDamageOverTime = false)
        {
            // LineHistory.Add(new LineHistory(line));
            this.Last20DamageActions.Add(new LineHistory(line));
            if (this.Last20DamageActions.Count > 20)
            {
                this.Last20DamageActions.RemoveAt(0);
            }

            PropertyInfo[] fields = line.GetType().GetProperties();

            var currentDamage = line.Crit
                                    ? line.Amount > 0
                                          ? ParseHelper.GetOriginalAmount(line.Amount, .5)
                                          : 0
                                    : line.Amount;

            if (currentDamage > 0)
            {
                ParseHelper.LastAmountByAction.EnsureMonsterAction(line.Source, line.Action, currentDamage);
            }

            StatGroup abilityGroup = this.GetGroup("DamageByAction");
            StatGroup subAbilityGroup;

            if (!abilityGroup.TryGetGroup(line.Action, out subAbilityGroup))
            {
                subAbilityGroup = new StatGroup(line.Action);
                subAbilityGroup.Stats.AddStats(this.DamageStatList(null));
                abilityGroup.AddGroup(subAbilityGroup);
            }

            StatGroup playerGroup = this.GetGroup("DamageToPlayers");
            StatGroup subPlayerGroup;

            if (!playerGroup.TryGetGroup(line.Target, out subPlayerGroup))
            {
                subPlayerGroup = new StatGroup(line.Target);
                subPlayerGroup.Stats.AddStats(this.DamageStatList(null));
                playerGroup.AddGroup(subPlayerGroup);
            }

            StatGroup monsters = subPlayerGroup.GetGroup("DamageToPlayersByAction");
            StatGroup subPlayerAbilityGroup;

            if (!monsters.TryGetGroup(line.Action, out subPlayerAbilityGroup))
            {
                subPlayerAbilityGroup = new StatGroup(line.Action);
                subPlayerAbilityGroup.Stats.AddStats(this.DamageStatList(subPlayerGroup, true));
                monsters.AddGroup(subPlayerAbilityGroup);
            }

            if (!isDamageOverTime)
            {
                this.Stats.IncrementStat("TotalDamageActionsUsed");
                subAbilityGroup.Stats.IncrementStat("TotalDamageActionsUsed");
                subPlayerGroup.Stats.IncrementStat("TotalDamageActionsUsed");
                subPlayerAbilityGroup.Stats.IncrementStat("TotalDamageActionsUsed");
            }

            if (line.Hit)
            {
                this.Stats.IncrementStat("TotalOverallDamage", line.Amount);
                subAbilityGroup.Stats.IncrementStat("TotalOverallDamage", line.Amount);
                subPlayerGroup.Stats.IncrementStat("TotalOverallDamage", line.Amount);
                subPlayerAbilityGroup.Stats.IncrementStat("TotalOverallDamage", line.Amount);
                if (line.Crit)
                {
                    this.Stats.IncrementStat("DamageCritHit");
                    subAbilityGroup.Stats.IncrementStat("DamageCritHit");
                    subPlayerGroup.Stats.IncrementStat("DamageCritHit");
                    subPlayerAbilityGroup.Stats.IncrementStat("DamageCritHit");
                    this.Stats.IncrementStat("CriticalDamage", line.Amount);
                    subAbilityGroup.Stats.IncrementStat("CriticalDamage", line.Amount);
                    subPlayerGroup.Stats.IncrementStat("CriticalDamage", line.Amount);
                    subPlayerAbilityGroup.Stats.IncrementStat("CriticalDamage", line.Amount);
                    if (line.Modifier != 0)
                    {
                        var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                        var modStat = "DamageCritMod";
                        this.Stats.IncrementStat(modStat, mod);
                        subAbilityGroup.Stats.IncrementStat(modStat, mod);
                        subPlayerGroup.Stats.IncrementStat(modStat, mod);
                        subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                    }
                }
                else
                {
                    this.Stats.IncrementStat("DamageRegHit");
                    subAbilityGroup.Stats.IncrementStat("DamageRegHit");
                    subPlayerGroup.Stats.IncrementStat("DamageRegHit");
                    subPlayerAbilityGroup.Stats.IncrementStat("DamageRegHit");
                    this.Stats.IncrementStat("RegularDamage", line.Amount);
                    subAbilityGroup.Stats.IncrementStat("RegularDamage", line.Amount);
                    subPlayerGroup.Stats.IncrementStat("RegularDamage", line.Amount);
                    subPlayerAbilityGroup.Stats.IncrementStat("RegularDamage", line.Amount);
                    if (line.Modifier != 0)
                    {
                        var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                        var modStat = "DamageRegMod";
                        this.Stats.IncrementStat(modStat, mod);
                        subAbilityGroup.Stats.IncrementStat(modStat, mod);
                        subPlayerGroup.Stats.IncrementStat(modStat, mod);
                        subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
                    }
                }
            }
            else
            {
                this.Stats.IncrementStat("DamageRegMiss");
                subAbilityGroup.Stats.IncrementStat("DamageRegMiss");
                subPlayerGroup.Stats.IncrementStat("DamageRegMiss");
                subPlayerAbilityGroup.Stats.IncrementStat("DamageRegMiss");
            }

            foreach (PropertyInfo stat in fields.Where(stat => LD.Contains(stat.Name)).Where(stat => Equals(stat.GetValue(line), true)))
            {
                var regStat = $"Damage{stat.Name}";
                this.Stats.IncrementStat(regStat);
                subAbilityGroup.Stats.IncrementStat(regStat);
                subPlayerGroup.Stats.IncrementStat(regStat);
                subPlayerAbilityGroup.Stats.IncrementStat(regStat);
                if (line.Modifier == 0)
                {
                    continue;
                }

                var mod     = ParseHelper.GetBonusAmount(line.Amount, line.Modifier);
                var modStat = $"Damage{stat.Name}Mod";
                this.Stats.IncrementStat(modStat, mod);
                subAbilityGroup.Stats.IncrementStat(modStat, mod);
                subPlayerGroup.Stats.IncrementStat(modStat, mod);
                subPlayerAbilityGroup.Stats.IncrementStat(modStat, mod);
            }
        }