diff options
| author | historia <[not public]> | 2026-09-29 14:23:52 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-29 14:23:52 -0400 |
| commit | 004dcd3826856870b267a55dacf84aa7742b7e3f (patch) | |
| tree | 3789558833d8486153271e818e7579e86721855e /internal/casino/blackjack.go | |
| parent | 3db3071c444abb2133e1fcaf7e685095415c1adf (diff) | |
| download | thehouseoficarus-004dcd3826856870b267a55dacf84aa7742b7e3f.tar.gz | |
fix: detailed casino output by default, compact output overrides card size
Diffstat (limited to 'internal/casino/blackjack.go')
| -rw-r--r-- | internal/casino/blackjack.go | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/internal/casino/blackjack.go b/internal/casino/blackjack.go index 2e7d7e9..0a5c0d1 100644 --- a/internal/casino/blackjack.go +++ b/internal/casino/blackjack.go @@ -5,7 +5,6 @@ package casino import ( "fmt" "math/rand" - "strings" ) // Blackjack uses the shared table phases; these aliases keep the rule @@ -550,24 +549,22 @@ func (t *blackjackTable) prompt() []Event { func (t *blackjackTable) turnMenuLocked(name string) Event { p := t.players.get(name) - h := p.hands[t.activeHand] - ranks := make([]string, len(h.cards)) - for i, card := range h.cards { - ranks[i] = card.rank - } - actions := t.availableActions(p, h) - e := t.private(name, fmt.Sprintf("Your turn (%s).\nActions: %s", strings.Join(ranks, ","), strings.Join(actions, ", "))) + hand := p.hands[t.activeHand] + actions := t.availableActions(p, hand) + // The table snapshot already shows the active hand's cards, score, wager, + // and "Your turn" status; the menu only needs the deadline and actions. + e := t.private(name, "Your turn.") e.Color = "casino_menu" deadline := t.timer.remaining() if p.Connected && t.bettorCount() <= 1 { deadline = t.ceiling.remaining() } - e.Menu = &MenuView{Heading: fmt.Sprintf("Your turn (%s) | Hand %d/%d | %s | Wager %d | %d ticks remaining", strings.Join(ranks, ","), t.activeHand+1, len(p.hands), handScore(h), h.bet, deadline), Commands: blackjackActionCommands(actions)} + e.Menu = &MenuView{Heading: fmt.Sprintf("Your turn | %d ticks remaining", deadline), Commands: blackjackActionCommands(actions)} for i := range e.Menu.Commands { c := &e.Menu.Commands[i] if c.Command == "double" || c.Command == "split" { - c.Cost = h.bet - c.Desc += fmt.Sprintf(" (+%d credits)", h.bet) + c.Cost = hand.bet + c.Desc += fmt.Sprintf(" (+%d credits)", hand.bet) } } return e @@ -709,12 +706,19 @@ func (t *blackjackTable) settle() []Event { } } if !roundFailed { - e := t.private(p.Name, fmt.Sprintf("Round complete | Net %+d credits (insurance included)", roundNet)) - e.ShowBalance = true - if roundNet > 0 { - e.Color = "casino_big_win" + // A single settled hand with no insurance already reported its net + // in the per-hand result line, so a summary is only noise. Keep it + // for split hands and insurance, and whenever the player will not + // receive the next-round menu that carries their balance. + needsBalance := p.LeaveAfter || p.SitOutAfter || !p.Connected + if len(p.hands) > 1 || p.insurance > 0 || needsBalance { + e := t.private(p.Name, fmt.Sprintf("Round complete | Net %+d credits (insurance included)", roundNet)) + e.ShowBalance = needsBalance + if roundNet > 0 { + e.Color = "casino_big_win" + } + events = append(events, e) } - events = append(events, e) } // Each hand's stakes were already consumed per-handle by // settleStakeOutcome (a payout removes them in PayCredits; a loss |
