// ─── Enchantment Effects Index ───────────────────────────────────────── // Re-exports everything from category-specific files for backward compatibility // Import types import type { EnchantmentEffectCategory, EnchantmentEffectDef } from '../enchantment-types' import type { EquipmentCategory } from '../equipment' // Import all category-specific effect collections import { SPELL_EFFECTS } from './spell-effects' import { MANA_EFFECTS } from './mana-effects' import { COMBAT_EFFECTS } from './combat-effects' import { ELEMENTAL_EFFECTS } from './elemental-effects' import { DEFENSE_EFFECTS } from './defense-effects' import { UTILITY_EFFECTS } from './utility-effects' import { SPECIAL_EFFECTS } from './special-effects' // Merge all effects into a single record for backward compatibility export const ENCHANTMENT_EFFECTS: Record = { ...SPELL_EFFECTS, ...MANA_EFFECTS, ...COMBAT_EFFECTS, ...ELEMENTAL_EFFECTS, ...DEFENSE_EFFECTS, ...UTILITY_EFFECTS, ...SPECIAL_EFFECTS, } // ─── Helper Functions ──────────────────────────────────────────────────────── export function getEnchantmentEffect(id: string): EnchantmentEffectDef | undefined { return ENCHANTMENT_EFFECTS[id]; } export function getEffectsForEquipment(equipmentCategory: EquipmentCategory): EnchantmentEffectDef[] { return Object.values(ENCHANTMENT_EFFECTS).filter(effect => effect.allowedEquipmentCategories.includes(equipmentCategory) ); } export function canApplyEffect(effectId: string, equipmentCategory: EquipmentCategory): boolean { const effect = ENCHANTMENT_EFFECTS[effectId]; if (!effect) return false; return effect.allowedEquipmentCategories.includes(equipmentCategory); } export function calculateEffectCapacityCost(effectId: string, stacks: number, efficiencyBonus: number = 0): number { const effect = ENCHANTMENT_EFFECTS[effectId]; if (!effect) return 0; let totalCost = 0; for (let i = 0; i < stacks; i++) { // Each additional stack costs 20% more const stackMultiplier = 1 + (i * 0.2); totalCost += effect.baseCapacityCost * stackMultiplier; } // Apply efficiency bonus (reduces cost) return Math.floor(totalCost * (1 - efficiencyBonus)); } // Re-export category-specific collections for direct access if needed export type { EnchantmentEffectCategory, EnchantmentEffectDef } from '../enchantment-types'; export { SPELL_EFFECTS, MANA_EFFECTS, COMBAT_EFFECTS, ELEMENTAL_EFFECTS, DEFENSE_EFFECTS, UTILITY_EFFECTS, SPECIAL_EFFECTS, }