aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/blackjack.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-08-03 17:15:50 -0400
committerhistoria <[not public]>2026-08-03 17:15:50 -0400
commita2cbc04f86508708daa09affa5e9d73cc689b2ba (patch)
tree0d0c6c7fbf4a775faaf5e9dd700157b883882638 /internal/casino/blackjack.go
parentadda27dba5bf7bf1dee62159f0cbc0bd90734751 (diff)
downloadthehouseoficarus-a2cbc04f86508708daa09affa5e9d73cc689b2ba.tar.gz
feat: new color 'command', color tag system implemented
Diffstat (limited to 'internal/casino/blackjack.go')
-rw-r--r--internal/casino/blackjack.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/internal/casino/blackjack.go b/internal/casino/blackjack.go
index ff334c9..3c4dc09 100644
--- a/internal/casino/blackjack.go
+++ b/internal/casino/blackjack.go
@@ -93,7 +93,11 @@ func (t *blackjackTable) seats() []*Participant {
func (t *blackjackTable) menuEvent(name string) Event {
e := t.private(name, t.menu())
e.Color = "casino_menu"
- e.Menu = &MenuView{Kind: MenuBlackjackBet}
+ e.Menu = &MenuView{Kind: MenuBlackjackBet, Commands: []MenuCommand{
+ {Command: "bet", Desc: "Place a wager (min/max accepted)"},
+ {Command: "bet <amount>", Desc: "Place a specific wager"},
+ {Command: "stop", Desc: "Leave the table"},
+ }}
return e
}
@@ -446,10 +450,25 @@ func (t *blackjackTable) prompt() []Event {
actions := t.availableActions(p, h)
e := t.private(name, fmt.Sprintf("Your turn (%s).\nActions: %s", strings.Join(ranks, ","), strings.Join(actions, ", ")))
e.Color = "casino_menu"
- e.Menu = &MenuView{Kind: MenuBlackjackTurn, Title: fmt.Sprintf("Your turn (%s)", strings.Join(ranks, ",")), Actions: actions}
+ e.Menu = &MenuView{Kind: MenuBlackjackTurn, Title: fmt.Sprintf("Your turn (%s)", strings.Join(ranks, ",")), Actions: actions, Commands: blackjackActionCommands(actions)}
return []Event{e}
}
+func blackjackActionCommands(actions []string) []MenuCommand {
+ descriptions := map[string]string{
+ "hit": "Take another card",
+ "stand": "Hold your total",
+ "double": "Double your bet and take one card",
+ "split": "Split your pair into two hands",
+ "surrender": "Forfeit half your bet",
+ }
+ commands := make([]MenuCommand, 0, len(actions))
+ for _, action := range actions {
+ commands = append(commands, MenuCommand{Command: action, Desc: descriptions[action]})
+ }
+ return commands
+}
+
func (t *blackjackTable) availableActions(p *blackjackPlayer, hand *blackjackHand) []string {
if fromSplitAces(hand) {
// Split aces receive one card each and may only be re-split.
@@ -657,7 +676,7 @@ func (t *blackjackTable) snapshot(revealDealer bool) *BlackjackSnapshot {
}
func (t *blackjackTable) menu() string {
- return "New hand! You can bet, bet <amount> (inc. min/max), or stop."
+ return "New blackjack hand! Place your bet."
}
func handScore(hand *blackjackHand) string {