34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import type { DamageSchool } from "./itemStats";
|
|
|
|
const MOLTEN_FURY_SCHOOLS = new Set<DamageSchool>(["fire", "frost", "arcane"]);
|
|
|
|
export const WOW335_MAGE_MOLTEN_FURY_TALENT_ID = "talent-1732";
|
|
|
|
/** Returns the local generated Molten Fury multiplier for one eligible Mage hit. */
|
|
export function wow335MageMoltenFuryMultiplier(
|
|
rank: number,
|
|
school: DamageSchool,
|
|
targetHealth: number,
|
|
targetMaxHealth: number,
|
|
): number {
|
|
const normalizedRank = Math.max(0, Math.min(2, Math.trunc(rank)));
|
|
if (normalizedRank <= 0 || !MOLTEN_FURY_SCHOOLS.has(school)
|
|
|| !Number.isFinite(targetHealth) || !Number.isFinite(targetMaxHealth)
|
|
|| targetMaxHealth <= 0 || targetHealth / targetMaxHealth >= 0.35) {
|
|
return 1;
|
|
}
|
|
return 1 + normalizedRank * 0.06;
|
|
}
|
|
|
|
/** Applies Molten Fury to a Mage damage event using the target's pre-hit health. */
|
|
export function wow335MageMoltenFuryDamage(
|
|
amount: number,
|
|
rank: number,
|
|
school: DamageSchool,
|
|
targetHealth: number,
|
|
targetMaxHealth: number,
|
|
): number {
|
|
const multiplier = wow335MageMoltenFuryMultiplier(rank, school, targetHealth, targetMaxHealth);
|
|
return multiplier === 1 ? amount : Math.round(amount * multiplier);
|
|
}
|