import { describe, expect, it } from "vitest"; import { applyAura } from "./combatAuras"; import { WOW335_DEATH_KNIGHT_MARK_OF_BLOOD_TAG, WOW335_DEATH_KNIGHT_MARK_OF_BLOOD_ABILITY_ID, wow335DeathKnightMarkOfBloodAuraDefinition, wow335DeathKnightMarkOfBloodOnDamage, wow335DeathKnightMarkOfBloodProfile, } from "./wow335DeathKnightMarkOfBloodRuntime"; describe("WoW Death Knight Mark of Blood source runtime", () => { it("reads heal percentage, duration, and hit cap from generated talent-1949", () => { expect(wow335DeathKnightMarkOfBloodProfile()).toEqual({ healingFraction: 0.04, durationMs: 20_000, hitCap: 20, }); }); it("configures the DBC aura with the generated twenty-hit cap and duration", () => { const definition = wow335DeathKnightMarkOfBloodAuraDefinition({ id: "wow335:death-knight:mark-of-blood", name: "Mark of Blood", disposition: "debuff", durationMs: 0, }); const applied = applyAura([], { definition, sourceId: "dk-player", targetId: "marked-enemy", now: 1_000, }).aura; expect(applied.definition.durationMs).toBe(20_000); expect(applied.expiresAt).toBe(21_000); expect(applied.definition.maxStacks).toBe(20); expect(applied.stacks).toBe(20); expect(applied.definition.utilityTags).toContain(WOW335_DEATH_KNIGHT_MARK_OF_BLOOD_TAG); }); it("heals for four percent of max health and consumes only landed-hit charges", () => { const mark = applyAura([], { definition: wow335DeathKnightMarkOfBloodAuraDefinition({ id: "wow335:death-knight:mark-of-blood", name: "Mark of Blood", disposition: "debuff", durationMs: 20_000, }), sourceId: "dk-player", targetId: "marked-enemy", now: 1_000, }).aura; const miss = wow335DeathKnightMarkOfBloodOnDamage([mark], "marked-enemy", 9_000, 10_000, 2_000, false); expect(miss.triggered).toBe(false); expect(miss.auras).toEqual([mark]); const hit = wow335DeathKnightMarkOfBloodOnDamage([mark], "marked-enemy", 9_000, 10_000, 2_000, true); expect(hit).toMatchObject({ triggered: true, healingAmount: 400, sourceActorId: "dk-player", abilityId: WOW335_DEATH_KNIGHT_MARK_OF_BLOOD_ABILITY_ID, remainingHits: 19, }); expect(hit.auras[0]?.stacks).toBe(19); }); it("removes the mark after its last hit, ignores expired marks, and consumes lethal-hit charges without reviving", () => { const oneCharge = applyAura([], { definition: { ...wow335DeathKnightMarkOfBloodAuraDefinition({ id: "wow335:death-knight:mark-of-blood", name: "Mark of Blood", disposition: "debuff", durationMs: 20_000, }), initialStacks: 1, }, sourceId: "dk-player", targetId: "marked-enemy", now: 1_000, stacks: 1, }).aura; const finalHit = wow335DeathKnightMarkOfBloodOnDamage([oneCharge], "marked-enemy", 4_000, 5_000, 2_000, true); expect(finalHit.healingAmount).toBe(200); expect(finalHit.remainingHits).toBe(0); expect(finalHit.auras).toEqual([]); const expired = wow335DeathKnightMarkOfBloodOnDamage([oneCharge], "marked-enemy", 4_000, 5_000, 21_000, true); expect(expired.triggered).toBe(false); expect(expired.auras).toEqual([oneCharge]); const lethal = wow335DeathKnightMarkOfBloodOnDamage([oneCharge], "marked-enemy", 0, 5_000, 2_000, true); expect(lethal).toMatchObject({ triggered: true, healingAmount: 0, remainingHits: 0 }); expect(lethal.auras).toEqual([]); }); });