Release Healer Man 0.1.20

This commit is contained in:
phenom committed 2026-09-06 14:38:59 -04:00
1 parent d9bebb4e81
commit 699fc858c9
22 files changed
+551 -295

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
import { describe, expect, it } from "vitest";
import { dungeonSpawnSelected, selectDungeonSessionPopulation } from "./dungeonSpawnSelection";
describe("dungeon spawn selection", () => {
it("keeps ordinary spawns and honors source chance boundaries", () => {
expect(dungeonSpawnSelected("deadmines", 1, { id: "ordinary" })).toBe(true);
expect(dungeonSpawnSelected("deadmines", 1, { id: "never", spawnChance: 0 })).toBe(false);
expect(dungeonSpawnSelected("deadmines", 1, { id: "always", spawnChance: 1 })).toBe(true);
});
it("selects rare spawns deterministically within a dungeon session", () => {
const results = Array.from({ length: 100 }, (_, sessionRevision) => (
dungeonSpawnSelected("blackrock-spire", sessionRevision, {
id: "creature-43519",
spawnChance: 0.15,
})
));
expect(results.some(Boolean)).toBe(true);
expect(results.some((selected) => !selected)).toBe(true);
expect(results).toEqual(Array.from({ length: 100 }, (_, sessionRevision) => (
dungeonSpawnSelected("blackrock-spire", sessionRevision, {
id: "creature-43519",
spawnChance: 0.15,
})
)));
});
it("filters static and roaming source populations with the same session rule", () => {
const population = selectDungeonSessionPopulation("stockades", 4, [
{ id: "ordinary", entityId: "guard", position: [0, 0, 0] },
{ id: "removed", entityId: "rare", position: [1, 0, 0], spawnChance: 0 },
], [{
id: "removed-patrol",
name: "Rare Patrol",
speed: 1,
formationSource: "database-solo",
spawnChance: 0,
waypoints: [[0, 0, 0], [1, 0, 0]],
members: [{ id: "member", entityId: "rare", role: "leader", formationOffset: [0, 0, 0] }],
}]);
expect(population.staticSpawns.map((spawn) => spawn.id)).toEqual(["ordinary"]);
expect(population.roamingPacks).toEqual([]);
});
});