Files
healer-man/src/game/wow335DeathKnightBloodGorgedRuntime.test.ts
2026-10-02 10:38:12 -04:00

60 lines
3.6 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
WOW335_DEATH_KNIGHT_BLOOD_GORGED_FAMILY_NAME,
wow335DeathKnightBloodGorgedAffectsSpell,
wow335DeathKnightBloodGorgedArmorPenetrationPercent,
wow335DeathKnightBloodGorgedDamageBonusPercent,
wow335DeathKnightBloodGorgedProfile,
} from "./wow335DeathKnightBloodGorgedRuntime";
const PLAGUE_STRIKE_FLAGS = [0x1, 0, 0] as const;
const BLOOD_STRIKE_FLAGS = [0x400000, 0, 0] as const;
const HEART_STRIKE_FLAGS = [0x1000000, 0, 0] as const;
const NON_MATCHING_FLAGS = [0x2, 0, 0] as const;
describe("WoW 3.3.5 Death Knight Blood Gorged", () => {
it("reads all five local generated ranks and their child spell links", () => {
const profiles = [1, 2, 3, 4, 5].map((rank) => wow335DeathKnightBloodGorgedProfile(rank));
expect(profiles.map((profile) => profile?.damageBonusPercent)).toEqual([2, 4, 6, 8, 10]);
expect(profiles.map((profile) => profile?.armorPenetrationPercent)).toEqual([2, 4, 6, 8, 10]);
expect(profiles.map((profile) => profile?.damageChildSpellId)).toEqual([50096, 50108, 50109, 50110, 50111]);
expect(profiles.map((profile) => profile?.armorChildSpellId)).toEqual([61274, 61275, 61276, 61277, 61278]);
expect(profiles.every((profile) => profile?.damageAuraType === 79
&& profile.armorAuraType === 280
&& profile.damageSchoolMask === 127)).toBe(true);
expect(wow335DeathKnightBloodGorgedProfile(0)).toBeNull();
expect(wow335DeathKnightBloodGorgedProfile(6)).toBeNull();
});
it("follows the local family-15 mask for Plague Strike, Blood Strike, and Heart Strike", () => {
expect(wow335DeathKnightBloodGorgedAffectsSpell(WOW335_DEATH_KNIGHT_BLOOD_GORGED_FAMILY_NAME, PLAGUE_STRIKE_FLAGS))
.toBe(true);
expect(wow335DeathKnightBloodGorgedAffectsSpell(WOW335_DEATH_KNIGHT_BLOOD_GORGED_FAMILY_NAME, BLOOD_STRIKE_FLAGS))
.toBe(true);
expect(wow335DeathKnightBloodGorgedAffectsSpell(WOW335_DEATH_KNIGHT_BLOOD_GORGED_FAMILY_NAME, HEART_STRIKE_FLAGS))
.toBe(true);
expect(wow335DeathKnightBloodGorgedAffectsSpell(0, BLOOD_STRIKE_FLAGS)).toBe(false);
expect(wow335DeathKnightBloodGorgedAffectsSpell(WOW335_DEATH_KNIGHT_BLOOD_GORGED_FAMILY_NAME, NON_MATCHING_FLAGS))
.toBe(false);
expect(wow335DeathKnightBloodGorgedAffectsSpell(15, [-1, 0, 0])).toBe(false);
});
it("requires health strictly above 75% for the damage bonus", () => {
expect(wow335DeathKnightBloodGorgedDamageBonusPercent(5, 751, 1000, 15, BLOOD_STRIKE_FLAGS)).toBe(10);
expect(wow335DeathKnightBloodGorgedDamageBonusPercent(5, 750, 1000, 15, BLOOD_STRIKE_FLAGS)).toBe(0);
expect(wow335DeathKnightBloodGorgedDamageBonusPercent(5, 749, 1000, 15, BLOOD_STRIKE_FLAGS)).toBe(0);
expect(wow335DeathKnightBloodGorgedDamageBonusPercent(3, 100, 100, 15, PLAGUE_STRIKE_FLAGS)).toBe(6);
expect(wow335DeathKnightBloodGorgedDamageBonusPercent(3, 90, 100, 15, NON_MATCHING_FLAGS)).toBe(0);
expect(wow335DeathKnightBloodGorgedDamageBonusPercent(3, 90, 100, 0, BLOOD_STRIKE_FLAGS)).toBe(0);
expect(wow335DeathKnightBloodGorgedDamageBonusPercent(3, 1, 0, 15, BLOOD_STRIKE_FLAGS)).toBe(0);
});
it("keeps armor penetration unconditional on health and gated to local-mask abilities", () => {
expect(wow335DeathKnightBloodGorgedArmorPenetrationPercent(1, 15, BLOOD_STRIKE_FLAGS)).toBe(2);
expect(wow335DeathKnightBloodGorgedArmorPenetrationPercent(5, 15, HEART_STRIKE_FLAGS)).toBe(10);
expect(wow335DeathKnightBloodGorgedArmorPenetrationPercent(5, 15, NON_MATCHING_FLAGS)).toBe(0);
expect(wow335DeathKnightBloodGorgedArmorPenetrationPercent(0, 15, BLOOD_STRIKE_FLAGS)).toBe(0);
});
});