Beispiel #1
0
        /// <summary>
        /// This method finds posthumous damage due to a DoT
        /// </summary>
        private bool TryGetAppropriateFightDueToPosthumousDamageOverTimeFromAttacker(Hit line, out IFight fight)
        {
            fight = null;

            if (line.Type != AttackType.DamageOverTime)
            {
                return(false);
            }

            if (line.Attacker == Character.Unknown)
            {
                return(false);
            }

            // If there is an attacker and it's not a corpse, then this isn't posthumous damage
            if (!line.Attacker.IsDead)
            {
                return(false);
            }

            // If a mob casted a Dot on you before they died, it can still be causing damage after the mob itself dies.

            // This is indicated by taking damage from "a mob's corpse"
            //    "You have taken 57121 damage from Dread Admiral's Curse by Arisen Gloriant Kra`du's corpse."
            //    "Khadajitwo has taken 56242 damage from Dread Admiral's Curse by Arisen Gloriant Kra`du."


            // A complication to this however, is a merc's DoT damage line does not have the "attacker" either before nor after a mob dies.
            //    "Vryklak has taken 28350 damage by Aura of the Kar`Zok."

            // Yet a further complication arises when a DoT is cured and you take one last tick of damage but without the attacker named
            //    "You have taken 768 damage from Rabid Anklebite by Deathfang's corpse."
            //    "Jathenai begins casting Counteract Disease."
            //    "Jathenai begins casting Counteract Disease."
            //    "You feel better."
            //    "You have taken 768 damage from Rabid Anklebite."

            // So, this is now damage due to a dead attacker, let's try to find that last fight/attacker

            var mobFight = Fights.LastOrDefault(x => x.PrimaryMob == line.Attacker);

            // Check the line.DamageBy to find a DoT that matches

            // if we find a dead mob who has used that Dot in the fight, then we know we've got the right one
            // If a group member has the same type of DoT as we do, that's the same mob
            // If can happen that we don't take the DoT damage until after they die, in which case we're just matching the mob

            // Is it enough to just say it's the same mob?
            // - Yes


            if (mobFight != null)
            {
                fight = mobFight;
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// This method finds fight with similar damage due to an anonymous DoT
        /// </summary>
        private bool TryGetAppropriateFightFromAnonymousDamageOverTime(Hit line, out IFight fight, out Attack newLineWithAttacker)
        {
            fight = null;
            newLineWithAttacker = null;

            if (line.Type != AttackType.DamageOverTime)
            {
                return(false);
            }

            if (line.Attacker != Character.Unknown)
            {
                return(false);
            }

            // This is usually DoT damage on a merc, there is no attacker either while the mob is still alive or after they're dead
            //    "Vryklak has taken 28350 damage by Aura of the Kar`Zok."

            // It can also be DoT damage on you after a cure
            //    "You have taken 768 damage from Rabid Anklebite by Deathfang's corpse."
            //    "Jathenai begins casting Counteract Disease."
            //    "Jathenai begins casting Counteract Disease."
            //    "You feel better."
            //    "You have taken 768 damage from Rabid Anklebite."

            // Search through our fights to find one that has the same DamageBy
            var mobFight = Fights.LastOrDefault(x => x.Statistics.Hit.Lines.Any(y => y.DamageBy == line.DamageBy));

            // So, we didn't find any fight that matches the type of DoT damage for this line
            // We need to assign it to some fight, so let's assign it to the current fight (even if that fight is "over", i.e. mob is slain)
            if (mobFight == null)
            {
                mobFight = Fights.LastOrDefault();
            }

            if (mobFight != null)
            {
                fight = mobFight;
                newLineWithAttacker = new Hit(line.LogLine, mobFight.PrimaryMob.Name, line.Defender.Name, line.Verb, line.Damage, line.DamageType, line.DamageBy, line.DamageQualifier, line.Zone);
                return(true);
            }

            return(false);
        }