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

124 lines
4.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import type { AbilityEffect } from "./abilityCatalog";
import { applyAura } from "./combatAuras";
import {
ROM_WARLOCK_MAGE_SOUL_BRAND_STING,
ROM_WARLOCK_MAGE_WILLPOWER_BLADE_STATE_TAG,
romWarlockMageSoulBrandStingHasWillpowerBladeState,
romWarlockMageSoulBrandStingEffects,
} from "./romWarlockMageSoulBrandSting";
import { overrideRomWarlockEffects } from "./romWarlockOverrides";
const row = {
classId: "rom-warlock",
secondaryClassId: "rom-mage",
sourceSkillId: 498710,
name: "Soul Brand Sting",
description: "",
} as const;
describe("Warlock/Mage Soul Brand Sting CoA class helper", () => {
it("retains translated damage and resets Flaming Heart Strike at cast time for the exact pair", () => {
const damage: AbilityEffect = { kind: "damage", coefficient: 1, school: "fire" };
const obsoleteReset: AbilityEffect = { kind: "cooldown-reset", mode: "reduce", amountMs: 5_000 };
expect(romWarlockMageSoulBrandStingEffects(row, [damage, obsoleteReset])).toEqual([
{
kind: "damage",
school: "shadow",
coefficient: 0,
basePoints: 3_737.5,
intellectCoefficient: 1,
bonusPowerCoefficient: 0,
},
{
kind: "damage",
school: "fire",
coefficient: 0,
basePoints: 3_737.5,
intellectCoefficient: 1,
bonusPowerCoefficient: 0,
},
{ kind: "cooldown-reset", mode: "reset", abilityName: "Flaming Heart Strike" },
]);
expect(overrideRomWarlockEffects(row, [damage, obsoleteReset])).toEqual([
{
kind: "damage",
school: "shadow",
coefficient: 0,
basePoints: 3_737.5,
intellectCoefficient: 1,
bonusPowerCoefficient: 0,
},
{
kind: "damage",
school: "fire",
coefficient: 0,
basePoints: 3_737.5,
intellectCoefficient: 1,
bonusPowerCoefficient: 0,
},
{ kind: "cooldown-reset", mode: "reset", abilityName: "Flaming Heart Strike" },
]);
});
it("does not apply the pair effect to another class, secondary class, or skill", () => {
const translated: readonly AbilityEffect[] = [{ kind: "damage", coefficient: 1 }];
expect(romWarlockMageSoulBrandStingEffects({ ...row, secondaryClassId: "rom-priest" }, translated)).toBeNull();
expect(romWarlockMageSoulBrandStingEffects({ ...row, classId: "rom-mage" }, translated)).toBeNull();
expect(romWarlockMageSoulBrandStingEffects({ ...row, sourceSkillId: 498705 }, translated)).toBeNull();
expect(overrideRomWarlockEffects({ ...row, secondaryClassId: "rom-priest" }, translated)).toBeNull();
});
it("marks the observed local Willpower Blade aura and exposes a state predicate without bridging skill IDs", () => {
const stateEffect: AbilityEffect = {
kind: "apply-aura",
aura: { id: "rom-state-497955", name: "Willpower Blade", disposition: "buff", durationMs: null },
sourceEffectType: -1,
sourceAuraType: -1,
miscValue: 0,
triggerSpellId: 497955,
};
const marked = overrideRomWarlockEffects({
classId: "rom-warlock",
sourceSkillId: 497955,
name: "Willpower Blade",
description: "",
}, [stateEffect]);
expect(marked?.[0]).toMatchObject({
kind: "apply-aura",
aura: { utilityTags: [ROM_WARLOCK_MAGE_WILLPOWER_BLADE_STATE_TAG] },
});
const stateAura = applyAura([], {
definition: {
id: "rom-state-497955",
name: "Willpower Blade",
disposition: "buff",
durationMs: null,
utilityTags: [ROM_WARLOCK_MAGE_WILLPOWER_BLADE_STATE_TAG],
},
sourceId: "warlock",
targetId: "warlock",
now: 0,
}).aura;
expect(romWarlockMageSoulBrandStingHasWillpowerBladeState([stateAura])).toBe(true);
expect(romWarlockMageSoulBrandStingHasWillpowerBladeState([])).toBe(false);
});
it("keeps the current CoA source values explicit", () => {
expect(ROM_WARLOCK_MAGE_SOUL_BRAND_STING).toMatchObject({
spellId: 498710,
flamingHeartStrikeSpellId: 498697,
psiCost: 2,
range: 150,
castTimeMs: 1_000,
requiresWillpowerBlade: true,
damageBase: 3_737.5,
intelligenceCoefficient: 1,
damageSchools: ["shadow", "fire"],
});
});
});