Update Healer Man server

This commit is contained in:
phenom committed 2026-09-28 22:46:45 -04:00
1 parent 9d7e0e2f9e
commit 35dfdaed61
94 files changed
+17034 -418

No files matched your search

+44 -2
View File
@@ -47,7 +47,47 @@ export function availableDeathKnightRunes(
runes: readonly DeathKnightRuneState[],
now: number,
): readonly DeathKnightRuneState[] {
return runes.filter((rune) => rune.readyAt <= now);
return normalizeDeathKnightRunes(runes, now).filter((rune) => rune.readyAt <= now);
}
export function normalizeDeathKnightRunes(
runes: readonly DeathKnightRuneState[],
now: number,
): readonly DeathKnightRuneState[] {
return Object.freeze(runes.map((rune) => {
if (rune.deathRuneExpiresAt === undefined || rune.deathRuneExpiresAt > now) return rune;
const { deathRuneExpiresAt: _expiredAt, ...baseRune } = rune;
void _expiredAt;
return Object.freeze({ ...baseRune, type: rune.baseType });
}));
}
export function canActivateDeathKnightBloodTapRune(
runes: readonly DeathKnightRuneState[],
now: number,
): boolean {
return normalizeDeathKnightRunes(runes, now).some((rune) => rune.baseType === "blood" && rune.type === "blood");
}
export function activateDeathKnightBloodTapRune(
runes: readonly DeathKnightRuneState[],
now: number,
durationMs: number,
): readonly DeathKnightRuneState[] {
const current = [...normalizeDeathKnightRunes(runes, now)];
const candidate = current
.filter((rune) => rune.baseType === "blood" && rune.type === "blood")
.sort((left, right) => Number(right.readyAt > now) - Number(left.readyAt > now)
|| right.readyAt - left.readyAt || left.slot - right.slot)[0];
if (!candidate) return Object.freeze(current);
return Object.freeze(current.map((rune) => rune.slot === candidate.slot
? Object.freeze({
...rune,
type: "death" as const,
readyAt: Math.min(rune.readyAt, now),
deathRuneExpiresAt: now + Math.max(1, durationMs),
})
: rune));
}
function runeMatches(rune: DeathKnightRuneState, type: Exclude<DeathKnightRuneType, "death">): boolean {
@@ -60,7 +100,9 @@ export function spendDeathKnightRunes(
now: number,
rechargeMs = DEATH_KNIGHT_RUNE_RECHARGE_MS,
): readonly DeathKnightRuneState[] | null {
const current = runes?.length === 6 ? [...runes] : [...createDeathKnightRunes(now)];
const current = [...normalizeDeathKnightRunes(
runes?.length === 6 ? runes : createDeathKnightRunes(now), now,
)];
const spent = new Set<number>();
for (const type of ["blood", "frost", "unholy"] as const) {
const count = Math.max(0, Math.trunc(cost[type] ?? 0));