Пример #1
0
        public int NextFightID()
        {
            var i = 1;

            while (Fights.Any(x => x.ID == i))
            {
                i++;
            }

            return(i);
        }
Пример #2
0
        public int NextNpcID()
        {
            var i = -1;

            while (Npcs.Any(x => x.ID == i) || MonstersGroups.Any(x => x.ID == i) || Fights.Any(x => x.GetFighters().ToList().Any(y => y.ID == i)))
            {
                i -= 1;
            }

            return(i);
        }
Пример #3
0
        private IFight GetAppropriateFight(Character char1, Character char2)
        {
            if (!Fights.Any())
            {
                CreateNewFight();
            }

            // If the primary mob isn't established yet, use the first fight
            var fight = Fights.First();

            if (IsValidFight(fight, Character.Unknown))
            {
                return(fight);
            }

            var firstActiveFight = Fights.Where(x => !x.IsFightOver);

            // If either one of the characters is Unknown, just use the first active fight
            if ((char1 == Character.Unknown || char2 == Character.Unknown) && firstActiveFight.Any())
            {
                return(firstActiveFight.First());
            }

            // If the char is a MOB, find the matching fight or create a new one
            if (CharResolver.WhichType(char1) == CharacterResolver.Type.NonPlayerCharacter)
            {
                return(GetOrAddFight(char1));
            }
            if (CharResolver.WhichType(char2) == CharacterResolver.Type.NonPlayerCharacter)
            {
                return(GetOrAddFight(char2));
            }

            // See if either character is already the primary mob (we can't tell if a named mob w/ a single name is a mob, so this may catch that)
            var primaryMobMatch = Fights.Where(x => IsValidFight(x, char1) || IsValidFight(x, char2));

            if (primaryMobMatch.Any())
            {
                return(primaryMobMatch.First());
            }

            // Either the characters are not MOBs or one of them is a named Mob and we don't know it, just use the first fight that's still ongoing
            if (firstActiveFight.Any())
            {
                return(firstActiveFight.First());
            }

            return(CreateNewFight());
        }
Пример #4
0
        private IFight GetAppropriateFight(Heal line)
        {
            // A heal line just applies to the last fight
            // It's a PC/Merc that's healing another PC/Merc
            // Except when it's a mob healing itself ... or healing a companion fighter...
            // Would a PC ever heal a Mob or vice versa? Maybe for a charmed pet ... but that's going to be a pain in the ass anyway

            if (Fights.Any() && (IsCharacterPlayerOrMerc(line.Healer) || IsCharacterPlayerOrMerc(line.Patient)))
            {
                // Apply the heal to the first active fight, or the last fight (that's inactive)
                return(Fights.FirstOrDefault(x => !x.IsFightOver)
                       ?? Fights.Last());
            }

            return(GetAppropriateFight(line.Healer, line.Patient));
        }