feat: floor themes with color-coded walls (Stone/Moss/Lava/Shadow)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,25 @@ package dungeon
|
||||
|
||||
import "fmt"
|
||||
|
||||
type FloorTheme struct {
|
||||
WallColor string
|
||||
FloorColor string
|
||||
Name string
|
||||
}
|
||||
|
||||
func GetFloorTheme(floorNum int) FloorTheme {
|
||||
switch {
|
||||
case floorNum <= 5:
|
||||
return FloorTheme{"90", "245", "Stone Halls"}
|
||||
case floorNum <= 10:
|
||||
return FloorTheme{"22", "28", "Mossy Caverns"}
|
||||
case floorNum <= 15:
|
||||
return FloorTheme{"88", "202", "Lava Depths"}
|
||||
default:
|
||||
return FloorTheme{"53", "129", "Shadow Realm"}
|
||||
}
|
||||
}
|
||||
|
||||
// ANSI color codes
|
||||
const (
|
||||
ansiReset = "\033[0m"
|
||||
@@ -95,6 +114,7 @@ func wallVisible(floor *Floor, owner [][]int, x, y int) Visibility {
|
||||
|
||||
// RenderFloor renders the tile map as a colored ASCII string.
|
||||
func RenderFloor(floor *Floor, currentRoom int, showFog bool) string {
|
||||
theme := GetFloorTheme(floor.Number)
|
||||
if floor == nil || floor.Tiles == nil {
|
||||
return ""
|
||||
}
|
||||
@@ -200,7 +220,14 @@ func RenderFloor(floor *Floor, currentRoom int, showFog bool) string {
|
||||
}
|
||||
|
||||
if vis == Visible {
|
||||
buf = append(buf, []byte(fmt.Sprintf("%s%s%c%s", ansiBright, ansiFgWhite, ch, ansiReset))...)
|
||||
switch tile {
|
||||
case TileWall:
|
||||
buf = append(buf, []byte(fmt.Sprintf("\033[38;5;%sm%c\033[0m", theme.WallColor, ch))...)
|
||||
case TileFloor:
|
||||
buf = append(buf, []byte(fmt.Sprintf("\033[38;5;%sm%c\033[0m", theme.FloorColor, ch))...)
|
||||
default:
|
||||
buf = append(buf, []byte(fmt.Sprintf("%s%s%c%s", ansiBright, ansiFgWhite, ch, ansiReset))...)
|
||||
}
|
||||
} else {
|
||||
// Visited but not current — dim
|
||||
buf = append(buf, []byte(fmt.Sprintf("%s%c%s", ansiFgGray, ch, ansiReset))...)
|
||||
|
||||
@@ -33,6 +33,7 @@ func renderMap(floor *dungeon.Floor) string {
|
||||
if floor == nil {
|
||||
return ""
|
||||
}
|
||||
theme := dungeon.GetFloorTheme(floor.Number)
|
||||
headerStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("205")).Bold(true)
|
||||
|
||||
// Count explored rooms
|
||||
@@ -44,7 +45,7 @@ func renderMap(floor *dungeon.Floor) string {
|
||||
}
|
||||
total := len(floor.Rooms)
|
||||
|
||||
header := headerStyle.Render(fmt.Sprintf("── Catacombs B%d ── %d/%d Rooms ──", floor.Number, explored, total))
|
||||
header := headerStyle.Render(fmt.Sprintf("── Catacombs B%d: %s ── %d/%d Rooms ──", floor.Number, theme.Name, explored, total))
|
||||
return header + "\n" + dungeon.RenderFloor(floor, floor.CurrentRoom, true)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user