Esempio n. 1
0
        // public void AddLine(Zone line) { }
        // public void AddLine(Chat line) { }

        private void DeterminePrimaryMob(Attack line)
        {
            // If mob already set, don't change it
            if (PrimaryMob != Character.Unknown)
            {
                return;
            }

            // If it's a mob, set it
            if (CharResolver.WhichType(line.Attacker) == CharacterResolver.Type.NonPlayerCharacter)
            {
                PrimaryMob = line.Attacker;
                return;
            }

            if (CharResolver.WhichType(line.Defender) == CharacterResolver.Type.NonPlayerCharacter)
            {
                PrimaryMob = line.Defender;
                return;
            }

            // If we've got multiple lines, we should be able to see who's the main target by the fact that everyone keeps beating them up
            if (!Fighters.Any())
            {
                return;
            }

            // Note: this finds the fighter who has the most combined attack lines
            // better would be to find the fight with the most distinct other fighters who have been attacking them
            var topFighter = Fighters.Aggregate((maxItem, nextItem) => maxItem.DefensiveStatistics.Lines.Count + maxItem.OffensiveStatistics.Lines.Count > nextItem.DefensiveStatistics.Lines.Count + nextItem.OffensiveStatistics.Lines.Count ? maxItem : nextItem);

            if (topFighter.DefensiveStatistics.Lines.Count + topFighter.OffensiveStatistics.Lines.Count >= 2)
            {
                PrimaryMob = topFighter.Character;
            }
        }