52 lines
2.5 KiB
TypeScript
52 lines
2.5 KiB
TypeScript
import { beforeEach, describe, expect, it } from "vitest";
|
|
import { useCombatStore } from "./combatStore";
|
|
import { ROM_ALL_ABILITIES } from "./romAbilityCatalog";
|
|
import { ROM_PRIEST_CHAMPION_REGENERATE_PROC_AURA_ID, ROM_PRIEST_CHAMPION_REGENERATE_PROC_CHANCE } from "./romPriestChampionOverrides";
|
|
|
|
describe("RoM Priest/Champion Protection Rune Seal", () => {
|
|
beforeEach(() => {
|
|
useCombatStore.getState().initializeCharacter({
|
|
classId: "rom-priest", secondaryClassId: "rom-champion", raceId: "rom-human", level: 30, role: "healer",
|
|
});
|
|
});
|
|
|
|
it("resets Heart Rune Energy on an 8% Regenerate tick proc", () => {
|
|
const regenerate = ROM_ALL_ABILITIES.find((ability) => ability.dbcSpellId === 490269)!;
|
|
const heartRuneEnergy = ROM_ALL_ABILITIES.find((ability) => ability.dbcSpellId === 498612)!;
|
|
const initial = useCombatStore.getState();
|
|
useCombatStore.setState({ cooldowns: { ...initial.cooldowns, [heartRuneEnergy.id]: 60_000 } });
|
|
|
|
expect(useCombatStore.getState().castAbility(regenerate.id, undefined, 1_000)).toMatchObject({ ok: true });
|
|
const activeProcAura = useCombatStore.getState().auras.find((aura) => (
|
|
aura.definition.id === ROM_PRIEST_CHAMPION_REGENERATE_PROC_AURA_ID
|
|
));
|
|
expect(activeProcAura?.definition.procs?.[0]).toMatchObject({
|
|
chance: ROM_PRIEST_CHAMPION_REGENERATE_PROC_CHANCE,
|
|
abilityIds: [regenerate.id],
|
|
triggers: "periodic",
|
|
});
|
|
|
|
// The deterministic 8% roll succeeds on Regenerate's first periodic tick.
|
|
useCombatStore.getState().tick(0, 3_000);
|
|
expect(useCombatStore.getState().cooldowns[heartRuneEnergy.id]).toBe(0);
|
|
|
|
// Include the final 20-second HoT tick when the exact expiry time is processed.
|
|
useCombatStore.setState((state) => ({
|
|
cooldowns: { ...state.cooldowns, [heartRuneEnergy.id]: 60_000 },
|
|
}));
|
|
useCombatStore.getState().tick(0, 21_000);
|
|
expect(useCombatStore.getState().cooldowns[heartRuneEnergy.id]).toBe(0);
|
|
});
|
|
|
|
it("does not activate the reset proc when Protection Rune Seal is not unlocked", () => {
|
|
useCombatStore.getState().initializeCharacter({
|
|
classId: "rom-priest", secondaryClassId: "rom-champion", raceId: "rom-human", level: 24, role: "healer",
|
|
});
|
|
const regenerate = ROM_ALL_ABILITIES.find((ability) => ability.dbcSpellId === 490269)!;
|
|
expect(useCombatStore.getState().castAbility(regenerate.id, undefined, 1_000)).toMatchObject({ ok: true });
|
|
expect(useCombatStore.getState().auras.some((aura) => (
|
|
aura.definition.id === ROM_PRIEST_CHAMPION_REGENERATE_PROC_AURA_ID
|
|
))).toBe(false);
|
|
});
|
|
});
|