public async Task PlayCard(CommandContext ctx, [Description("Index of the Upgrade in your hand")] int handPos) { handPos--; int index = BotInfoHandler.participantsDiscordIds.IndexOf(ctx.User.Id); BotInfoHandler.gameHandler.players[index].ctx = ctx; if (handPos >= BotInfoHandler.gameHandler.players[index].hand.LastIndex || handPos < 0) { //invalid hand position await ctx.Message.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":no_entry_sign:")).ConfigureAwait(false); } else if (!(await BotInfoHandler.gameHandler.players[index].PlayCard(handPos, BotInfoHandler.gameHandler, index, BotInfoHandler.gameHandler.pairsHandler.opponents[index]))) { //upgrade is too expensive await ctx.Message.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":no_entry_sign:")).ConfigureAwait(false); } else { //valid pos await ctx.Message.CreateReactionAsync(DiscordEmoji.FromName(ctx.Client, ":+1:")).ConfigureAwait(false); BotInfoHandler.gameHandler.players[index].ready = false; BotInfoHandler.RefreshPlayerList(ctx); await BotInfoHandler.RefreshUI(ctx, index); } }
public async Task ReadyRound(CommandContext ctx) { int index = BotInfoHandler.participantsDiscordIds.IndexOf(ctx.User.Id); DiscordEmbedBuilder responseMessage; if (BotInfoHandler.gameHandler.players[index].ready) { responseMessage = new DiscordEmbedBuilder { Title = "You Have Already Readied", Color = DiscordColor.Red }; } else { responseMessage = new DiscordEmbedBuilder { Title = "You Have Readied Successfully", Description = "You can still make changes to your Upgrade but you will need to use >ready again.", Color = DiscordColor.Green }; BotInfoHandler.gameHandler.players[index].ready = true; BotInfoHandler.RefreshPlayerList(ctx); } await ctx.RespondAsync(embed : responseMessage).ConfigureAwait(false); }