forked from phenom/healer-man
Update Healer Man server
This commit is contained in:
1 parent
39458d5de6
commit
6cc1b9217f
203 files changed
+133929
-31271
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import type { AbilityDefinition } from "./abilityCatalog";
|
||||
|
||||
/** CoA tree node 5744 / source spell 804414: Decapitate is usable below 35% health. */
|
||||
export const COA_BARBARIAN_DECAPITATE_TALENT_ENTRY_ID = 5744;
|
||||
export const COA_BARBARIAN_DECAPITATE_HEALTH_THRESHOLD = 0.35;
|
||||
|
||||
type CoaBarbarianDecapitateIdentity = Pick<AbilityDefinition, "classId" | "talentEntryId">;
|
||||
|
||||
export interface CoaBarbarianExecuteTargetHealth {
|
||||
readonly health?: number;
|
||||
readonly maxHealth?: number;
|
||||
readonly dead?: boolean;
|
||||
}
|
||||
|
||||
export function isCoaBarbarianDecapitate(
|
||||
ability: CoaBarbarianDecapitateIdentity | null | undefined,
|
||||
): boolean {
|
||||
return ability?.classId === "barbarian"
|
||||
&& ability.talentEntryId === COA_BARBARIAN_DECAPITATE_TALENT_ENTRY_ID;
|
||||
}
|
||||
|
||||
/** Other actions pass through; Decapitate requires a living, valid target strictly below 35%. */
|
||||
export function coaBarbarianDecapitateTargetAllowed(
|
||||
ability: CoaBarbarianDecapitateIdentity | null | undefined,
|
||||
target: CoaBarbarianExecuteTargetHealth | null | undefined,
|
||||
): boolean {
|
||||
if (!isCoaBarbarianDecapitate(ability)) return true;
|
||||
if (!target || target.dead === true
|
||||
|| !Number.isFinite(target.health) || !Number.isFinite(target.maxHealth)
|
||||
|| target.health! <= 0 || target.maxHealth! <= 0) return false;
|
||||
return target.health! / target.maxHealth! < COA_BARBARIAN_DECAPITATE_HEALTH_THRESHOLD;
|
||||
}
|
||||
Reference in new issue
Block a user