From 367cbe58b44a1ee4486a4e6b536564d67063e7c0 Mon Sep 17 00:00:00 2001 From: Josh Kurien Date: Wed, 15 Feb 2017 01:48:11 +0530 Subject: [PATCH 1/3] Remove player from game when cards are over --- CoupForTelegram/CoupForTelegram/Game.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CoupForTelegram/CoupForTelegram/Game.cs b/CoupForTelegram/CoupForTelegram/Game.cs index 48430ba..c4e94a0 100644 --- a/CoupForTelegram/CoupForTelegram/Game.cs +++ b/CoupForTelegram/CoupForTelegram/Game.cs @@ -310,6 +310,7 @@ public void StartGame() target.Cards.Clear(); LastMenu = null; Send($"{target.Name.ToBold()}, you have been couped. You are out of cards, and therefore out of the game!"); + RemovePlayerAtLoss(p); } else { @@ -359,6 +360,7 @@ public void StartGame() PlayerLoseCard(target, target.Cards.First()); //Graveyard.Add(target.Cards.First()); target.Cards.Clear(); + RemovePlayerAtLoss(p); } else { @@ -467,6 +469,7 @@ public void StartGame() p.Cards.Clear(); LastMenu = null; Send($"{p.Name} has chosen to concede the game, and is out!"); + RemovePlayerAtLoss(p); break; default: LastMenu = null; @@ -478,6 +481,7 @@ public void StartGame() Graveyard.AddRange(p.Cards); p.Cards.Clear(); Send($"{p.Name} is AFK, and is out!"); + RemovePlayerAtLoss(p); } break; } @@ -742,6 +746,7 @@ private bool PlayerMadeBlockableAction(CPlayer p, Action a, CPlayer t = null, st PlayerLoseCard(bluffer, bluffer.Cards.First()); //Graveyard.Add(bluffer.Cards.First()); bluffer.Cards.Clear(); + RemovePlayerAtLoss(p); } else { @@ -779,6 +784,7 @@ private bool PlayerMadeBlockableAction(CPlayer p, Action a, CPlayer t = null, st PlayerLoseCard(p, p.Cards.First()); //Graveyard.Add(p.Cards.First()); p.Cards.Clear(); + RemovePlayerAtLoss(p); } else { @@ -801,6 +807,10 @@ private bool PlayerMadeBlockableAction(CPlayer p, Action a, CPlayer t = null, st } } + private void RemovePlayerAtLoss(CPlayer p) + { + Players.Remove(p) + } private void PlayerLoseCard(CPlayer p, Card card = null) From 1d438e61be5c41f8c47dbf9f96fb464528423fd6 Mon Sep 17 00:00:00 2001 From: Josh Kurien Date: Wed, 15 Feb 2017 01:52:47 +0530 Subject: [PATCH 2/3] Change shuffled message to avoid miscommunication --- CoupForTelegram/CoupForTelegram/Game.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CoupForTelegram/CoupForTelegram/Game.cs b/CoupForTelegram/CoupForTelegram/Game.cs index c4e94a0..f996aee 100644 --- a/CoupForTelegram/CoupForTelegram/Game.cs +++ b/CoupForTelegram/CoupForTelegram/Game.cs @@ -765,7 +765,7 @@ private bool PlayerMadeBlockableAction(CPlayer p, Action a, CPlayer t = null, st card = Cards.First(); Cards.Remove(card); p.Cards.Add(card); - Send($"You have lost your {cardUsed}.", p.Id, newMsg: true); + Send($"Your {cardUsed} has been shuffled into the deck", p.Id, newMsg: true); } catch (Exception e) { @@ -820,7 +820,7 @@ private void PlayerLoseCard(CPlayer p, Card card = null) { if (p.Cards.Count() == 0) { - Send($"{p.Name.ToBold()} is out of cards, so out of the game!"); + Send($"{p.Name.ToBold()} is out of cards, so out of the game!"); // Sending messages here might not be necessary as it is covered outside return; } else if (p.Cards.Count() == 1) From f6e65c1b44cf4a6412a55d336c889db9ad1d8ba0 Mon Sep 17 00:00:00 2001 From: Josh Kurien Date: Sat, 18 Feb 2017 01:38:26 +0530 Subject: [PATCH 3/3] Semicolon.. >_< --- CoupForTelegram/CoupForTelegram/Game.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CoupForTelegram/CoupForTelegram/Game.cs b/CoupForTelegram/CoupForTelegram/Game.cs index f996aee..672de5f 100644 --- a/CoupForTelegram/CoupForTelegram/Game.cs +++ b/CoupForTelegram/CoupForTelegram/Game.cs @@ -809,7 +809,7 @@ private bool PlayerMadeBlockableAction(CPlayer p, Action a, CPlayer t = null, st private void RemovePlayerAtLoss(CPlayer p) { - Players.Remove(p) + Players.Remove(p); }