import { BOSS_DEFINITIONS } from "./bossCatalog"; import type { BossId, BossMechanicId } from "./types"; /** Mechanics that cannot be resolved safely when two bosses own them at once. */ export const ENCOUNTER_EXCLUSIVE_MECHANICS: ReadonlySet = new Set(["memory-sequence"]); export function canAddBossToEncounter(selectedBossIds: readonly BossId[], candidateBossId: BossId) { if (selectedBossIds.includes(candidateBossId)) return false; const candidateMechanics = BOSS_DEFINITIONS[candidateBossId].mechanicIds; for (const mechanicId of candidateMechanics) { if (!ENCOUNTER_EXCLUSIVE_MECHANICS.has(mechanicId)) continue; if (selectedBossIds.some((bossId) => BOSS_DEFINITIONS[bossId].mechanicIds.includes(mechanicId))) return false; } return true; } export function normalizeEncounterBossIds(requestedBossIds: readonly BossId[], limit = 3): BossId[] { const selected: BossId[] = []; for (const bossId of requestedBossIds) { if (selected.length >= limit) break; if (canAddBossToEncounter(selected, bossId)) selected.push(bossId); } return selected.length ? selected : ["bulldrome"]; }