public async Task Stand() { BlackjackGame agame = null; int listLocation = 0; foreach (BlackjackGame b in bjg) { if (Context.User.Id == b._playerID) { agame = b; break; } listLocation++; } if (agame == null) { await Context.Channel.SendMessageAsync("Silly, you ain't even playing Blackjack! Type !nep play blackjack to start! ~nepu"); return; } agame.EndPlayerTurn(true); GraphicsMethods gm = new GraphicsMethods(); while (true) { agame.DrawCard(false); if (agame.DealerTurnEnd) { break; } } await agame.HandMsg.DeleteAsync(); await Context.Channel.SendFileAsync(gm.CardLayout(agame._playerHand, agame._dealerHand, Context.User.Username), string.Concat("[Dealer:] ", agame.DealerTotal, " [Player:] ", agame.PlayerTotal, " [Bet Amt:] ", agame.TotalBet)); if (agame.GameEnd()) { SocketUser contUser = Context.User; UserData ud = ExtensionMethods.FindPerson(contUser.Id); bjg.RemoveAt(listLocation); if (agame.WhoWon() == 1) { EndBlackjack(Context.User.Id, agame.TotalBet, true); await Context.Channel.SendMessageAsync(string.Concat($"{ExtensionMethods.NeptuneEmojis(false)} You won, congrats and all that stuff, now how 'bout buying me a pudding? ~nepu By the way! You have ", ud.Pudding, " pudding now!")); } if (agame.WhoWon() == 2) { EndBlackjack(Context.User.Id, agame.TotalBet, false); await Context.Channel.SendMessageAsync(string.Concat($"{ExtensionMethods.NeptuneEmojis(true)} Yay I won!! Ahem suck to be you! Your {agame.TotalBet} belongs to me now! You have ", ud.Pudding, " pudding left!")); } } }
public async Task Blackjack([Remainder] string Input = null) { SocketUser contUser = Context.User; UserData ud = ExtensionMethods.FindPerson(contUser.Id); if (Input == null) { await Context.Channel.SendMessageAsync(string.Concat("You forgot to place a bet! Bet some pudding will ya? Minimum bet is 10. Maximum bet is (25 + amount of cards owned (from the nepbot card collection game!)) * your non-RP level which for you is: ", _math.TotalBet(ud.NonLevel, ud).ToString())); return; } if (Input.ToLower() == "help") { EmbedBuilder eb = new EmbedBuilder(); eb.AddField("Play Blackjack", "enter the amount you wish to bet after blackjack. The maximum amount you can bet is (25 + amount of cards owned (from the nepbot card collection game!)) * your ooc chat level!"); eb.AddField("Hit", "Draw a card."); eb.AddField("Stand", "Finish your turn with the cards you already have."); await Context.Channel.SendMessageAsync("", false, eb.Build()); //await Context.Channel.SendMessageAsync(string.Concat("Type !nep play blackjack (bet amt). Type !nep hit to draw a card and !nep stand to not draw a card. You win double your bet amt! Max bet amount is 25 * your non-RP chat level! If you bet higher than your maximum it will automatically adjust to your max.", "Maximum bet is 25 * your non - RP level which for you is: ", _math.TotalBet(ud.NonLevel).ToString())); return; } BlackjackGame gameChecker = null; int listLocation = 0; foreach (BlackjackGame b in bjg) { if (Context.User.Id == b._playerID) { gameChecker = b; break; } listLocation++; } if (gameChecker != null) { await Context.Channel.SendMessageAsync("You're already playing blackjack! One game at a time folks! ~nepu"); return; } try { if (ulong.Parse(Input) < 10) { await Context.Channel.SendMessageAsync("10 puddings is the minimum bet! Please bet a minimum of 10 puddings before I eat them all!"); return; } } catch (Exception) { } ulong betAmt = ulong.Parse(Input); if (!_math.CanBet(betAmt, ud.Pudding) || betAmt > _math.TotalBet(ud.NonLevel, ud)) { await Context.Channel.SendMessageAsync(string.Concat("Aww you only have ", ud.Pudding.ToString(), ". Minimum bet is 10. Maximum bet is (25 + amount of cards owned (from the nepbot card collection game!)) * your non-RP level which is: ", _math.TotalBet(ud.NonLevel, ud).ToString())); return; } GraphicsMethods gm = new GraphicsMethods(); BlackjackGame agame = new BlackjackGame(Context.User.Id, betAmt); if (agame.DealerBlackjack) { EndBlackjack(Context.User.Id, agame.TotalBet, false); await Context.Channel.SendFileAsync(gm.CardLayout(agame._playerHand, agame._dealerHand, Context.User.Username), string.Concat("[Dealer:] ", agame.DealerTotal, " [Player:] ", agame.PlayerTotal, " [Bet Amt:] ", agame.TotalBet)); await Context.Channel.SendMessageAsync(string.Concat($"{ExtensionMethods.NeptuneEmojis(true)} Yay I won!! Ahem suck to be you! Your {agame.TotalBet} belongs to me now! You have ", ud.Pudding, " pudding left!")); return; } bjg.Add(agame); Discord.Rest.RestUserMessage k = await Context.Channel.SendFileAsync(gm.CardLayout(agame._playerHand, agame._dealerHand, Context.User.Username), string.Concat("[Neptune's Hand:] ", agame.DealerTotal, " [Player:] ", agame.PlayerTotal, " [Bet Amt:] ", agame.TotalBet)); agame.HandMsg = k; }