fix(games): skip upfront bet deduction for per-round betting games
Some checks failed
Deploy to Production / test (push) Failing after 35s
Some checks failed
Deploy to Production / test (push) Failing after 35s
Games with getActionCost (like blackjack) handle bet deductions per-round via place_bet actions. The old deductBetsAndStart was also charging at game start, causing double-deduction: wins netted zero and losses doubled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -395,6 +395,18 @@ export class GameServer {
|
||||
): Promise<void> {
|
||||
const room = this.roomManager.getRoom(roomId);
|
||||
if (!room || room.betsPending) return;
|
||||
|
||||
// Games with getActionCost handle per-round betting themselves (e.g., blackjack).
|
||||
// Skip the upfront deduction — just start the game.
|
||||
const plugin = gameRegistry.get(room.gameSlug);
|
||||
if (plugin?.getActionCost) {
|
||||
const startResult = this.roomManager.startGame(roomId);
|
||||
if (!startResult.ok) {
|
||||
triggeringWs.send(JSON.stringify({ type: "ERROR", message: startResult.error }));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
room.betsPending = true;
|
||||
|
||||
const uniquePlayers = [...new Set(playerIds)];
|
||||
|
||||
Reference in New Issue
Block a user