forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
4c768fbec6
commit
b16821e92e
330 files changed
+35406
-1760
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { WOW335_TALENT_NODES } from "./wow335Talents.generated";
|
||||
|
||||
export const WOW335_WARRIOR_DAMAGE_SHIELD_TALENT_ID = "talent-2246";
|
||||
export const WOW335_WARRIOR_DAMAGE_SHIELD_ABILITY_ID = "wow335-warrior-damage-shield";
|
||||
|
||||
const DAMAGE_SHIELD_SOURCE = WOW335_TALENT_NODES.find((node) => (
|
||||
node.id === WOW335_WARRIOR_DAMAGE_SHIELD_TALENT_ID
|
||||
));
|
||||
|
||||
/**
|
||||
* Returns the generated-rank block-value reflection for a landed direct melee
|
||||
* hit. The generated tooltip is the authoritative source for both the 10/20%
|
||||
* values and the direct-melee trigger.
|
||||
*/
|
||||
export function wow335WarriorDamageShieldReflectDamage(
|
||||
blockValue: number,
|
||||
rank: number,
|
||||
directMeleeHit: boolean,
|
||||
): number {
|
||||
const safeRank = Math.min(2, Math.max(0, Math.trunc(Number.isFinite(rank) ? rank : 0)));
|
||||
if (safeRank === 0 || !directMeleeHit || !Number.isFinite(blockValue) || blockValue <= 0) return 0;
|
||||
|
||||
const rankDescription = DAMAGE_SHIELD_SOURCE?.rankDescriptions[safeRank - 1];
|
||||
const percentage = Number(rankDescription?.match(/damage equal to (\d+)% of your block value/i)?.[1]);
|
||||
if (!Number.isFinite(percentage) || percentage <= 0) return 0;
|
||||
return Math.max(0, Math.round(blockValue * percentage / 100));
|
||||
}
|
||||
Reference in new issue
Block a user