Add campaign shell and map generation recovery

This commit is contained in:
Keith Solomon
2026-03-18 21:35:53 -05:00
parent bcd720cae8
commit 37e2b27870
11 changed files with 1012 additions and 64 deletions
+14
View File
@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";
import { sampleContentPack } from "@/data/sampleContentPack";
import {
addSecretDoorFallback,
expandLevelFromExit,
getUnresolvedExits,
initializeDungeonLevel,
@@ -84,4 +85,17 @@ describe("dungeon state", () => {
}),
).toThrow("already connected");
});
it("adds a fallback secret exit when progression stalls", () => {
const levelState = initializeDungeonLevel({ content: sampleContentPack });
const room = levelState.rooms["room.level1.start"]!;
room.exits = [];
const fallback = addSecretDoorFallback(levelState);
expect(fallback.levelState.secretDoorUsed).toBe(true);
expect(fallback.room.id).toBe("room.level1.start");
expect(fallback.exit.exitType).toBe("secret");
});
});