From 0dce30f23f2cdafc590d52bcd69f2d4cebfa1bcf Mon Sep 17 00:00:00 2001 From: tolelom <98kimsungmin@naver.com> Date: Tue, 24 Mar 2026 14:50:40 +0900 Subject: [PATCH] feat: floor themes with color-coded walls (Stone/Moss/Lava/Shadow) Co-Authored-By: Claude Sonnet 4.6 --- dungeon/render.go | 29 ++++++++++++++++++++++++++++- ui/game_view.go | 3 ++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/dungeon/render.go b/dungeon/render.go index 0849399..8cea550 100644 --- a/dungeon/render.go +++ b/dungeon/render.go @@ -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))...) diff --git a/ui/game_view.go b/ui/game_view.go index 848b34b..21c7e99 100644 --- a/ui/game_view.go +++ b/ui/game_view.go @@ -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) }