aboutsummaryrefslogtreecommitdiff
path: root/internal/game
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-08-03 16:42:59 -0400
committerhistoria <[not public]>2026-08-03 16:42:59 -0400
commitadda27dba5bf7bf1dee62159f0cbc0bd90734751 (patch)
tree2a68c0bad42c3561cfcd7a32eee52f7ff7eb14f9 /internal/game
parentfe15f2ffeb5685b056650a61aa0e23965ef51e95 (diff)
downloadthehouseoficarus-adda27dba5bf7bf1dee62159f0cbc0bd90734751.tar.gz
fix: blackjack game formatting
Diffstat (limited to 'internal/game')
-rw-r--r--internal/game/casino.go6
-rw-r--r--internal/game/casino_test.go7
2 files changed, 6 insertions, 7 deletions
diff --git a/internal/game/casino.go b/internal/game/casino.go
index fc400a7..97372f4 100644
--- a/internal/game/casino.go
+++ b/internal/game/casino.go
@@ -126,11 +126,11 @@ func (g *Game) executeBet(sess *net.Session, args []string, rawInput string) {
}
if len(args) == 1 {
if args[0] == "max" {
- g.emitCasinoEvents(g.Casino.SetMachineBet(machine.RoomID, machine.Config.ID, p.Name, machine.Config.MaxBet))
+ g.emitCasinoEvents(g.Casino.SetMachineBet(machine.RoomID, machine.Config.ID, p.Name, machine.Config.MaxBet, casinoWallet{g: g, p: p}))
return
}
if amount, err := strconv.Atoi(args[0]); err == nil && amount > 0 {
- g.emitCasinoEvents(g.Casino.SetMachineBet(machine.RoomID, machine.Config.ID, p.Name, amount))
+ g.emitCasinoEvents(g.Casino.SetMachineBet(machine.RoomID, machine.Config.ID, p.Name, amount, casinoWallet{g: g, p: p}))
return
}
}
@@ -227,7 +227,7 @@ func (g *Game) CasinoTick() {
func (g *Game) emitCasinoEvents(events []casino.Event) {
for _, event := range events {
- if event.Message == "" && event.Menu == nil {
+ if event.Message == "" && event.Menu == nil && event.Blackjack == nil && event.Baccarat == nil && event.Slot == nil {
continue
}
category := event.Color
diff --git a/internal/game/casino_test.go b/internal/game/casino_test.go
index d7b5ae9..0394437 100644
--- a/internal/game/casino_test.go
+++ b/internal/game/casino_test.go
@@ -36,12 +36,11 @@ func TestExecuteBetRejectsInvalidMachineArgs(t *testing.T) {
t.Fatalf("bet %v: expected usage error, got %q", args, string(conn.data))
}
}
- // A bare bet at a machine reaches the spin path instead of erroring.
- g.Casino.SetMachineBet(1, "slots", "alice", 10)
+ // A bet amount at a machine sets the wager and immediately spins.
conn.data = nil
- g.executeBet(sess, nil, "bet")
+ g.executeBet(sess, []string{"10"}, "bet 10")
if !strings.Contains(string(conn.data), "You don't have enough chips and credits") {
- t.Fatalf("bare bet should attempt a spin, got %q", string(conn.data))
+ t.Fatalf("bet 10 should attempt an auto-spin and fail at the empty wallet, got %q", string(conn.data))
}
}