forked from phenom/healer-man
Release Healer Man 0.1.21
This commit is contained in:
1 parent
699fc858c9
commit
f6f2375145
210 files changed
+976039
-6247
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
RUNEWAKER_LOOT_CATALOG,
|
||||
rollRunewakerBossLoot,
|
||||
runewakerBossHasLoot,
|
||||
runewakerBossLootSource,
|
||||
} from "./runewakerLootCatalog";
|
||||
|
||||
describe("RuneWaker source loot catalog", () => {
|
||||
it("covers every source-classified boss template with explicit status", () => {
|
||||
expect(RUNEWAKER_LOOT_CATALOG.bossCount).toBe(RUNEWAKER_LOOT_CATALOG.bosses.length);
|
||||
expect(RUNEWAKER_LOOT_CATALOG.bossCount).toBeGreaterThanOrEqual(50);
|
||||
expect(RUNEWAKER_LOOT_CATALOG.bosses.every((boss) => Boolean(boss.status))).toBe(true);
|
||||
});
|
||||
|
||||
it("executes NPC slot and treasure probabilities deterministically", () => {
|
||||
const sequence = [0, 0, ...Array.from({ length: 28 }, () => 0.999999)];
|
||||
const drops = rollRunewakerBossLoot("rw-barren-caves-101462", 37, {
|
||||
random: () => sequence.shift() ?? 0.999999,
|
||||
now: 12_345,
|
||||
});
|
||||
expect(drops[0]).toMatchObject({
|
||||
itemId: 200004,
|
||||
name: "Healing Sigil",
|
||||
quantity: 1,
|
||||
itemLevel: 37,
|
||||
sourceBossName: "Anglo",
|
||||
inventorySlot: "misc",
|
||||
});
|
||||
expect(drops[0].stats).toMatchObject({ stamina: 0, armor: 0, meleeWeapon: null });
|
||||
});
|
||||
|
||||
it("keeps no-source tables and unknown bosses fail closed", () => {
|
||||
const noDrops = RUNEWAKER_LOOT_CATALOG.bosses.find((boss) => boss.status === "no-source-drops")!;
|
||||
expect(runewakerBossHasLoot(noDrops.bossKey)).toBe(false);
|
||||
expect(rollRunewakerBossLoot(noDrops.bossKey, 20, { random: () => 0 })).toEqual([]);
|
||||
expect(runewakerBossLootSource("unknown")).toBeNull();
|
||||
expect(rollRunewakerBossLoot("unknown", 20)).toEqual([]);
|
||||
});
|
||||
|
||||
it("exposes blocked source paths instead of executing them", () => {
|
||||
const partial = RUNEWAKER_LOOT_CATALOG.bosses.find((boss) => boss.status === "partial")!;
|
||||
expect(partial.blockedOutcomeCount).toBeGreaterThan(0);
|
||||
expect(partial.rolls.flatMap((roll) => roll.outcomes).some((outcome) => (
|
||||
outcome.runtimeStatus === "blocked" && Boolean(outcome.blockedReason)
|
||||
))).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user