public void Stop(bool end = false) { gameState = GameState.NotStarted; Round = 0; if (end) { TSPlayer winner = Utils.GetCahPlayers()[0]; List <TSPlayer> Winners = Utils.GetCahPlayers().FindAll(c => c.GetCaHPlayer().Score == winner.GetCaHPlayer().Score); if (Winners.Count > 1) { string winstr = string.Join(", ", Winners.Select(c => c.Name)); Utils.CahBroadcast($"{winstr} tied with {winner.GetCaHPlayer().Score} points in Cards Against Humanity!"); TSPlayer.All.SendInfoMessage($"{winstr} tied with {winner.GetCaHPlayer().Score} points in Cards Against Humanity!"); } else { Utils.CahBroadcast($"{winner.Name} won the game with {winner.GetCaHPlayer().Score} points!"); TSPlayer.All.SendInfoMessage($"{winner.Name} won Cards Against Humanity with {winner.GetCaHPlayer().Score} points!"); } TSPlayer.All.SendInfoMessage("Type \"/cah join\" to join in for the next game!"); } Utils.GetCahPlayers().ForEach((c) => { c.ClearInterfaceAndKick(); }); Locked = false; TimeVar = 50; }
public static void Spectate(this TSPlayer ts, CahGame cahGame) { ts.GetCaHPlayer().Spectating = true; if (cahGame.Judge == ts) { cahGame.SetJudge(); } }
public static void SendCaHGameInterface(this TSPlayer ts, CahGame cahGame) { string Optionalmsg = ""; CahPlayer cplr = ts.GetCaHPlayer(); if (cplr.Spectating) { Optionalmsg = "You are currently spectating and can't do anything."; } else if (cahGame.Judge == ts) { Optionalmsg = "You are the judge and cannot submit an answer for this round."; } else if (!cplr.Answered) { Optionalmsg = "Use /cah answer <answer>"; } string message = string.Join("\r\n", new string[] { RepeatSpaces(100), RepeatLineBreaks(10), "Cards against humanity", Utils.LineSegment, $"Round {cahGame.Round}/{cahGame.MaxRounds} - ({cahGame.TimeLeft} seconds left to answer)", Utils.SplitStringToFitScreen("Question: " + cahGame.Question), Utils.LineSegment, "Given answers:", Utils.LineSegment, GetAnswers(cahGame.Judge, ts == cahGame.Judge), Utils.LineSegment, SplitStringToFitScreen(Optionalmsg), RepeatLineBreaks(50), }); ts.SendData(PacketTypes.Status, message); }
public void Win(TSPlayer ts) { ts.GetCaHPlayer().Score++; gameState = GameState.VoteCast; Winner = ts; }