import { describe, expect, it } from "vitest"; import { DUNGEON_DEFINITIONS } from "./dungeonRegistry"; import { normalizeEnemyAttack } from "./enemyAttacks"; const NON_HARMFUL_EFFECTS = new Set([ "heal", "aura", "transform", "summon", "call-for-help", "encounter-event", ]); describe("boss mechanic telegraph coverage", () => { it("uses the same warned geometry for every harmful boss area mechanic", () => { let bosses = 0; let mechanics = 0; for (const dungeon of DUNGEON_DEFINITIONS) { for (const entity of Object.values(dungeon.entities)) { if (entity.kind !== "boss" || !entity.combat) continue; bosses += 1; for (const rawAttack of entity.combat.attacks) { const attack = normalizeEnemyAttack(rawAttack); if (attack.id === "basic-attack") continue; mechanics += 1; const harmful = !attack.effect || !NON_HARMFUL_EFFECTS.has(attack.effect.kind); if (harmful && (attack.delivery === "area" || attack.radius !== undefined)) { expect(attack.telegraph, `${dungeon.id}:${entity.name}:${attack.name}`).toBeDefined(); } if (attack.telegraph) { expect(attack.castTimeMs ?? 0, `${dungeon.id}:${entity.name}:${attack.name}`) .toBeGreaterThanOrEqual(attack.telegraph.warningMs); } } } } expect(bosses).toBeGreaterThan(100); expect(mechanics).toBeGreaterThan(300); }); });