diff options
Diffstat (limited to 'internal/casino/table_ux.go')
| -rw-r--r-- | internal/casino/table_ux.go | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/internal/casino/table_ux.go b/internal/casino/table_ux.go index f4255be..768c041 100644 --- a/internal/casino/table_ux.go +++ b/internal/casino/table_ux.go @@ -5,29 +5,40 @@ import ( "strings" ) -// RulesText is the shared rules view for table commands and room fixtures. -func (c TableConfig) RulesText() string { - switch c.Game { - case GameBlackjack: - return c.BlackjackRulesText() - case GameBaccarat: - return c.BaccaratRulesText() - case GameCraps: - return c.CrapsRulesText() - case GameRoulette: - rules := c.Label() + "\nStraight numbers pay 35:1; splits 17:1; streets and trios 11:1; corners 8:1; lines 5:1.\n" + - "1to12/13to24/25to36 and rows 2:1; other outside bets 1:1; the American basket pays 6:1.\n" + - "Combos: bet 10 on split 1 2 | bet 10 on street 1 2 3 | bet 10 on corner 1 2 4 5 |\n" + - "bet 10 on line 1 2 3 4 5 6 | bet 10 on trio 0 1 2 | bet 10 on basket.\n" - if c.Roulette.Racetrack { - rules += "Racetrack (single zero): bet 10 on voisins | tiers | orphelins | jeu zero | neighbors 17.\n" +// WagerRow is one line of a table's "list" of available bets, in the game's +// current state: the bet wording (what follows "bet <amount> on"), its +// payout, and a brief description of the win condition. +type WagerRow struct { + Bet string + Payout string + Win string +} + +const ( + hintCommandRules = "rules" + hintCommandList = "list" +) + +// withTableHints finishes any game's hint list: "rules" is always present +// while seated at a table, and "list" follows when the game named more than +// one wager a player might want to make (a lone bet is just "bet <amount>"). +// Games whose own menus already append these hints are not double-hinted. +func withTableHints(commands []MenuCommand, wagerRows []WagerRow) []MenuCommand { + for _, c := range commands { + if c.Command == hintCommandRules { + return commands } - return rules + "Zero pockets lose all outside bets. One wager per spin. Use help roulette." - default: - return c.Label() } + commands = append(commands, MenuCommand{Command: hintCommandRules, Desc: "This game's full help page"}) + if len(wagerRows) > 1 { + commands = append(commands, MenuCommand{Command: hintCommandList, Desc: "List every bet available now, with payouts"}) + } + return commands } +// RulesText is the shared rules view for table commands and room fixtures. +func (c TableConfig) RulesText() string { return rulesTextOnTable(c) } + func (c TableConfig) Label() string { if c.Game == GameRoulette { label := "Roulette / Single zero" @@ -83,11 +94,12 @@ func (c *tableCore[P]) warning(name, text string) Event { func (c *tableCore[P]) committedMenu(name string) Event { e := c.private(name, "Your wager is committed; waiting for the round.") e.Color = "casino_menu" - e.Menu = &MenuView{Heading: e.Message, Commands: []MenuCommand{ + commands := []MenuCommand{ {Command: "table", Desc: "View the table"}, {Command: "sitout", Desc: "Sit out after this round"}, {Command: "stop", Desc: "Leave after this round"}, - }} + } + e.Menu = &MenuView{Heading: e.Message, Commands: withTableHints(commands, nil)} return e } |
