Release v0.1.8 2026-07-13
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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<BossMechanicId> = 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"];
|
||||
}
|
||||
Reference in New Issue
Block a user