Update Healer Man server

This commit is contained in:
phenom committed 2026-10-06 22:25:34 -04:00
1 parent 6114a2295f
commit 69809f7228
593 files changed
+903643 -40774

No files matched your search

+158
View File
@@ -0,0 +1,158 @@
import { describe, expect, it } from "vitest";
import { abilityAtLevel } from "./abilityCatalog";
import type { ActiveAura } from "./combatAuras";
import { WOW335_ABILITIES_BY_CLASS } from "./wow335AbilityCatalog";
import {
enemyControlAbilityCanEscapeAuras,
enemyControlAbilityUsableWhileControlled,
enemyControlImmunityPurgeProofForAbility,
purgeNamedEnemyControlShoutAuras,
} from "./enemyControlImmunityPurge";
function selectedAbility(spellId: number) {
const base = WOW335_ABILITIES_BY_CLASS.warrior.find((ability) => ability.dbcSpellId === spellId);
if (!base) throw new Error(`Missing generated Warrior ability ${spellId}`);
return abilityAtLevel(base, 80);
}
function activeAura(id: string, targetId: string, expiresAt: number | null = 500): ActiveAura {
return {
instanceId: `${targetId}:${id}:enemy-source`,
definition: { id, name: id, disposition: "debuff", durationMs: expiresAt },
sourceId: "enemy-source",
targetId,
appliedAt: 0,
expiresAt,
stacks: 1,
absorbs: [],
procStates: [],
};
}
describe("source-proven enemy control immunity purge", () => {
it("proves Berserker Rage fear purge and its fear-only controlled cast exception from the selected row", () => {
const berserkerRage = selectedAbility(18499);
const proof = enemyControlImmunityPurgeProofForAbility(berserkerRage);
expect(proof).toMatchObject({
sourceProfile: "wow335",
sourceSpellId: 18499,
grantsMechanics: ["fear"],
purgesNamedShoutSpellMechanics: ["fear"],
usableWhileControlledBy: ["fear"],
});
expect(enemyControlAbilityUsableWhileControlled(berserkerRage, "fear")).toBe(true);
expect(enemyControlAbilityUsableWhileControlled(berserkerRage, "stun")).toBe(false);
});
it("proves Bladestorm fear and stun grants, but no controlled-casting bypass", () => {
const bladestorm = selectedAbility(46924);
const proof = enemyControlImmunityPurgeProofForAbility(bladestorm);
expect(proof).toMatchObject({
sourceProfile: "wow335",
sourceSpellId: 46924,
grantsMechanics: ["fear", "stun"],
purgesNamedShoutSpellMechanics: ["fear"],
usableWhileControlledBy: [],
});
expect(enemyControlAbilityUsableWhileControlled(bladestorm, "fear")).toBe(false);
expect(enemyControlAbilityUsableWhileControlled(bladestorm, "stun")).toBe(false);
});
it("fails closed for a changed profile, missing or changed raw flags, and changed aura scalars", () => {
const berserkerRage = selectedAbility(18499);
const defense = berserkerRage.wowSpellDefense!;
const fearAuraIndex = berserkerRage.effects.findIndex((effect) => (
effect.kind === "apply-aura" && effect.sourceAuraType === 77 && effect.miscValue === 5
));
const fearAura = berserkerRage.effects[fearAuraIndex];
if (fearAura.kind !== "apply-aura") throw new Error("Expected source fear immunity aura");
expect(enemyControlImmunityPurgeProofForAbility({
...berserkerRage,
wowSpellDefense: { ...defense, sourceProfile: "ascension" },
})).toBeUndefined();
expect(enemyControlImmunityPurgeProofForAbility({
...berserkerRage,
wowSpellDefense: { ...defense, attributes1: undefined },
})).toBeUndefined();
expect(enemyControlImmunityPurgeProofForAbility({
...berserkerRage,
wowSpellDefense: { ...defense, attributes1: defense.attributes1! ^ 0x00008000 },
})).toBeUndefined();
expect(enemyControlImmunityPurgeProofForAbility({
...berserkerRage,
effects: berserkerRage.effects.map((effect, index) => index === fearAuraIndex
? { ...fearAura, sourceBasePoints: 0 }
: effect),
})).toBeUndefined();
});
it("does not infer active purge from Icebound Fortitude's stun-immunity row", () => {
const base = WOW335_ABILITIES_BY_CLASS["death-knight"].find((ability) => ability.dbcSpellId === 48792);
if (!base) throw new Error("Missing generated Death Knight ability 48792");
const iceboundFortitude = abilityAtLevel(base, 80);
expect(iceboundFortitude.wowSpellDefense?.attributes1).toBe(0);
expect(enemyControlImmunityPurgeProofForAbility(iceboundFortitude)).toBeUndefined();
});
it("removes only active named shout auras on the proven target and retains unrelated state", () => {
const target = "party-warrior";
const proof = enemyControlImmunityPurgeProofForAbility(selectedAbility(18499));
const auras = [
activeAura("enemy-control:source-spell-5246", target),
activeAura("enemy-control:source-spell-19134", target),
activeAura("enemy-control:source-spell-20511", target),
activeAura("enemy-control:source-spell-29544", target),
activeAura("enemy-control:other-control", target),
activeAura("enemy-control:source-spell-5246", "another-party-member"),
activeAura("enemy-control:source-spell-20511", target, 100),
];
const result = purgeNamedEnemyControlShoutAuras(auras, target, proof, 100);
expect(result.removed.map((aura) => aura.definition.id)).toEqual([
"enemy-control:source-spell-5246",
"enemy-control:source-spell-19134",
"enemy-control:source-spell-20511",
"enemy-control:source-spell-29544",
]);
expect(result.auras).toEqual([auras[4], auras[5], auras[6]]);
});
it("does not accept a structurally forged proof", () => {
const aura = activeAura("enemy-control:source-spell-5246", "party-warrior");
const forged = {
sourceProfile: "wow335",
sourceSpellId: 18499,
grantsMechanics: ["fear"],
purgesNamedShoutSpellMechanics: ["fear"],
usableWhileControlledBy: ["fear"],
} as const;
expect(purgeNamedEnemyControlShoutAuras([aura], "party-warrior", forged, 0)).toEqual({
auras: [aura],
removed: [],
});
});
it("allows Berserker Rage through the sourced 20511 stun only when every action-blocking control is covered", () => {
const berserkerRage = selectedAbility(18499);
const sourceChildStun = activeAura("enemy-control:source-spell-20511", "party-warrior");
const genericStun = activeAura("enemy-control:another-caster:another-spell:stun", "party-warrior");
const sourceFear = activeAura("enemy-control:source-spell-5246", "party-warrior");
expect(enemyControlAbilityCanEscapeAuras(
berserkerRage, "stun", [sourceChildStun], "party-warrior", 100,
)).toBe(true);
expect(enemyControlAbilityCanEscapeAuras(
berserkerRage, "stun", [sourceChildStun, genericStun], "party-warrior", 100,
)).toBe(false);
expect(enemyControlAbilityCanEscapeAuras(
berserkerRage, "fear", [sourceFear, genericStun], "party-warrior", 100,
)).toBe(false);
expect(enemyControlAbilityCanEscapeAuras(
berserkerRage, "stun", [sourceFear], "party-warrior", 100,
)).toBe(false);
});
});