public static IEnumerable <int> PartyNeedsAoeCure(this EliteAPI api, int countThreshold, int cureThreshold) { List <int> partiesResult = new List <int>(); // Full alliance list of who's active and below the threshold. var activeMembers = api.GetActivePartyMembers().Where(pm => pm.HPLoss() >= cureThreshold); // Figure out which parties specifically qualify. if (activeMembers.Where(pm => pm.InParty(1)).Count() >= countThreshold) { partiesResult.Add(1); } if (activeMembers.Where(pm => pm.InParty(2)).Count() >= countThreshold) { partiesResult.Add(2); } if (activeMembers.Where(pm => pm.InParty(3)).Count() >= countThreshold) { partiesResult.Add(3); } return(partiesResult.OrderByDescending(partyNumber => api.AverageHpLossForParty(partyNumber))); }