Files
healer-man/src/game/wow335MageTormentTheWeakRuntime.ts
T
2026-09-30 09:57:13 -04:00

42 lines
1.2 KiB
TypeScript

const TORMENT_THE_WEAK_SPELLS = new Set([
"Frostbolt",
"Fireball",
"Frostfire Bolt",
"Pyroblast",
"Arcane Missiles",
"Arcane Blast",
"Arcane Barrage",
]);
export const WOW335_MAGE_TORMENT_THE_WEAK_TALENT_ID = "talent-2222";
export interface Wow335MageTargetSlow {
readonly kind: string;
readonly endsAt: number;
}
/** Returns the generated Torment the Weak bonus for a Mage hit on this target. */
export function wow335MageTormentTheWeakMultiplier(
rank: number,
abilityName: string,
targetStatuses: readonly Wow335MageTargetSlow[],
now: number,
): number {
const normalizedRank = Math.max(0, Math.min(3, Math.trunc(rank)));
if (normalizedRank <= 0 || !TORMENT_THE_WEAK_SPELLS.has(abilityName)) return 1;
const targetIsSlowed = targetStatuses.some((status) => (
(status.kind === "slow" || status.kind === "attack-speed") && status.endsAt > now
));
return targetIsSlowed ? 1 + normalizedRank * 0.03 : 1;
}
export function wow335MageTormentTheWeakDamage(
amount: number,
rank: number,
abilityName: string,
targetStatuses: readonly Wow335MageTargetSlow[],
now: number,
): number {
return Math.round(amount * wow335MageTormentTheWeakMultiplier(rank, abilityName, targetStatuses, now));
}