forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
f8314e7de1
commit
1fedb9368d
76 files changed
+20556
-2523
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
DEFAULT_COMPANION_COOLDOWN_POLICY,
|
||||
imminentCooldownMechanic,
|
||||
normalizeCompanionCooldownPolicy,
|
||||
} from "./companionCooldownPolicy";
|
||||
|
||||
const policy = normalizeCompanionCooldownPolicy({
|
||||
...DEFAULT_COMPANION_COOLDOWN_POLICY,
|
||||
mechanics: [{
|
||||
id: "tank-buster", enabled: true, bossKey: "test/boss", bossName: "Test Boss",
|
||||
bossServerEntry: 123, attackId: "heavy-strike", attackName: "Heavy Strike",
|
||||
scope: "tank", leadTimeMs: 2_500, minimumCooldownSeconds: 20,
|
||||
}],
|
||||
});
|
||||
|
||||
describe("companion cooldown policy", () => {
|
||||
it("matches configured cooldown windows only for the selected boss and role", () => {
|
||||
const mob = { serverEntry: 123, abilityReadyAt: { "heavy-strike": 3_000 } };
|
||||
expect(imminentCooldownMechanic(mob, "tank", 1_000, policy)?.id).toBe("tank-buster");
|
||||
expect(imminentCooldownMechanic(mob, "damage", 1_000, policy)).toBeNull();
|
||||
expect(imminentCooldownMechanic({ ...mob, serverEntry: 456 }, "tank", 1_000, policy)).toBeNull();
|
||||
expect(imminentCooldownMechanic(mob, "tank", 6_000, policy)).toBeNull();
|
||||
});
|
||||
|
||||
it("matches an active cast inside the configured lead time", () => {
|
||||
expect(imminentCooldownMechanic({
|
||||
serverEntry: 123,
|
||||
activeCast: { attackId: "heavy-strike", completesAt: 3_000 },
|
||||
}, "tank", 1_000, policy)?.attackName).toBe("Heavy Strike");
|
||||
});
|
||||
|
||||
it("uses the authored boss name when an encounter has no server entry", () => {
|
||||
const namePolicy = normalizeCompanionCooldownPolicy({
|
||||
...DEFAULT_COMPANION_COOLDOWN_POLICY,
|
||||
mechanics: [{
|
||||
id: "name-only", enabled: true, bossKey: "test/name-only", bossName: "Named Boss",
|
||||
bossServerEntry: null, attackId: "heavy-strike", attackName: "Heavy Strike",
|
||||
scope: "party", leadTimeMs: 2_500, minimumCooldownSeconds: 20,
|
||||
}],
|
||||
});
|
||||
const window = { name: "Named Boss", abilityReadyAt: { "heavy-strike": 3_000 } };
|
||||
expect(imminentCooldownMechanic(window, "healer", 1_000, namePolicy)?.id).toBe("name-only");
|
||||
expect(imminentCooldownMechanic({ ...window, name: "Other Boss" }, "healer", 1_000, namePolicy)).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user