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()); }