Files
healer-man/src/game/romPriestWarriorStance.test.ts
T
2026-09-30 09:57:13 -04:00

51 lines
2.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import type { AbilityDefinition } from "./abilityCatalog";
import { ROM_ALL_ABILITIES } from "./romAbilityCatalog";
import {
overrideRomPriestKnightEffects,
ROM_PRIEST_WARRIOR_BATTLE_MONK_STANCE_TAG,
romPriestWarriorStanceUseAllowed,
} from "./romPriestKnightOverrides";
function ability(sourceId: number): AbilityDefinition {
const found = ROM_ALL_ABILITIES.find((row) => row.dbcSpellId === sourceId
&& row.classId === "rom-priest" && row.secondaryClassId === "rom-warrior");
if (!found) throw new Error(`Missing Priest/Warrior source skill ${sourceId}`);
return found;
}
describe("RoM Priest/Warrior Battle Monk stance requirements", () => {
it("tags the generated stance aura so cast gates can detect it", () => {
const stance = ability(491600);
const tagged = overrideRomPriestKnightEffects({
classId: stance.classId,
secondaryClassId: stance.secondaryClassId,
sourceSkillId: stance.dbcSpellId,
name: stance.name,
description: stance.description,
}, stance.effects);
expect(tagged).not.toBeNull();
expect(tagged!.some((effect) => effect.kind === "apply-aura"
&& effect.recipient === "caster"
&& effect.aura.utilityTags?.includes(ROM_PRIEST_WARRIOR_BATTLE_MONK_STANCE_TAG))).toBe(true);
});
it.each([491362, 491363, 491364, 492635, 493038])(
"requires Battle Monk Stance for generated skill %i",
(sourceId) => {
const skill = ability(sourceId);
expect(romPriestWarriorStanceUseAllowed(skill, [])).toBe(false);
expect(romPriestWarriorStanceUseAllowed(skill, [ROM_PRIEST_WARRIOR_BATTLE_MONK_STANCE_TAG])).toBe(true);
expect(romPriestWarriorStanceUseAllowed(skill, new Set([ROM_PRIEST_WARRIOR_BATTLE_MONK_STANCE_TAG]))).toBe(true);
},
);
it("does not apply the source-specific gate to other abilities", () => {
const skill = ability(491362);
expect(romPriestWarriorStanceUseAllowed({ ...skill, dbcSpellId: 490290 }, [])).toBe(true);
expect(romPriestWarriorStanceUseAllowed({ ...skill, secondaryClassId: "rom-knight" }, [])).toBe(true);
expect(romPriestWarriorStanceUseAllowed({ ...skill, source: "core" }, [])).toBe(true);
});
});