From 05fe387d896fa6248ac8b5e20d52c60af884c9f8 Mon Sep 17 00:00:00 2001 From: Sindre Slungaard Date: Tue, 9 Nov 2021 05:08:52 +0100 Subject: [PATCH] Add deck out --- game/match/player.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/game/match/player.go b/game/match/player.go index 76a0794c..4107eaf4 100644 --- a/game/match/player.go +++ b/game/match/player.go @@ -282,6 +282,11 @@ func (p *Player) DrawCards(n int) { p.match.Chat("Server", fmt.Sprintf("%s drew %v card", p.match.PlayerRef(p).Socket.User.Username, n)) } + if len(p.deck) <= 0 { + // deck out + p.match.End(p.match.Opponent(p), fmt.Sprintf("%s won by deck out!", p.match.Opponent(p).Username())) + } + } // HasCard checks if a container has a card