mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 08:32:41 +00:00
Adv 2.0 D&D Phase 12 E6a: Multi-region expedition map (!map)
Adds renderRegionChain — for tier 4-5 multi-region zones, renders the 4-region progression (e.g. ST──DO──IW──TDT for Underdark) with ✓ cleared / ▶ here / · pending markers, and ⛺ overlay where a base camp has been pitched. Single-region zones skip the chain and fall through to the existing renderZoneMap room layout. !map (top-level) and !expedition map both invoke handleExpeditionMapCmd which composes: region chain → current region label → per-run room map → legend. Region abbreviations are decoded in a "Regions:" footer so the glyph row stays compact. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
80
internal/plugin/dnd_expedition_map_test.go
Normal file
80
internal/plugin/dnd_expedition_map_test.go
Normal file
@@ -0,0 +1,80 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRenderRegionChain_SingleRegionZone(t *testing.T) {
|
||||
e := &Expedition{ZoneID: ZoneSunkenTemple}
|
||||
if got := renderRegionChain(e); got != "" {
|
||||
t.Errorf("expected empty chain for single-region zone, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderRegionChain_MultiRegionMarkers(t *testing.T) {
|
||||
e := &Expedition{
|
||||
ZoneID: ZoneUnderdark,
|
||||
CurrentRegion: "underdark_drow_outpost",
|
||||
RegionState: map[string]any{
|
||||
regionStateClearedKey: []string{"underdark_surface_tunnels"},
|
||||
regionStateBaseCampKey: []string{"underdark_drow_outpost"},
|
||||
},
|
||||
}
|
||||
out := renderRegionChain(e)
|
||||
if out == "" {
|
||||
t.Fatalf("expected non-empty chain for multi-region zone")
|
||||
}
|
||||
lines := strings.Split(out, "\n")
|
||||
if len(lines) != 2 {
|
||||
t.Fatalf("expected 2 lines, got %d (%q)", len(lines), out)
|
||||
}
|
||||
bot := lines[1]
|
||||
// 4 regions: cleared / camp(at-current) / pending / pending
|
||||
// Camp marker overrides the ▶ (here) per renderRegionChain.
|
||||
if !strings.Contains(bot, "✓") {
|
||||
t.Errorf("expected ✓ for cleared region: %q", bot)
|
||||
}
|
||||
if !strings.Contains(bot, "⛺") {
|
||||
t.Errorf("expected ⛺ at base-camp region: %q", bot)
|
||||
}
|
||||
if !strings.Contains(bot, "·") {
|
||||
t.Errorf("expected · for pending region: %q", bot)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderRegionChain_CurrentMarker(t *testing.T) {
|
||||
e := &Expedition{
|
||||
ZoneID: ZoneUnderdark,
|
||||
CurrentRegion: "underdark_drow_outpost",
|
||||
}
|
||||
out := renderRegionChain(e)
|
||||
if !strings.Contains(out, "▶") {
|
||||
t.Errorf("expected ▶ at current region (no camps yet): %q", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegionGlyph(t *testing.T) {
|
||||
cases := map[string]string{
|
||||
"Surface Tunnels": "ST",
|
||||
"The Deep Throne": "TDT",
|
||||
"Drow Outpost": "DO",
|
||||
"Illithid Warren": "IW",
|
||||
"Kobold Warrens": "KW",
|
||||
}
|
||||
for name, want := range cases {
|
||||
if got := regionGlyph(name); got != want {
|
||||
t.Errorf("regionGlyph(%q) = %q, want %q", name, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderRegionLegend_HasAllRegions(t *testing.T) {
|
||||
e := &Expedition{ZoneID: ZoneUnderdark}
|
||||
got := renderRegionLegend(e)
|
||||
for _, want := range []string{"Surface Tunnels", "Drow Outpost", "Illithid Warren", "The Deep Throne"} {
|
||||
if !strings.Contains(got, want) {
|
||||
t.Errorf("legend missing %q: %s", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user