Release v0.1.5 2026-07-12
This commit is contained in:
+52
-11
@@ -1,12 +1,16 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { freshParty } from "./data";
|
||||
import {
|
||||
applyRunBuffsToParty,
|
||||
RUN_BUFF_ORDER,
|
||||
RUN_BUFFS,
|
||||
bossHealthMultiplier,
|
||||
runHealingMultiplier,
|
||||
runMaxMana,
|
||||
compileRunModifiers,
|
||||
effectiveRunBuffRank,
|
||||
formatRunBuffEffect,
|
||||
increaseRunBuffRank,
|
||||
selectRandomBossPair,
|
||||
selectRunBuffDraft,
|
||||
} from "./roguelike";
|
||||
import type { RunBuffRanks } from "./types";
|
||||
|
||||
describe("roguelike progression", () => {
|
||||
it("adds 10% base boss HP per completed round", () => {
|
||||
@@ -15,14 +19,51 @@ describe("roguelike progression", () => {
|
||||
expect(bossHealthMultiplier(5)).toBe(1.4);
|
||||
});
|
||||
|
||||
it("stacks each persistent buff independently", () => {
|
||||
const buffs = ["vital-bloom", "vital-bloom", "deep-wells", "restoring-grace"] as const;
|
||||
const party = applyRunBuffsToParty(freshParty("priest", "Aelia"), buffs);
|
||||
it("defines 18 unique infusion-eligible ability buffs without legacy ids", () => {
|
||||
expect(RUN_BUFF_ORDER).toHaveLength(18);
|
||||
expect(new Set(RUN_BUFF_ORDER)).toHaveLength(18);
|
||||
expect(RUN_BUFF_ORDER.every((id) => RUN_BUFFS[id].infusionEligible)).toBe(true);
|
||||
expect(RUN_BUFF_ORDER).not.toContain("vital-bloom");
|
||||
expect(RUN_BUFF_ORDER).not.toContain("deep-wells");
|
||||
expect(RUN_BUFF_ORDER).not.toContain("restoring-grace");
|
||||
});
|
||||
|
||||
expect(party[0].maxHp).toBe(124);
|
||||
expect(party[1].maxHp).toBe(186);
|
||||
expect(runMaxMana(buffs)).toBe(120);
|
||||
expect(runHealingMultiplier(buffs)).toBe(1.15);
|
||||
it("compiles capped ranks and overlays one passive infusion rank", () => {
|
||||
const ranks: RunBuffRanks = {
|
||||
"mend-echo": 9,
|
||||
"mend-efficiency": 2,
|
||||
"renew-duration": 2,
|
||||
"shield-guard": 3,
|
||||
"purify-renew": 1,
|
||||
"radiance-shield": 2,
|
||||
"barrier-regen": 3,
|
||||
};
|
||||
const modifiers = compileRunModifiers(ranks, "mend-efficiency");
|
||||
|
||||
expect(modifiers.mendExtraTargets).toBe(3);
|
||||
expect(modifiers.mendManaMultiplier).toBeCloseTo(0.75 ** 3);
|
||||
expect(modifiers.renewDurationBonus).toBe(4);
|
||||
expect(modifiers.shieldDamageTakenMultiplier).toBeCloseTo(0.76);
|
||||
expect(modifiers.purifyAppliesRenew).toBe(true);
|
||||
expect(modifiers.radianceAbsorb).toBe(18);
|
||||
expect(modifiers.barrierHealingPerSecond).toBe(9);
|
||||
expect(effectiveRunBuffRank(ranks, "mend-efficiency", "mend-efficiency")).toBe(3);
|
||||
expect(formatRunBuffEffect("mend-efficiency", 3)).toBe("58% less Mend mana cost");
|
||||
});
|
||||
|
||||
it("increments earned ranks without exceeding each buff cap", () => {
|
||||
const first = increaseRunBuffRank({}, "purify-renew");
|
||||
const capped = increaseRunBuffRank(first, "purify-renew");
|
||||
expect(first["purify-renew"]).toBe(1);
|
||||
expect(capped["purify-renew"]).toBe(1);
|
||||
});
|
||||
|
||||
it("draws unique eligible choices and handles one or zero remaining buffs", () => {
|
||||
expect(selectRunBuffDraft({}, null, () => 0)).toEqual(RUN_BUFF_ORDER.slice(0, 3));
|
||||
const maxed = Object.fromEntries(RUN_BUFF_ORDER.map((id) => [id, RUN_BUFFS[id].maxRank])) as RunBuffRanks;
|
||||
maxed["mend-efficiency"] = 2;
|
||||
expect(selectRunBuffDraft(maxed, null, () => 0)).toEqual(["mend-efficiency"]);
|
||||
expect(selectRunBuffDraft(maxed, "mend-efficiency", () => 0)).toEqual([]);
|
||||
});
|
||||
|
||||
it("selects a distinct pair that excludes both bosses from the prior round", () => {
|
||||
|
||||
Reference in New Issue
Block a user