public async Task <IEnumerable <IGameRole> > GenerateOCRoles(int count) { if (count < 4) { await ForceJoin(Occult_Club, OCMembers, 4 - count); } IEnumerable <IGameRole> result = new IGameRole[] { new Kotori(Queue), new Kotarou(), new GilAndPana(), new GilAndPana() }; if (count > 4) { for (int i = 0; i < count - 4; i++) { result = result.Append(new GilAndPana()); } } // randomly, the array can change and you can instead have gil and pana separate. return(result.OrderBy((x) => Randomizer.Next())); }
public async Task <IEnumerable <IGameRole> > GenerateGuardianRoles(int count) { if (count < 4) { await ForceJoin(Guardian, GuardianMembers, 4 - count); } IEnumerable <IGameRole> result = new IGameRole[] { new Touka(), new Shizuru(), new Lucia(), new Imamiya() }; if (count > 4) { for (int i = 0; i < count - 4; i++) { result = result.Append(new GilAndPana()); } } // randomly, the array can change and you can instead have gil and pana separate. return(result.OrderBy((x) => Randomizer.Next())); }
public async Task <IEnumerable <IGameRole> > GenerateGaiaRoles(int count) { if (count < 4) { await ForceJoin(Gaia, GaiaMembers, 4 - count); } IEnumerable <IGameRole> result = new IGameRole[] { new Akane(), new ChihayaAndSakuya(), new Kashima(), new Shimako() }; if (count > 4) { for (int i = 0; i < count - 4; i++) { result = result.Append(new Summoner()); } } // randomly the array can change and you can instead have Chihaya and Sakuya separate. return(result.OrderBy((x) => Randomizer.Next())); }
public async Task <IEnumerable <IGameRole> > GenerateCivilianRoles(int count) { var everyone = GaiaMembers.Concat(GuardianMembers).Concat(OCMembers).Concat(Civilians); var all_ids = new ulong[] { Occult_Club.Id, Guardian.Id, Gaia.Id }; if (count < 4) { var random_players = (await ServerHost.GetUsersAsync()) .Where((x) => !x.IsBot && !everyone.Contains(x) && !x.RoleIds.Any((y) => all_ids.Contains(y)) ); var random_numbers = new int[4 - count]; var total_non_playing = random_players.Count(); var resultMsg = String.Empty; for (int i = 0; i < 4 - count; i++) { do { random_numbers[i] = Randomizer.Next(total_non_playing); } while (random_numbers.Take(i).Contains(random_numbers[i])); var memToAdd = random_players.ElementAt(random_numbers[i]); Civilians.Add(memToAdd); await memToAdd.AddRoleAsync(GvG_Player); resultMsg += $"Because there are too few players, {memToAdd.Mention} is forced to join the game as a Civilian" + ((i == count - 1) ? "" : Environment.NewLine); } Public_GvG.SendMessageAsync(resultMsg); } IEnumerable <IGameRole> result = new IGameRole[] { new Kagari(), new NormalCivilian(), new NormalCivilian(), new NormalCivilian() }; if (count > 4) { for (int i = 0; i < count - 4; i++) { result = result.Append(new NormalCivilian()); } } return(result.OrderBy((x) => Randomizer.Next())); }