Update Healer Man server
This commit is contained in:
1 parent
69809f7228
commit
ff20ab8779
101 files changed
+16713
-945
No files matched your search
@@ -1,17 +1,23 @@
|
||||
import type { AbilityDefinition } from "./abilityCatalog";
|
||||
import type { ActiveAura } from "./combatAuras";
|
||||
|
||||
export type EnemyControlImmunityMechanic = "fear" | "stun";
|
||||
export type EnemyControlImmunityMechanic = "charm" | "confuse" | "fear" | "sleep" | "stun";
|
||||
export type EnemyControlCastBlockMechanic = Extract<
|
||||
EnemyControlImmunityMechanic,
|
||||
"confuse" | "fear" | "stun"
|
||||
>;
|
||||
|
||||
export interface EnemyControlImmunityPurgeProof {
|
||||
readonly sourceProfile: "wow335";
|
||||
readonly sourceSpellId: 18499 | 46924;
|
||||
readonly sourceSpellId: 18499 | 46924 | 49039;
|
||||
/** Mechanic immunities proven by the exact selected source aura/effect. */
|
||||
readonly grantsMechanics: readonly EnemyControlImmunityMechanic[];
|
||||
/** Every named shout aura below has spell-level Mechanic=FEAR. */
|
||||
readonly purgesNamedShoutSpellMechanics: readonly "fear"[];
|
||||
/** Core cast-prevention bypasses proven for this selected spell. */
|
||||
readonly usableWhileControlledBy: readonly EnemyControlImmunityMechanic[];
|
||||
readonly usableWhileControlledBy: readonly EnemyControlCastBlockMechanic[];
|
||||
/** Explicit source flags that permit casts through a control aura without purging it. */
|
||||
readonly directCastBypasses: readonly EnemyControlCastBlockMechanic[];
|
||||
}
|
||||
|
||||
const IMMUNITY_PURGES_EFFECT = 0x00008000;
|
||||
@@ -29,7 +35,7 @@ function isExactApplyAura(
|
||||
effect: AbilityDefinition["effects"][number] | undefined,
|
||||
expected: {
|
||||
readonly index: number;
|
||||
readonly spellId: 18499 | 46924;
|
||||
readonly spellId: 18499 | 46924 | 49039;
|
||||
readonly auraType: number;
|
||||
readonly miscValue: number;
|
||||
readonly basePoints: number;
|
||||
@@ -60,25 +66,28 @@ function verifiedProof(
|
||||
function defenseMatches(
|
||||
ability: AbilityDefinition,
|
||||
expected: {
|
||||
readonly spellId: 18499 | 46924;
|
||||
readonly spellId: 18499 | 46924 | 49039;
|
||||
readonly classId: "warrior" | "death-knight";
|
||||
readonly attributes0: number;
|
||||
readonly attributes1: number;
|
||||
readonly attributes3: number;
|
||||
readonly attributes5: number;
|
||||
readonly damageClass: number;
|
||||
readonly schoolMask: number;
|
||||
},
|
||||
): boolean {
|
||||
const defense = ability.wowSpellDefense;
|
||||
return ability.dbcSpellId === expected.spellId
|
||||
&& ability.classId === "warrior"
|
||||
&& ability.classId === expected.classId
|
||||
&& ability.source === "wow335-progression"
|
||||
&& defense?.sourceProfile === "wow335"
|
||||
&& defense.damageClass === expected.damageClass
|
||||
&& defense.schoolMask === 1
|
||||
&& defense.schoolMask === expected.schoolMask
|
||||
&& defense.attributes0 === expected.attributes0
|
||||
&& defense.attributes1 === expected.attributes1
|
||||
&& defense.attributes3 === expected.attributes3
|
||||
&& defense.attributes5 === expected.attributes5
|
||||
&& defense.directDamageFromEffects === false
|
||||
&& Number.isInteger(defense.attributes1)
|
||||
&& Number.isInteger(defense.attributes5)
|
||||
&& (defense.attributes1 & IMMUNITY_PURGES_EFFECT) !== 0;
|
||||
@@ -91,11 +100,13 @@ function berserkerRageProof(ability: AbilityDefinition): EnemyControlImmunityPur
|
||||
|| ability.effects.length !== 3
|
||||
|| !defenseMatches(ability, {
|
||||
spellId: 18499,
|
||||
classId: "warrior",
|
||||
attributes0: 327696,
|
||||
attributes1: 32768,
|
||||
attributes3: 0,
|
||||
attributes5: 0,
|
||||
damageClass: 0,
|
||||
schoolMask: 1,
|
||||
})) return undefined;
|
||||
|
||||
const [fear, sap, incapacitate] = ability.effects;
|
||||
@@ -115,6 +126,7 @@ function berserkerRageProof(ability: AbilityDefinition): EnemyControlImmunityPur
|
||||
grantsMechanics: Object.freeze(["fear"]),
|
||||
purgesNamedShoutSpellMechanics: Object.freeze(["fear"]),
|
||||
usableWhileControlledBy: Object.freeze(["fear"]),
|
||||
directCastBypasses: Object.freeze([]),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -125,11 +137,13 @@ function bladestormProof(ability: AbilityDefinition): EnemyControlImmunityPurgeP
|
||||
|| ability.effects.length !== 4
|
||||
|| !defenseMatches(ability, {
|
||||
spellId: 46924,
|
||||
classId: "warrior",
|
||||
attributes0: 327696,
|
||||
attributes1: 32784,
|
||||
attributes3: 1024,
|
||||
attributes5: 512,
|
||||
damageClass: 2,
|
||||
schoolMask: 1,
|
||||
})) return undefined;
|
||||
|
||||
const sourceAuras = ability.effects.filter((effect) => effect.kind === "apply-aura");
|
||||
@@ -157,16 +171,55 @@ function bladestormProof(ability: AbilityDefinition): EnemyControlImmunityPurgeP
|
||||
grantsMechanics: Object.freeze(["fear", "stun"]),
|
||||
purgesNamedShoutSpellMechanics: Object.freeze(["fear"]),
|
||||
usableWhileControlledBy: Object.freeze([]),
|
||||
directCastBypasses: Object.freeze([]),
|
||||
});
|
||||
}
|
||||
|
||||
/** Returns a source-pinned purge/cast proof only for the two audited WoW 3.3.5a rows. */
|
||||
function lichborneProof(ability: AbilityDefinition): EnemyControlImmunityPurgeProof | undefined {
|
||||
if (ability.id !== "wow335-death-knight-lichborne"
|
||||
|| ability.name !== "Lichborne"
|
||||
|| ability.target !== "self"
|
||||
|| ability.effects.length !== 3
|
||||
|| !defenseMatches(ability, {
|
||||
spellId: 49039,
|
||||
classId: "death-knight",
|
||||
attributes0: 262144,
|
||||
attributes1: 163872,
|
||||
attributes3: 0,
|
||||
attributes5: 393224,
|
||||
damageClass: 0,
|
||||
schoolMask: 32,
|
||||
})) return undefined;
|
||||
|
||||
const [charm, fear, sleep] = ability.effects;
|
||||
if (!isExactApplyAura(charm, {
|
||||
index: 0, spellId: 49039, auraType: 77, miscValue: 1, basePoints: 0, dieSides: 1,
|
||||
})
|
||||
|| !isExactApplyAura(fear, {
|
||||
index: 1, spellId: 49039, auraType: 77, miscValue: 5, basePoints: 0, dieSides: 0,
|
||||
}) || !fear.aura.controlImmunities?.includes("fear")
|
||||
|| !isExactApplyAura(sleep, {
|
||||
index: 2, spellId: 49039, auraType: 77, miscValue: 10, basePoints: 0, dieSides: 0,
|
||||
}) || !sleep.aura.controlImmunities?.includes("sleep")) return undefined;
|
||||
|
||||
return verifiedProof({
|
||||
sourceProfile: "wow335",
|
||||
sourceSpellId: 49039,
|
||||
grantsMechanics: Object.freeze(["charm", "fear", "sleep"]),
|
||||
purgesNamedShoutSpellMechanics: Object.freeze(["fear"]),
|
||||
usableWhileControlledBy: Object.freeze(["fear", "stun", "confuse"]),
|
||||
directCastBypasses: Object.freeze(["fear", "stun", "confuse"]),
|
||||
});
|
||||
}
|
||||
|
||||
/** Returns a source-pinned purge/cast proof only for the three audited WoW 3.3.5a rows. */
|
||||
export function enemyControlImmunityPurgeProofForAbility(
|
||||
ability: AbilityDefinition | null | undefined,
|
||||
): EnemyControlImmunityPurgeProof | undefined {
|
||||
if (!ability) return undefined;
|
||||
if (ability.dbcSpellId === 18499) return berserkerRageProof(ability);
|
||||
if (ability.dbcSpellId === 46924) return bladestormProof(ability);
|
||||
if (ability.dbcSpellId === 49039) return lichborneProof(ability);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -175,24 +228,26 @@ export function enemyControlAbilityUsableWhileControlled(
|
||||
ability: AbilityDefinition | null | undefined,
|
||||
mechanic: EnemyControlImmunityMechanic,
|
||||
): boolean {
|
||||
return enemyControlImmunityPurgeProofForAbility(ability)?.usableWhileControlledBy.includes(mechanic) ?? false;
|
||||
return enemyControlImmunityPurgeProofForAbility(ability)?.usableWhileControlledBy
|
||||
.some((allowed) => allowed === mechanic) ?? false;
|
||||
}
|
||||
|
||||
const NON_ACTION_BLOCKING_CONTROL_MECHANICS = new Set(["root", "slow", "interrupt"]);
|
||||
|
||||
/**
|
||||
* The Berserker Rage fear exception also covers the Fear-mechanic 20511 child
|
||||
* while it applies a stun effect. It does not cover a separate stun aura.
|
||||
* Berserker Rage and Lichborne can use the Fear-mechanic 20511 child while it
|
||||
* applies a stun effect. Lichborne's exact row also permits separate stun and
|
||||
* confuse states; those auras stay active because the row grants no such purge.
|
||||
*/
|
||||
export function enemyControlAbilityCanEscapeAuras(
|
||||
ability: AbilityDefinition | null | undefined,
|
||||
mechanic: EnemyControlImmunityMechanic,
|
||||
mechanic: EnemyControlCastBlockMechanic,
|
||||
auras: readonly ActiveAura[],
|
||||
targetId: string,
|
||||
now: number,
|
||||
): boolean {
|
||||
const proof = enemyControlImmunityPurgeProofForAbility(ability);
|
||||
if (!proof || proof.sourceSpellId !== 18499 || !Number.isFinite(now)) return false;
|
||||
if (!proof || !Number.isFinite(now)) return false;
|
||||
const activeControlAuras = auras.filter((aura) => aura.targetId === targetId
|
||||
&& (aura.expiresAt === null || aura.expiresAt > now)
|
||||
&& aura.definition.id.startsWith("enemy-control:"));
|
||||
@@ -200,21 +255,47 @@ export function enemyControlAbilityCanEscapeAuras(
|
||||
|
||||
const allPreventingAurasAreCovered = activeControlAuras.every((aura) => {
|
||||
const id = aura.definition.id;
|
||||
if (NAMED_SHOUT_AURA_IDS.has(id)) return true;
|
||||
if (NAMED_SHOUT_AURA_IDS.has(id)) {
|
||||
return proof.purgesNamedShoutSpellMechanics.includes("fear");
|
||||
}
|
||||
const suffix = id.slice("enemy-control:".length);
|
||||
if (suffix.startsWith("source-spell-")) return false;
|
||||
const sourceMechanic = suffix.split(":").at(-1);
|
||||
return sourceMechanic !== undefined
|
||||
&& NON_ACTION_BLOCKING_CONTROL_MECHANICS.has(sourceMechanic);
|
||||
&& (NON_ACTION_BLOCKING_CONTROL_MECHANICS.has(sourceMechanic)
|
||||
|| proof.directCastBypasses.some((allowed) => allowed === sourceMechanic));
|
||||
});
|
||||
if (!allPreventingAurasAreCovered) return false;
|
||||
|
||||
if (mechanic === "fear") {
|
||||
return enemyControlAbilityUsableWhileControlled(ability, "fear")
|
||||
const canPurgeNamedShout = proof.purgesNamedShoutSpellMechanics.includes("fear")
|
||||
&& activeControlAuras.some((aura) => NAMED_SHOUT_AURA_IDS.has(aura.definition.id));
|
||||
const canBypassGenericFear = proof.directCastBypasses.includes("fear")
|
||||
&& activeControlAuras.some((aura) => {
|
||||
const suffix = aura.definition.id.slice("enemy-control:".length);
|
||||
return !NAMED_SHOUT_AURA_IDS.has(aura.definition.id)
|
||||
&& !suffix.startsWith("source-spell-")
|
||||
&& suffix.split(":").at(-1) === "fear";
|
||||
});
|
||||
return enemyControlAbilityUsableWhileControlled(ability, "fear")
|
||||
&& (canPurgeNamedShout || canBypassGenericFear);
|
||||
}
|
||||
return mechanic === "stun"
|
||||
&& activeControlAuras.some((aura) => aura.definition.id === "enemy-control:source-spell-20511");
|
||||
if (mechanic === "stun") {
|
||||
const canCastThroughSourceChild = activeControlAuras.some(
|
||||
(aura) => aura.definition.id === "enemy-control:source-spell-20511",
|
||||
) && (enemyControlAbilityUsableWhileControlled(ability, "fear")
|
||||
|| enemyControlAbilityUsableWhileControlled(ability, "stun"));
|
||||
const canCastThroughDirectStun = proof.directCastBypasses.includes("stun")
|
||||
&& activeControlAuras.some((aura) => {
|
||||
const suffix = aura.definition.id.slice("enemy-control:".length);
|
||||
return !suffix.startsWith("source-spell-") && suffix.split(":").at(-1) === "stun";
|
||||
});
|
||||
return canCastThroughSourceChild || canCastThroughDirectStun;
|
||||
}
|
||||
return mechanic === "confuse"
|
||||
&& proof.directCastBypasses.includes("confuse")
|
||||
&& activeControlAuras.some((aura) => aura.definition.id.slice("enemy-control:".length)
|
||||
.split(":").at(-1) === "confuse");
|
||||
}
|
||||
|
||||
export interface EnemyControlShoutAuraPurgeResult {
|
||||
|
||||
Reference in new issue
Block a user