31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import type { AbilityEffect } from "./abilityCatalog";
|
|
import { WOW335_TALENT_NODES } from "./wow335Talents.generated";
|
|
|
|
export const WOW335_DEATH_KNIGHT_EPIDEMIC_TALENT_ID = "talent-1963";
|
|
|
|
const DISEASE_TAGS = new Set(["blood-plague", "frost-fever"]);
|
|
const EPIDEMIC_TALENT = WOW335_TALENT_NODES.find(
|
|
(node) => node.id === WOW335_DEATH_KNIGHT_EPIDEMIC_TALENT_ID,
|
|
);
|
|
|
|
/** Read the added disease duration directly from the local generated DBC rank effect. */
|
|
export function wow335DeathKnightEpidemicDurationMs(rank: number): number {
|
|
const normalizedRank = Math.trunc(rank);
|
|
const effect = EPIDEMIC_TALENT?.rankEffects[normalizedRank - 1]?.effects.find(
|
|
(candidate) => candidate.auraType === 107,
|
|
);
|
|
return normalizedRank > 0 ? Math.max(0, effect?.basePoints ?? 0) : 0;
|
|
}
|
|
|
|
/** Extend only Death Knight Blood Plague and Frost Fever by the sourced duration. */
|
|
export function wow335DeathKnightEpidemicDotEffect(
|
|
effect: AbilityEffect,
|
|
rank: number,
|
|
): AbilityEffect {
|
|
if (effect.kind !== "dot" || !effect.tag || !DISEASE_TAGS.has(effect.tag)) return effect;
|
|
const durationMs = wow335DeathKnightEpidemicDurationMs(rank);
|
|
if (durationMs <= 0 || effect.intervalMs <= 0) return effect;
|
|
const additionalTicks = Math.floor(durationMs / effect.intervalMs);
|
|
return additionalTicks > 0 ? { ...effect, ticks: effect.ticks + additionalTicks } : effect;
|
|
}
|