public async Task <GameResult> PickOneAsync(GameResult game, SocketGuildUser[] users) { var uc = users.Count(); var team = game.GetTeam(); if (Context.User.Id != team.Captain) { await SimpleEmbedAndDeleteAsync($"{Context.User.Mention} - It is currently the other captains turn to pick.", Color.Red); return(null); } if (uc == 0) { await SimpleEmbedAndDeleteAsync($"{Context.User.Mention} - You must specify a player to pick.", Color.Red); return(null); } else if (uc != 1) { await SimpleEmbedAndDeleteAsync($"{Context.User.Mention} - You can only specify one player for this pick.", Color.Red); return(null); } team.Players.Add(users.First().Id); PickResponse = $"{MentionUtils.MentionUser(game.GetOffTeam().Captain)} can select **1** player for the next pick."; game.Picks++; return(game); }
public async Task <GameResult> PickTwoAsync(GameResult game, SocketGuildUser[] users) { var uc = users.Count(); //Lay out custom logic for 1-2-2-1-1... pick order. var team = game.GetTeam(); var offTeam = game.GetOffTeam(); if (game.Picks == 0) { //captain 1 turn to pick. if (Context.User.Id != team.Captain) { await SimpleEmbedAndDeleteAsync("It is currently the team 1 captains turn to pick.", Color.Red); return(null); } if (uc == 0) { await SimpleEmbedAndDeleteAsync("You must specify a player to pick.", Color.Red); return(null); } else if (uc != 1) { await SimpleEmbedAndDeleteAsync("You can only specify one player for the initial pick.", Color.Red); return(null); } team.Players.Add(team.Captain); offTeam.Players.Add(offTeam.Captain); team.Players.Add(users.First().Id); game.Picks++; PickResponse = $"{MentionUtils.MentionUser(offTeam.Captain)} can select **2** players for the next pick."; } else if (game.Picks == 1) { //cap 2 turn to pick. they get to pick 2 people. if (Context.User.Id != team.Captain) { await SimpleEmbedAndDeleteAsync("It is currently the other captains turn to pick.", Color.Red); return(null); } if (uc != 2) { await SimpleEmbedAndDeleteAsync("You must specify 2 players for this pick.", Color.Red); return(null); } //Note adding a player multiple times (ie team captain to team 1) will not affect it because the players are a hashset. team.Players.Add(team.Captain); team.Players.UnionWith(users.Select(x => x.Id)); PickResponse = $"{MentionUtils.MentionUser(offTeam.Captain)} can select **2** players for the next pick."; game.Picks++; } else if (game.Picks == 2) { //cap 2 turn to pick. they get to pick 2 people. if (Context.User.Id != team.Captain) { await SimpleEmbedAndDeleteAsync("It is currently the other captains turn to pick.", Color.Red); return(null); } if (uc != 2) { await SimpleEmbedAndDeleteAsync("You must specify 2 players for this pick.", Color.Red); return(null); } //Note adding a player multiple times (ie team captain to team 1) will not affect it because the players are a hashset. team.Players.Add(team.Captain); team.Players.UnionWith(users.Select(x => x.Id)); PickResponse = $"{MentionUtils.MentionUser(offTeam.Captain)} can select **1** player for the next pick."; game.Picks++; } else { if (Context.User.Id != team.Captain) { await SimpleEmbedAndDeleteAsync("It is currently the other captains turn to pick.", Color.Red); return(null); } if (uc == 0) { await SimpleEmbedAndDeleteAsync("You must specify a player to pick.", Color.Red); return(null); } else if (uc != 1) { await SimpleEmbedAndDeleteAsync("You can only specify one player for this pick.", Color.Red); return(null); } team.Players.Add(users.First().Id); PickResponse = $"{MentionUtils.MentionUser(team.Captain)} can select **1** player for the next pick."; game.Picks++; } return(game); }