import { spellDifficultyFromTier } from "../spells/constants.js"; /** * @typedef {object} SpellDefinition * @property {string} spellId * @property {string} displayName * @property {number} tier Spell tier (sets difficulty and cast flash radius) * @property {import("../combat/magic.js").SpellElement} [element] * @property {"tile"|"entity"} target * @property {boolean} [autoRepeat] Auto-cast repeats while target stays in range * @property {number} [minMagicLevel] Minimum Magic level to cast / favourite * @property {string} description In-world spell description * @property {string} [projectileSprite] fx:projectile:spell-* base name */ export const SpellId = Object.freeze({ light: "light", spark: "spark" }); /** @type {Record} */ export const SPELL_DEFINITIONS = Object.freeze({ [SpellId.light]: Object.freeze({ spellId: SpellId.light, displayName: "Light", tier: 1, element: "none", target: "tile", autoRepeat: false, minMagicLevel: 1, projectileSprite: "fx:projectile:spell-light", description: "A whisper of radiance that settles on stone or grass, holding back the dark for a while." }), [SpellId.spark]: Object.freeze({ spellId: SpellId.spark, displayName: "Spark", tier: 2, element: "fire", target: "entity", autoRepeat: true, minMagicLevel: 2, projectileSprite: "fx:projectile:spell-spark", description: "A snapping mote of flame that leaps at a foe and bites on arrival." }) }); export function spellDefinition (spellId) { return SPELL_DEFINITIONS[spellId] ?? null; } export function spellDifficulty (spellDef) { return spellDifficultyFromTier(spellDef?.tier ?? 1); }