diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/casino/video_poker.go | 4 | ||||
| -rw-r--r-- | internal/casino/video_poker_config.go | 18 | ||||
| -rw-r--r-- | internal/game/casino.go | 8 | ||||
| -rw-r--r-- | internal/game/look_entities.go | 2 | ||||
| -rw-r--r-- | internal/game/render_video_poker.go | 23 | ||||
| -rw-r--r-- | internal/game/video_poker_render_test.go | 24 |
6 files changed, 59 insertions, 20 deletions
diff --git a/internal/casino/video_poker.go b/internal/casino/video_poker.go index 485d849..36fdc35 100644 --- a/internal/casino/video_poker.go +++ b/internal/casino/video_poker.go @@ -107,7 +107,7 @@ func (t *videoPokerTable) overview() string { return t.overviewLocked() } func (t *videoPokerTable) overviewLocked() string { - return t.settings.CabinetLabel() + " | denom 1/10/50 | one player | 1-5 coins per hand" + return t.settings.CabinetName() + " machine" } func (t *videoPokerTable) wagers(string) []WagerRow { return nil } func (t *videoPokerTable) hints(name string) []MenuCommand { @@ -221,7 +221,7 @@ func (t *videoPokerTable) leave(name string) []Event { return []Event{t.private(name, "Finish your hand with draw before leaving.")} } delete(t.players, name) - return []Event{t.private(name, "You leave video poker. Showing multipliers stay with the machine.")} + return []Event{t.private(name, "You leave video poker.")} } func (t *videoPokerTable) multiplierKey(p *pokerPlayer) string { diff --git a/internal/casino/video_poker_config.go b/internal/casino/video_poker_config.go index 918fed3..78a772d 100644 --- a/internal/casino/video_poker_config.go +++ b/internal/casino/video_poker_config.go @@ -130,20 +130,24 @@ func variantTitle(v string) string { } return v } -func (c VideoPokerConfig) CabinetLabel() string { +func (c VideoPokerConfig) CabinetName() string { c = c.Normalize() - label := "Classic Video Poker" switch c.Cabinet { case CabinetUXSingle: - label = "Ultimate X Single Line" + return "Ultimate X Single Line" case CabinetUXMulti: - label = "Ultimate X Multi-Hand" + return "Ultimate X Multi-Hand" case CabinetSuperTimesPay: - label = "Super Times Pay" + return "Super Times Pay" case CabinetHotRoll: - label = "Hot Roll" + return "Hot Roll" } - return label + " / " + c.Payout + " pay" + return "Classic Video Poker" +} + +func (c VideoPokerConfig) CabinetLabel() string { + c = c.Normalize() + return c.CabinetName() + " / " + c.Payout + " pay" } func (c VideoPokerConfig) Normalize() VideoPokerConfig { if c.Cabinet == "" { diff --git a/internal/game/casino.go b/internal/game/casino.go index 8d6e2a5..d433f2a 100644 --- a/internal/game/casino.go +++ b/internal/game/casino.go @@ -919,6 +919,14 @@ func cardArtLines(card casino.CardView, size int, unicode bool, style string, ar } key := card.Rank + strings.ToUpper(card.Suit[:1]) if configured := art.Art(key, size); len(configured) == size { + if unicode && style == "light" { + // The shared pip art draws a dark box frame, which leaves the top + // and bottom rows looking like the dark style. Replace only those + // two rows with the half-block edges the white body meets. + configured = append([]string(nil), configured...) + configured[0] = strings.Repeat("▄", utf8.RuneCountInString(configured[0])) + configured[size-1] = strings.Repeat("▀", utf8.RuneCountInString(configured[size-1])) + } return configured } return generatedCardArt(card.Rank, card.Suit, size, unicode, style) diff --git a/internal/game/look_entities.go b/internal/game/look_entities.go index c38b6e7..bfd36ca 100644 --- a/internal/game/look_entities.go +++ b/internal/game/look_entities.go @@ -232,7 +232,7 @@ func (g *Game) showRoomCasinos(sess *net.Session, room *world.Room) []string { for _, table := range room.CasinoTables { cfg := table.Normalize() if cfg.Game == casino.GameVideoPoker { - lines = append(lines, g.colorize(sess, "casino_action", cfg.Label()+" cabinet | denom 1/10/50 | one player"), " "+g.colorize(sess, "command", "play "+cfg.ID)) + lines = append(lines, g.colorize(sess, "casino_action", cfg.VideoPoker.CabinetName()+" machine"), " "+g.colorize(sess, "command", "play "+cfg.ID)) continue } label := fmt.Sprintf("%s | Limits %d-%d | 0/%d seated", cfg.Label(), cfg.MinBet, cfg.MaxBet, cfg.MaxPlayers) diff --git a/internal/game/render_video_poker.go b/internal/game/render_video_poker.go index d7b1a57..b8baef8 100644 --- a/internal/game/render_video_poker.go +++ b/internal/game/render_video_poker.go @@ -76,7 +76,7 @@ func renderPokerPayTable(s *casino.VideoPokerSnapshot, mode string) string { } lines = append(lines, row(cells, true)) } - lines = append(lines, border("└", "┴", "┘"), fmt.Sprintf("1 coin = %d credits | %d hand(s) | selected coin column in red", s.Denomination, s.Hands)) + lines = append(lines, border("└", "┴", "┘"), fmt.Sprintf("1 coin = %d credits | %d hand(s)", s.Denomination, s.Hands)) if s.Config.Feature != "" { lines = append(lines, fmt.Sprintf("Feature ON adds %d coin(s) per hand; requires five base coins.", s.Config.FeatureFeeCoins())) } @@ -127,27 +127,31 @@ func renderPokerCards(cards []casino.CardView, held *[5]bool, mode string, unico } func renderVideoPoker(s *casino.VideoPokerSnapshot, mode string, unicode bool, size int, style string, store *cardart.Store) string { + if s.Hands >= 100 { + unicode = true + } + size = cardRenderSize(unicode, size) if s.Hands > 1 { size = min(size, 5) } if s.Hands >= 25 { size = 1 } - if s.Hands >= 100 { - unicode = true - } var lines []string if s.ShowPayTable { lines = append(lines, renderPokerPayTable(s, mode), "") } - feature := "CLASSIC" + feature := "" if s.Config.Feature != "" { feature = s.Config.FeatureLabel() + " OFF" if s.FeatureOn { feature = s.Config.FeatureLabel() + " ON" } } - badge := pokerInk(mode, " ["+feature+"] ", false) + badge := "" + if feature != "" { + badge = pokerInk(mode, " ["+feature+"] ", false) + } bonus := "" mult := s.Multiplier if s.Config.Feature == casino.PokerUltimateX { @@ -165,18 +169,19 @@ func renderVideoPoker(s *casino.VideoPokerSnapshot, mode string, unicode bool, s if s.Dice[0] > 0 { bonus += fmt.Sprintf(" Dice [%d] + [%d]", s.Dice[0], s.Dice[1]) } + decorated := badge != "" || bonus != "" if len(s.Cards) > 0 && len(s.Lines) == 0 { art := renderPokerCards(s.Cards, &s.Held, mode, unicode, size, style, store) - if len(art) > 0 { + if len(art) > 0 && decorated { art[0] += " " + badge + bonus } lines = append(lines, art...) - } else if len(s.Lines) == 0 { + } else if len(s.Lines) == 0 && decorated { lines = append(lines, badge+bonus) } for i, line := range s.Lines { art := renderPokerCards(line.Cards, nil, mode, unicode, size, style, store) - if i == 0 && len(art) > 0 { + if i == 0 && len(art) > 0 && decorated { art[0] += " " + badge + bonus } if len(s.Lines) > 1 && len(art) > 0 { diff --git a/internal/game/video_poker_render_test.go b/internal/game/video_poker_render_test.go index d618c36..8195e21 100644 --- a/internal/game/video_poker_render_test.go +++ b/internal/game/video_poker_render_test.go @@ -5,10 +5,29 @@ import ( "strings" "testing" + "thehouseoficarus/internal/cardart" "thehouseoficarus/internal/casino" "thehouseoficarus/internal/color" ) +// Pip art from data/cards.yaml is shared by every game. In the light card +// style its dark box frame must still give way to the half-block edges that +// meet the white body, or the top and bottom rows look like the dark style. +func TestPokerLightStyleUsesHalfBlockEdgesForPipArt(t *testing.T) { + store := cardart.Load("../../data/cards.yaml") + cards := []casino.CardView{{Rank: "K", Suit: "spades"}} + for _, size := range []int{7, 9} { + lines := renderPokerCards(cards, nil, "none", true, size, "light", store) + if len(lines) != size { + t.Fatalf("size %d: got %d lines", size, len(lines)) + } + top, bottom := strings.TrimSpace(lines[0]), strings.TrimSpace(lines[size-1]) + if top != strings.Repeat("▄", size) || bottom != strings.Repeat("▀", size) { + t.Fatalf("size %d: light edges are not half blocks: top=%q bottom=%q", size, top, bottom) + } + } +} + func TestPokerPayTableBordersPaletteAndColumns(t *testing.T) { for _, cabinet := range []string{casino.CabinetClassic, casino.CabinetUXSingle, casino.CabinetUXMulti} { cfg := (casino.VideoPokerConfig{Cabinet: cabinet, Variant: "double_double_bonus"}).Normalize() @@ -76,9 +95,12 @@ func TestPokerResultsBelowCardsAndHoldStyle(t *testing.T) { t.Fatalf("missing result styling: %q", out) } plain := stripANSI(out) + if strings.Contains(plain, "CLASSIC") { + t.Fatalf("classic badge leaked into output: %s", plain) + } result := strings.Index(plain, text) // The result starts its own line and follows the card/badge line. - if result < 0 || result == 0 || plain[result-1] != '\n' || strings.Index(plain, "CLASSIC") > result { + if result < 0 || result == 0 || plain[result-1] != '\n' { t.Fatalf("result not below cards: %s", plain) } if hands == 100 && !strings.Contains(plain, "♥") { |
