commit 09ffeb8443320c948b5d239ece7169cf091d1b8b
parent 948afed69f8df10b258fa65d8a8634bff9720a79
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Tue, 5 Dec 2023 15:15:52 -0500
call btn
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/pkg/web/handlers/poker.go b/pkg/web/handlers/poker.go
@@ -179,6 +179,15 @@ func (g *PokerGame) Deal(roomID string) {
PokerPubSub.Pub(roomTopic, PlayerFoldEvent{Card1Idx: player.Cards[0].Idx, Card2Idx: player.Cards[1].Idx})
} else if evt.Check {
} else if evt.Call {
+ if g.Ongoing.Players[i].Cash < g.Ongoing.Players[i].Bet {
+ g.Ongoing.Players[i].Bet += g.Ongoing.Players[i].Cash
+ g.Ongoing.Players[i].Cash = 0
+ // All in
+ } else {
+ g.Ongoing.Players[i].Bet += minBet
+ g.Ongoing.Players[i].Cash -= minBet
+ }
+ PokerPubSub.Pub(roomTopic, PlayerBetEvent{PlayerIdx: i, Player: p.Username, Bet: evt.Bet, TotalBet: g.Ongoing.Players[i].Bet, Cash: g.Ongoing.Players[i].Cash})
} else if evt.Bet > 0 {
if evt.Bet < minBet {
fmt.Println("BET TOO LOW", evt.Bet, minBet)