Update Healer Man server
This commit is contained in:
1 parent
9d7e0e2f9e
commit
35dfdaed61
94 files changed
+17034
-418
No files matched your search
+193
-17
@@ -1,7 +1,13 @@
|
||||
import type { AbilityDefinition, AbilityEffect } from "./abilityCatalog";
|
||||
import { romPriestKnightCastEffects } from "./romPriestKnightOverrides";
|
||||
import { romPriestWarlockCastEffects } from "./romPriestWarlockOverrides";
|
||||
import { romMageWarlockCastEffects } from "./romMageWarlockOverrides";
|
||||
import { romScoutRogueCastEffects } from "./romScoutRogueOverrides";
|
||||
import { romDruidCastEffects } from "./romDruidOverrides";
|
||||
import { romChampionCastEffects } from "./romChampionOverrides";
|
||||
import { romWardenCastEffects } from "./romWardenOverrides";
|
||||
import { romWarlockCastEffects } from "./romWarlockOverrides";
|
||||
import { romKnightCastEffects } from "./romKnightOverrides";
|
||||
|
||||
const ROGUE_BLEED_ABILITIES = new Set([
|
||||
"rom-rogue-primary-1", // Low Blow's conditional Grievous Wound
|
||||
@@ -16,8 +22,19 @@ export interface RomCastMechanics {
|
||||
readonly charged: boolean;
|
||||
readonly mainHandDagger: boolean;
|
||||
readonly casterMaxHealth: number;
|
||||
readonly targetHealthPercent: number;
|
||||
readonly friendlyTargetHealthPercent?: number;
|
||||
readonly naturePower?: number;
|
||||
readonly passiveTags?: readonly string[];
|
||||
readonly learnedPassiveSpellIds?: readonly number[];
|
||||
readonly eruptionProcRoll?: number;
|
||||
readonly targetTags?: readonly string[];
|
||||
readonly slashBleed?: boolean;
|
||||
}
|
||||
|
||||
export interface RomWarriorAbilityAdjustment {
|
||||
readonly rageCostReduction: number;
|
||||
readonly cooldownReductionMs: number;
|
||||
}
|
||||
|
||||
/** Source periodic values for self-sacrifice toggle skills are percentages of HP. */
|
||||
@@ -34,7 +51,74 @@ export function romSingleTargetControl(ability: AbilityDefinition | null): boole
|
||||
|
||||
export function romAbilityNeedsShield(ability: AbilityDefinition): boolean {
|
||||
return ability.source === "runewaker"
|
||||
&& [490175, 490186, 490192, 490468].includes(ability.dbcSpellId);
|
||||
&& [490175, 490186, 490192, 490468, 491333, 491484].includes(ability.dbcSpellId);
|
||||
}
|
||||
|
||||
export function romAbilityNeedsTwoHand(ability: AbilityDefinition): boolean {
|
||||
return ability.source === "runewaker" && [490121, 491142].includes(ability.dbcSpellId);
|
||||
}
|
||||
|
||||
export function romAbilityNeedsRangedWeapon(ability: AbilityDefinition): boolean {
|
||||
return ability.source === "runewaker"
|
||||
&& [490438, 491452, 491616, 494021, 494037, 494039, 494040, 494042, 494629].includes(ability.dbcSpellId);
|
||||
}
|
||||
|
||||
export function romAbilityRequiredTargetStateTag(ability: AbilityDefinition): string | null {
|
||||
if (ability.source !== "runewaker") return null;
|
||||
if (ability.dbcSpellId === 492617) return "rom-weakened";
|
||||
if (ability.dbcSpellId === 491136 || ability.dbcSpellId === 492619) return "rom-vulnerable";
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Source-described Warrior elite passives that reduce a skill's Rage cost and cooldown. */
|
||||
export function romWarriorAbilityAdjustment(
|
||||
ability: AbilityDefinition,
|
||||
learnedPassiveSpellIds: readonly number[],
|
||||
): RomWarriorAbilityAdjustment {
|
||||
if (ability.source !== "runewaker" || ability.classId !== "rom-warrior") {
|
||||
return { rageCostReduction: 0, cooldownReductionMs: 0 };
|
||||
}
|
||||
const passiveIds = new Set(learnedPassiveSpellIds);
|
||||
const rules: Readonly<Record<number, {
|
||||
readonly abilitySpellId: number;
|
||||
readonly rageCostReduction: number;
|
||||
readonly cooldownReductionMs: number;
|
||||
}>> = {
|
||||
491458: { abilitySpellId: 490121, rageCostReduction: 10, cooldownReductionMs: 20_000 }, // Moon Cleave Perfection
|
||||
493248: { abilitySpellId: 490133, rageCostReduction: 20, cooldownReductionMs: 10_000 }, // Exhaustion
|
||||
499491: { abilitySpellId: 490133, rageCostReduction: 25, cooldownReductionMs: 15_000 }, // Whirlwind Battle Technique
|
||||
494377: { abilitySpellId: 490133, rageCostReduction: 10, cooldownReductionMs: 10_000 }, // Recovery of Life
|
||||
499827: { abilitySpellId: 490053, rageCostReduction: 10, cooldownReductionMs: 0 }, // Speed Slash
|
||||
};
|
||||
const applicable = Object.entries(rules)
|
||||
.filter(([passiveSpellId, rule]) => passiveIds.has(Number(passiveSpellId))
|
||||
&& ability.dbcSpellId === rule.abilitySpellId)
|
||||
.map(([, rule]) => rule);
|
||||
return {
|
||||
rageCostReduction: applicable.reduce((sum, rule) => sum + rule.rageCostReduction, 0),
|
||||
cooldownReductionMs: applicable.reduce((sum, rule) => sum + rule.cooldownReductionMs, 0),
|
||||
};
|
||||
}
|
||||
|
||||
/** Heroic Surprise Attack makes Surprise Attack generate five times its usual threat. */
|
||||
export function romWarriorThreatMultiplier(
|
||||
ability: AbilityDefinition,
|
||||
learnedPassiveSpellIds: readonly number[],
|
||||
): number {
|
||||
return ability.source === "runewaker"
|
||||
&& ability.classId === "rom-warrior"
|
||||
&& ability.dbcSpellId === 490129
|
||||
&& learnedPassiveSpellIds.includes(492661)
|
||||
? 5
|
||||
: 1;
|
||||
}
|
||||
|
||||
/** Some Warrior source components mark physical weapon attacks as an untyped spell. */
|
||||
export function romWarriorPhysicalWeaponTooltip(ability: AbilityDefinition): boolean {
|
||||
return ability.source === "runewaker"
|
||||
&& ability.classId === "rom-warrior"
|
||||
&& /\b(?:physical DPS|main hand weapon DPS)\b/i.test(ability.description)
|
||||
&& !/\b(?:Dark|Wind|Fire|Water|Light|Earth) Damage\b/i.test(ability.description);
|
||||
}
|
||||
|
||||
export function romTargetBleedCount(
|
||||
@@ -51,6 +135,21 @@ export function romTargetBleedCount(
|
||||
.map((effect) => effect.sourceAbilityId)).size;
|
||||
}
|
||||
|
||||
export function romTargetHasSlashBleed(
|
||||
effects: readonly {
|
||||
readonly kind: string;
|
||||
readonly sourceAbilityId: string;
|
||||
readonly targetId: string | null;
|
||||
readonly remainingTicks: number;
|
||||
}[],
|
||||
targetId: string | null,
|
||||
): boolean {
|
||||
return Boolean(targetId && effects.some((effect) => effect.kind === "dot"
|
||||
&& effect.remainingTicks > 0
|
||||
&& effect.targetId === targetId
|
||||
&& effect.sourceAbilityId === "rom-warrior-general-0"));
|
||||
}
|
||||
|
||||
function scaleOutput(effect: AbilityEffect, factor: number): AbilityEffect {
|
||||
if (effect.kind !== "damage" && effect.kind !== "dot") return effect;
|
||||
return {
|
||||
@@ -67,18 +166,95 @@ function scaleOutput(effect: AbilityEffect, factor: number): AbilityEffect {
|
||||
export function romEffectsForCast(ability: AbilityDefinition, context: RomCastMechanics): readonly AbilityEffect[] {
|
||||
if (ability.source !== "runewaker") return ability.effects;
|
||||
const priestKnightEffects = romPriestKnightCastEffects(
|
||||
ability, ability.effects, context.passiveTags ?? [], context.casterMaxHealth, context.targetTags ?? [],
|
||||
ability,
|
||||
ability.effects,
|
||||
context.passiveTags ?? [],
|
||||
context.casterMaxHealth,
|
||||
context.targetTags ?? [],
|
||||
context.friendlyTargetHealthPercent ?? 1,
|
||||
context.learnedPassiveSpellIds ?? [],
|
||||
);
|
||||
const mageWarlockEffects = romMageWarlockCastEffects(ability, priestKnightEffects, new Set(context.passiveTags ?? []));
|
||||
const effects = romScoutRogueCastEffects(ability, mageWarlockEffects, context.passiveTags ?? [], context.targetTags ?? []);
|
||||
const damage = effects.filter((effect) => effect.kind === "damage");
|
||||
const priestWarlockEffects = romPriestWarlockCastEffects(
|
||||
ability,
|
||||
priestKnightEffects,
|
||||
context.friendlyTargetHealthPercent ?? 1,
|
||||
);
|
||||
const knightEffects = romKnightCastEffects(ability, priestWarlockEffects, context.passiveTags ?? []);
|
||||
const mageWarlockEffects = romMageWarlockCastEffects(
|
||||
ability,
|
||||
knightEffects,
|
||||
new Set(context.passiveTags ?? []),
|
||||
context.eruptionProcRoll,
|
||||
);
|
||||
const scoutRogueEffects = romScoutRogueCastEffects(ability, mageWarlockEffects, context.passiveTags ?? [], context.targetTags ?? []);
|
||||
const druidEffects = romDruidCastEffects(ability, scoutRogueEffects, context.naturePower ?? 0, context.passiveTags ?? []);
|
||||
const championEffects = romChampionCastEffects(
|
||||
ability, druidEffects, context.targetHealthPercent, context.casterMaxHealth,
|
||||
);
|
||||
const wardenEffects = romWardenCastEffects(
|
||||
ability, championEffects, context.naturePower ?? 0, context.passiveTags ?? [],
|
||||
);
|
||||
const effects = romWarlockCastEffects(
|
||||
ability,
|
||||
wardenEffects,
|
||||
context.targetTags ?? [],
|
||||
context.learnedPassiveSpellIds ?? [],
|
||||
);
|
||||
const warriorPassives = new Set(context.learnedPassiveSpellIds ?? []);
|
||||
const sourceSchoolAdjustedEffects = romWarriorPhysicalWeaponTooltip(ability)
|
||||
? effects.map((effect) => (effect.kind === "damage" || effect.kind === "dot") && effect.school === "arcane"
|
||||
? { ...effect, school: "physical" as const }
|
||||
: effect)
|
||||
: effects;
|
||||
const warriorAdjustedEffects = ability.classId === "rom-warrior" && warriorPassives.has(499806)
|
||||
? sourceSchoolAdjustedEffects.map((effect) => (effect.kind === "damage" || effect.kind === "dot")
|
||||
&& (effect.school === undefined || effect.school === "physical")
|
||||
? scaleOutput(effect, 1.2)
|
||||
: effect)
|
||||
: sourceSchoolAdjustedEffects;
|
||||
const requiredTargetStateTag = romAbilityRequiredTargetStateTag(ability);
|
||||
if (requiredTargetStateTag && !context.targetTags?.includes(requiredTargetStateTag)) return [];
|
||||
const damage = warriorAdjustedEffects.filter((effect) => effect.kind === "damage");
|
||||
const seals = Math.max(0, Math.min(4, context.sealStacks));
|
||||
switch (ability.dbcSpellId) {
|
||||
case 491142: // Tactical Attack's copied Slash bleed only applies when Slash is already bleeding the target.
|
||||
return [
|
||||
...damage,
|
||||
...(context.slashBleed ? warriorAdjustedEffects.filter((effect) => effect.kind === "dot") : []),
|
||||
...warriorAdjustedEffects.filter((effect) => effect.kind !== "damage" && effect.kind !== "dot"
|
||||
&& !(effect.kind === "scripted" && effect.label.startsWith("RoM conditional-use:"))),
|
||||
];
|
||||
case 494021: { // Healing Arrows chooses the Nature's Power HoT when a point is available.
|
||||
const hots = warriorAdjustedEffects.filter((effect) => effect.kind === "hot");
|
||||
const empowered = (context.naturePower ?? 0) >= 1;
|
||||
const selectedHot = empowered ? hots[0] : hots[1] ?? hots[0];
|
||||
return [
|
||||
...(selectedHot ? [selectedHot] : []),
|
||||
...(empowered ? [{ kind: "resource-drain" as const, amount: 1, burn: false, resource: "nature-power" as const }] : []),
|
||||
];
|
||||
}
|
||||
case 493247: // The Final Battle only adds its second hit below 30% target HP.
|
||||
return [
|
||||
...damage.slice(0, context.targetHealthPercent < 0.3 ? 2 : 1),
|
||||
...warriorAdjustedEffects.filter((effect) => effect.kind !== "damage"),
|
||||
];
|
||||
case 490121: // Moon Cleave has three main-hand attack pulses.
|
||||
return [...damage, ...damage, ...damage,
|
||||
...warriorAdjustedEffects.filter((effect) => effect.kind !== "damage")];
|
||||
case 490129: { // Heroic Surprise Attack restores Rage only when its hit lands.
|
||||
if (!warriorPassives.has(492661)) return warriorAdjustedEffects;
|
||||
let attachedRage = false;
|
||||
return warriorAdjustedEffects.map((effect) => {
|
||||
if (effect.kind !== "damage" || attachedRage) return effect;
|
||||
attachedRage = true;
|
||||
return { ...effect, onDamageResource: { resource: "rage", amount: 25 } };
|
||||
});
|
||||
}
|
||||
case 492625: // Infection's poison rider needs Poisonous active.
|
||||
return context.passiveTags?.includes("rom-poisonous")
|
||||
? effects : effects.filter((effect) => effect.kind !== "dot");
|
||||
? warriorAdjustedEffects : warriorAdjustedEffects.filter((effect) => effect.kind !== "dot");
|
||||
case 491156: // Electrostatic Charge's source shield is a percent of max HP.
|
||||
return effects.map((effect) => effect.kind === "apply-aura" && effect.aura.absorbs?.length
|
||||
return warriorAdjustedEffects.map((effect) => effect.kind === "apply-aura" && effect.aura.absorbs?.length
|
||||
? {
|
||||
...effect,
|
||||
aura: {
|
||||
@@ -93,25 +269,25 @@ export function romEffectsForCast(ability: AbilityDefinition, context: RomCastMe
|
||||
case 490150: { // Charge adds two stacks.
|
||||
const gained = ability.dbcSpellId === 490148 ? 1 : 2;
|
||||
const nextStacks = Math.min(4, seals + gained);
|
||||
return effects.map((effect) => effect.kind === "dot" ? scaleOutput(effect, nextStacks) : effect);
|
||||
return warriorAdjustedEffects.map((effect) => effect.kind === "dot" ? scaleOutput(effect, nextStacks) : effect);
|
||||
}
|
||||
case 490313: // Wound Attack: one hit plus one rider per self-applied bleed.
|
||||
return damage.slice(0, 1 + Math.min(2, context.bleedCount));
|
||||
case 490323: // Low Blow only creates Grievous Wound on a bleeding target.
|
||||
return context.bleedCount > 0 ? effects : effects.filter((effect) => effect.kind !== "dot");
|
||||
return context.bleedCount > 0 ? warriorAdjustedEffects : warriorAdjustedEffects.filter((effect) => effect.kind !== "dot");
|
||||
case 491170: // Electric Explosion has mutually exclusive normal/Charged hits.
|
||||
return context.charged ? damage.slice(0, 1) : damage.slice(-1);
|
||||
case 490151: // Punishment spends Holy Seals and scales its one payoff.
|
||||
return seals > 0 ? effects.map((effect) => scaleOutput(effect, seals / 4)) : [];
|
||||
return seals > 0 ? warriorAdjustedEffects.map((effect) => scaleOutput(effect, seals / 4)) : [];
|
||||
case 490153: { // Threaten: target debuffs and extra hit require Holy Seals.
|
||||
const base = damage[0];
|
||||
const threat = effects.find((effect) => effect.kind === "apply-aura" && effect.recipient === "caster");
|
||||
const debuffs = seals > 0 ? effects.filter((effect) => effect.kind === "apply-aura" && effect.recipient !== "caster") : [];
|
||||
const threat = warriorAdjustedEffects.find((effect) => effect.kind === "apply-aura" && effect.recipient === "caster");
|
||||
const debuffs = seals > 0 ? warriorAdjustedEffects.filter((effect) => effect.kind === "apply-aura" && effect.recipient !== "caster") : [];
|
||||
const bonus = seals > 0 && damage.length > 1 ? scaleOutput(damage[damage.length - 1]!, seals / 4) : null;
|
||||
return [...(base ? [base] : []), ...(threat ? [threat] : []), ...debuffs, ...(bonus ? [bonus] : [])];
|
||||
}
|
||||
case 490154: { // Shock: one hit, one stun, plus a seal-dependent rider.
|
||||
const stun = effects.find((effect) => effect.kind === "apply-aura" && effect.control?.kind === "stun");
|
||||
const stun = warriorAdjustedEffects.find((effect) => effect.kind === "apply-aura" && effect.control?.kind === "stun");
|
||||
const scaledStun = stun && stun.kind === "apply-aura"
|
||||
? { ...stun, aura: { ...stun.aura, durationMs: 1_000 * (1 + seals) } }
|
||||
: null;
|
||||
@@ -119,7 +295,7 @@ export function romEffectsForCast(ability: AbilityDefinition, context: RomCastMe
|
||||
return [...(damage[0] ? [damage[0]] : []), ...(scaledStun ? [scaledStun] : []), ...(bonus ? [bonus] : [])];
|
||||
}
|
||||
case 490186: { // Shield Bash shields its caster only when consuming seals.
|
||||
const absorb = effects.find((effect) => effect.kind === "apply-aura" && effect.aura.absorbs?.length);
|
||||
const absorb = warriorAdjustedEffects.find((effect) => effect.kind === "apply-aura" && effect.aura.absorbs?.length);
|
||||
const shield = seals > 0 && absorb?.kind === "apply-aura" ? {
|
||||
...absorb,
|
||||
recipient: "caster" as const,
|
||||
@@ -133,10 +309,10 @@ export function romEffectsForCast(ability: AbilityDefinition, context: RomCastMe
|
||||
return [...(damage[0] ? [damage[0]] : []), ...(shield ? [shield, { kind: "combo" as const, amount: -5 }] : [])];
|
||||
}
|
||||
case 490306: // Shadowstab's bleed needs a main-hand dagger.
|
||||
return context.mainHandDagger ? effects : effects.filter((effect) => effect.kind !== "dot");
|
||||
return context.mainHandDagger ? warriorAdjustedEffects : warriorAdjustedEffects.filter((effect) => effect.kind !== "dot");
|
||||
case 490337: // Sneak Attack always stuns, but its bleed needs a dagger.
|
||||
return context.mainHandDagger ? effects : effects.filter((effect) => effect.kind !== "dot");
|
||||
return context.mainHandDagger ? warriorAdjustedEffects : warriorAdjustedEffects.filter((effect) => effect.kind !== "dot");
|
||||
default:
|
||||
return effects;
|
||||
return warriorAdjustedEffects;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user