Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions CoupForTelegram/CoupForTelegram/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -359,6 +360,7 @@ public void StartGame()
PlayerLoseCard(target, target.Cards.First());
//Graveyard.Add(target.Cards.First());
target.Cards.Clear();
RemovePlayerAtLoss(p);
}
else
{
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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
{
Expand All @@ -760,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)
{
Expand All @@ -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
{
Expand All @@ -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)
Expand All @@ -810,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)
Expand Down