forked from phenom/healer-man
19 lines
674 B
TypeScript
19 lines
674 B
TypeScript
import type { AbilityDefinition } from "./abilityCatalog";
|
|
|
|
/**
|
|
* Resolves the abilities affected by a cooldown reset. An untargeted reset is
|
|
* the WoW "other abilities" form, so it must never make its source ability
|
|
* immediately available again.
|
|
*/
|
|
export function cooldownResetCandidates(
|
|
abilities: readonly AbilityDefinition[],
|
|
sourceAbilityId: string,
|
|
abilityName?: string,
|
|
): readonly AbilityDefinition[] {
|
|
if (abilityName) {
|
|
const normalizedName = abilityName.toLowerCase();
|
|
return abilities.filter((candidate) => candidate.name.toLowerCase() === normalizedName);
|
|
}
|
|
return abilities.filter((candidate) => candidate.id !== sourceAbilityId);
|
|
}
|