import type { AbilityEffect } from "./abilityCatalog"; import type { RomGeneratedAbilityLike } from "./romAbilitySemantics"; // NPC spell mitigation models these five resistance fields. RuneWaker's // Elemental Weakness component (500365) is an all-resistance −30 modifier; // expand it so the debuff affects the same fields used by damage resolution. const MODELED_MAGIC_RESISTANCES = ["arcane", "fire", "frost", "nature", "shadow"] as const; const MODELED_MAGICAL_DAMAGE_SCHOOLS = ["arcane", "fire", "frost", "holy", "nature", "shadow"] as const; const ROM_MAGE_FIRE_WARD_RADIUS = 10; export function overrideRomMageEffects( row: RomGeneratedAbilityLike, translated: readonly AbilityEffect[], ): readonly AbilityEffect[] | null { if (row.classId !== "rom-mage") return null; // Meditative Current is a hit-triggered passive, not an always-on haste // aura. Its exact trigger and cooldown are applied by romMageRuntime. if (row.sourceSkillId === 493262) return []; // Light of Day is a landed-hit proc for Mage/Knight builds, not an always-on // damage aura. Its trigger and internal cooldown are applied at hit time. if (row.sourceSkillId === 493034) return []; if (row.sourceSkillId === 490248) { return translated.map((effect) => { if (effect.kind !== "apply-aura") return effect; const existingModifiers = effect.aura.modifiers ?? []; return { ...effect, scope: "party", radius: ROM_MAGE_FIRE_WARD_RADIUS, aura: { ...effect.aura, description: "Current CoA reduces received magical damage by 11.5%. The simulator keeps RuneWaker's +10 Fire resistance and 10-minute duration; CoA lists +230 at skill level 105, but no scaling curve is modeled.", modifiers: [ ...existingModifiers, ...MODELED_MAGICAL_DAMAGE_SCHOOLS.map((school) => ({ kind: "damage" as const, direction: "taken" as const, school, operation: "percent" as const, value: -0.115, })), ], }, }; }); } if (row.sourceSkillId !== 490247) return null; return translated.map((effect) => { if (effect.kind !== "apply-aura") return effect; const modifiers = effect.aura.modifiers ?? []; if (!modifiers.some((modifier) => modifier.kind === "stat" && modifier.stat === "all-resistance")) { return effect; } return { ...effect, aura: { ...effect.aura, modifiers: modifiers.flatMap((modifier) => modifier.kind === "stat" && modifier.stat === "all-resistance" ? MODELED_MAGIC_RESISTANCES.map((school) => ({ ...modifier, stat: `resistance:${school}` })) : [modifier]), }, }; }); }