forked from phenom/healer-man
54 lines
2.8 KiB
TypeScript
54 lines
2.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
||
import { applyAura, resolveDamageValue } from "./combatAuras";
|
||
import {
|
||
WOW335_DEATH_KNIGHT_BLOOD_STRIKE_ABILITY_ID,
|
||
wow335DeathKnightDesolationAuraDefinition,
|
||
wow335DeathKnightDesolationProfile,
|
||
wow335DeathKnightDesolationShouldTrigger,
|
||
} from "./wow335DeathKnightDesolationRuntime";
|
||
|
||
describe("WoW Death Knight Desolation", () => {
|
||
it("reads +1–5% and the 20-second duration from the generated talent ranks", () => {
|
||
expect([1, 2, 3, 4, 5].map(wow335DeathKnightDesolationProfile)).toEqual([
|
||
{ rank: 1, damageBonus: 0.01, durationMs: 20_000, triggerSpellId: 63_583 },
|
||
{ rank: 2, damageBonus: 0.02, durationMs: 20_000, triggerSpellId: 66_800 },
|
||
{ rank: 3, damageBonus: 0.03, durationMs: 20_000, triggerSpellId: 66_801 },
|
||
{ rank: 4, damageBonus: 0.04, durationMs: 20_000, triggerSpellId: 66_802 },
|
||
{ rank: 5, damageBonus: 0.05, durationMs: 20_000, triggerSpellId: 66_803 },
|
||
]);
|
||
expect(wow335DeathKnightDesolationProfile(0)).toBeNull();
|
||
expect(wow335DeathKnightDesolationProfile(6)).toBeNull();
|
||
});
|
||
|
||
it("triggers only for a landed Blood Strike with a learned Desolation rank", () => {
|
||
expect(wow335DeathKnightDesolationShouldTrigger(5, WOW335_DEATH_KNIGHT_BLOOD_STRIKE_ABILITY_ID, true)).toBe(true);
|
||
expect(wow335DeathKnightDesolationShouldTrigger(5, WOW335_DEATH_KNIGHT_BLOOD_STRIKE_ABILITY_ID, false)).toBe(false);
|
||
expect(wow335DeathKnightDesolationShouldTrigger(5, WOW335_DEATH_KNIGHT_BLOOD_STRIKE_ABILITY_ID, true, false)).toBe(false);
|
||
expect(wow335DeathKnightDesolationShouldTrigger(0, WOW335_DEATH_KNIGHT_BLOOD_STRIKE_ABILITY_ID, true)).toBe(false);
|
||
expect(wow335DeathKnightDesolationShouldTrigger(5, "wow335-death-knight-plague-strike", true)).toBe(false);
|
||
});
|
||
|
||
it("applies the rank's all-damage bonus and refreshes the 20-second aura", () => {
|
||
const definition = wow335DeathKnightDesolationAuraDefinition(5);
|
||
expect(definition).not.toBeNull();
|
||
expect(definition?.modifiers).toEqual([{
|
||
kind: "damage",
|
||
direction: "dealt",
|
||
operation: "percent",
|
||
value: 0.05,
|
||
}]);
|
||
|
||
const first = applyAura([], { definition: definition!, sourceId: "dk", targetId: "dk", now: 1_000 });
|
||
expect(first.aura.expiresAt).toBe(21_000);
|
||
expect(resolveDamageValue(100, first.auras, { direction: "dealt", school: "physical", attackKind: "melee" }))
|
||
.toBe(105);
|
||
expect(resolveDamageValue(100, first.auras, { direction: "dealt", school: "shadow", attackKind: "spell" }))
|
||
.toBe(105);
|
||
|
||
const refreshed = applyAura(first.auras, { definition: definition!, sourceId: "dk", targetId: "dk", now: 15_000 });
|
||
expect(refreshed.auras).toHaveLength(1);
|
||
expect(refreshed.aura.appliedAt).toBe(15_000);
|
||
expect(refreshed.aura.expiresAt).toBe(35_000);
|
||
});
|
||
});
|