48 lines
2.0 KiB
TypeScript
48 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { createDeathKnightRunes, normalizeActorResourcePool } from "./combatActors";
|
|
import {
|
|
activateDeathKnightRunes,
|
|
advanceCombatResourcePool,
|
|
spendDeathKnightRunes,
|
|
} from "./combatResources";
|
|
|
|
describe("authentic combat resources", () => {
|
|
it("suppresses spirit mana regeneration for five seconds after spending", () => {
|
|
const mana = normalizeActorResourcePool("mana", 50, 100, 12, 1_000);
|
|
const insideRule = advanceCombatResourcePool(mana, {
|
|
inCombat: true,
|
|
actorLevel: 80,
|
|
now: 5_999,
|
|
deltaSeconds: 1,
|
|
manaSpiritRegenerationPerSecond: 8,
|
|
});
|
|
const outsideRule = advanceCombatResourcePool(mana, {
|
|
inCombat: true,
|
|
actorLevel: 80,
|
|
now: 6_000,
|
|
deltaSeconds: 1,
|
|
manaSpiritRegenerationPerSecond: 8,
|
|
});
|
|
expect(insideRule.current).toBe(54);
|
|
expect(outsideRule.current).toBe(62);
|
|
});
|
|
|
|
it("decays rage and runic power only out of combat", () => {
|
|
const rage = normalizeActorResourcePool("rage", 20, 100);
|
|
const runic = normalizeActorResourcePool("runic-power", 20, 100);
|
|
expect(advanceCombatResourcePool(rage, { inCombat: false, actorLevel: 80, now: 1, deltaSeconds: 1 }).current).toBe(17);
|
|
expect(advanceCombatResourcePool(runic, { inCombat: false, actorLevel: 80, now: 1, deltaSeconds: 1 }).current).toBe(17.5);
|
|
expect(advanceCombatResourcePool(rage, { inCombat: true, actorLevel: 80, now: 1, deltaSeconds: 1 }).current).toBe(20);
|
|
});
|
|
|
|
it("recharges six Death Knight runes independently", () => {
|
|
const initial = createDeathKnightRunes();
|
|
const first = spendDeathKnightRunes(initial, { frost: 1, unholy: 1 }, 1_000)!;
|
|
expect(first).toHaveLength(6);
|
|
expect(first.filter((rune) => rune.readyAt === 11_000)).toHaveLength(2);
|
|
expect(spendDeathKnightRunes(first, { frost: 2 }, 1_001)).toBeNull();
|
|
const activated = activateDeathKnightRunes(first, 1);
|
|
expect(activated.filter((rune) => rune.readyAt === 0)).toHaveLength(5);
|
|
});
|
|
});
|