private void CheckForNextState() { Log.debug("Twitch Game: checking round " + controller.game.round.ToString()); switch (controller.game.round) { case Games.TexasHoldem <TwitchUser> .Round.PreFlop: // Do nothing break; case Games.TexasHoldem <TwitchUser> .Round.Flop: if (controller.SetState(this, typeof(HoldemStatePlayFlop))) { timer.Stop(); return; } break; case Games.TexasHoldem <TwitchUser> .Round.Turn: if (controller.SetState(this, typeof(HoldemStatePlayTurn))) { timer.Stop(); return; } break; case Games.TexasHoldem <TwitchUser> .Round.River: if (controller.SetState(this, typeof(HoldemStatePlayRiver))) { timer.Stop(); return; } break; case Games.TexasHoldem <TwitchUser> .Round.GameOver: if (controller.SetState(this, typeof(HoldemStateEndOfGame))) { timer.Stop(); return; } break; default: Debug.Fail(); break; } if (controller.game.currentPlayer != null && controller.game.currentPlayer.idObject.id != lastKnownPlayer?.idObject.id) { Log.debug("Twitch Game: Player changed, up now is: " + controller.game.currentPlayer.idObject.name); lastKnownPlayer = controller.game.currentPlayer; PlayerChanged(); timer.Start(); } }
protected void MinHit_StartWaitingForAdditionalPlayers() { if (!roundTimer.isRunning) { waitingToStartTimer.Stop(); roundTimer.Start(); } }
public HoldemStatePlay(TwitchHoldem controller) : base(controller) { AddCommand(controller.room, "call", CallCommand, "Call...", null, false, null, false); AddCommand(controller.room, "raise", RaiseCommand, "Raise...", null, false, null, false); AddCommand(controller.room, "check", CheckCommand, "Check...", null, false, null, false); AddCommand(controller.room, "fold", FoldCommand, "Fold...", null, false, null, false); AddCommand(controller.room, "bet", BetCommand, "Bet...", null, false, null, false); AddCommand(controller.room, "allin", AllInCommand, "Bet or Raise all in...", null, false, null, false); timer = new TimerSet(new TimeSpan[] { TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30) }, new Action[] { WarningTimer, WarningTimer, FinalTimer }); lastKnownPlayer = controller.game.currentPlayer; PlayerChanged(); timer.Start(); playersLookingToFold.Clear(); }
private void StartPlaying() { foreach (var player in controller.game.GetPlayers()) { if (player.CurrentHandEvaluator.isBlackjack) { StandCommand(player.idObject, null); } } if (!controller.game.ReadyToEnd()) { if (controller.game.InsuranceAvailable() && controller.game.dealer.isBlackjack) { controller.SetState(this, typeof(BJStateDealerPlaying)); } else { string message = "Blackjack: Dealer "; message += controller.game.dealer.cards.First.ToString(); message += " \uD83C\uDCA0 "; foreach (var player in controller.game.GetPlayers()) { message += ", "; message += player.idObject.name; message += " "; message += player.CurrentHandEvaluator.cards.ToString(); } message += " -- !Hit, !Stand, !Split, !DoubleDown, or !Surrender?"; controller.room.SendChatMessage(message); timers.Start(); } } else { controller.SetState(this, typeof(BJStateDealerPlaying)); } }