aboutsummaryrefslogtreecommitdiff
path: root/internal/game/render_joker.go
blob: 821f9f402f4c92f0b4806294748f75276313b9c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package game

import (
	"strings"
	"thehouseoficarus/internal/cardart"
)

// Dedicated Joker face in every supported size, also usable without cards.yaml.
// Never reuse Unicode store art for ASCII-only clients.
func jokerCardArt(size int, unicode bool, style string, store *cardart.Store) []string {
	if size == 1 {
		return []string{"JK"}
	}
	var lines []string
	if unicode {
		lines = store.Art("JK", size)
	}
	if len(lines) != size {
		lines = generatedCardArt("JK", "", size, unicode, style)
		motifs := map[int][]string{5: {" * "}, 7: {" ^ ^ ", "(o o)", "  v  "}, 9: {" /\u005c /\u005c ", "  o o  ", "  <J>  ", "  \\_/  ", "   *   "}}
		if motif, ok := motifs[size]; ok {
			for i, text := range motif {
				left, right := "|", "|"
				if unicode {
					left, right = "│", "│"
				}
				lines[2+i] = left + text + right
			}
		}
	}
	lines = append([]string(nil), lines...)
	if unicode && style == "light" {
		lines[0] = strings.Repeat("▄", size)
		lines[size-1] = strings.Repeat("▀", size)
	}
	return lines
}