// ─── Special Enchantment Effects ─────────────────────────────────────────
// All special-related enchantment effects that can be applied to equipment

import type { EquipmentCategory } from '../equipment'
import type { EnchantmentEffectDef } from '../enchantment-types'

// Helper to define allowed equipment categories for each effect type
const ALL_CASTER: EquipmentCategory[] = ['caster']
const CASTER_AND_HANDS: EquipmentCategory[] = ['caster', 'hands']
const CASTER_CATALYST_ACCESSORY: EquipmentCategory[] = ['caster', 'catalyst', 'accessory']
const FEET_ONLY: EquipmentCategory[] = ['feet']

export const SPECIAL_EFFECTS: Record<string, EnchantmentEffectDef> = {
  // ═══════════════════════════════════════════════════════════════════════════
  // SPECIAL EFFECTS - Unique and powerful effects
  // ═══════════════════════════════════════════════════════════════════════════
  
  spell_echo_10: {
    id: 'spell_echo_10',
    name: 'Echo Chamber',
    description: '10% chance to cast a spell twice',
    category: 'special',
    baseCapacityCost: 60,
    maxStacks: 2,
    allowedEquipmentCategories: ALL_CASTER,
    effect: { type: 'special', specialId: 'spellEcho10' }
  },
  guardian_dmg_10: {
    id: 'guardian_dmg_10',
    name: 'Bane',
    description: '+10% damage to guardians',
    category: 'special',
    baseCapacityCost: 35,
    maxStacks: 3,
    allowedEquipmentCategories: CASTER_CATALYST_ACCESSORY,
    effect: { type: 'multiplier', stat: 'guardianDamage', value: 1.10 }
  },
  overpower_80: {
    id: 'overpower_80',
    name: 'Overpower',
    description: '+50% damage when mana above 80%',
    category: 'special',
    baseCapacityCost: 55,
    maxStacks: 1,
    allowedEquipmentCategories: CASTER_AND_HANDS,
    effect: { type: 'special', specialId: 'overpower' }
  },
  first_strike: {
    id: 'first_strike',
    name: 'First Strike',
    description: '+15% damage on first attack each floor',
    category: 'special',
    baseCapacityCost: 45,
    maxStacks: 1,
    allowedEquipmentCategories: CASTER_AND_HANDS,
    effect: { type: 'special', specialId: 'firstStrike' }
  },
  combo_master: {
    id: 'combo_master',
    name: 'Combo Master',
    description: 'Every 5th attack deals 3x damage',
    category: 'special',
    baseCapacityCost: 65,
    maxStacks: 1,
    allowedEquipmentCategories: CASTER_AND_HANDS,
    effect: { type: 'special', specialId: 'comboMaster' }
  },
  adrenaline_rush: {
    id: 'adrenaline_rush',
    name: 'Adrenaline Rush',
    description: 'Defeating enemy restores 5% mana',
    category: 'special',
    baseCapacityCost: 50,
    maxStacks: 1,
    allowedEquipmentCategories: CASTER_AND_HANDS,
    effect: { type: 'special', specialId: 'adrenalineRush' }
  },

  // ═══════════════════════════════════════════════════════════════════════════
  // ROOM ENCHANTMENT EFFECTS — Feet slot only
  // These create environmental aura effects that scale with room coverage.
  // ═══════════════════════════════════════════════════════════════════════════

  boots_sigil_fire: {
    id: 'boots_sigil_fire',
    name: 'Blazing Footsteps',
    description: 'Room DoT — burn all enemies (5 dmg/tick at 100% coverage)',
    category: 'special',
    baseCapacityCost: 30,
    maxStacks: 1,
    allowedEquipmentCategories: FEET_ONLY,
    effect: { type: 'special', specialId: 'room_fire_damage' }
  },
  boots_sigil_frost: {
    id: 'boots_sigil_frost',
    name: 'Frozen Trail',
    description: 'Enemy slow (10% at 100% coverage)',
    category: 'special',
    baseCapacityCost: 25,
    maxStacks: 1,
    allowedEquipmentCategories: FEET_ONLY,
    effect: { type: 'special', specialId: 'room_frost_debuff' }
  },
  boots_sigil_death: {
    id: 'boots_sigil_death',
    name: 'Necrotic Tread',
    description: 'Room DoT — death damage to all enemies (3 dmg/tick at 100% coverage)',
    category: 'special',
    baseCapacityCost: 25,
    maxStacks: 1,
    allowedEquipmentCategories: FEET_ONLY,
    effect: { type: 'special', specialId: 'room_death_damage' }
  },
  boots_sigil_lightning: {
    id: 'boots_sigil_lightning',
    name: 'Shocking Stride',
    description: 'Single-target chain damage (3 dmg/tick at 100% coverage)',
    category: 'special',
    baseCapacityCost: 28,
    maxStacks: 1,
    allowedEquipmentCategories: FEET_ONLY,
    effect: { type: 'special', specialId: 'room_lightning_damage' }
  },
  boots_sigil_dark: {
    id: 'boots_sigil_dark',
    name: 'Shadow Patch',
    description: 'Enemy dodge reduction (−10% at 100% coverage)',
    category: 'special',
    baseCapacityCost: 22,
    maxStacks: 1,
    allowedEquipmentCategories: FEET_ONLY,
    effect: { type: 'special', specialId: 'room_dark_dodge_debuff' }
  },
  boots_sigil_earth: {
    id: 'boots_sigil_earth',
    name: 'Scoured Earth',
    description: 'Enemy armor reduction (−5% at 100% coverage)',
    category: 'special',
    baseCapacityCost: 28,
    maxStacks: 1,
    allowedEquipmentCategories: FEET_ONLY,
    effect: { type: 'special', specialId: 'room_earth_armor_debuff' }
  },
  boots_sigil_transference_ground: {
    id: 'boots_sigil_transference_ground',
    name: 'Transference Grounds',
    description: 'Player cast speed (+5% at 100% coverage)',
    category: 'special',
    baseCapacityCost: 20,
    maxStacks: 1,
    allowedEquipmentCategories: FEET_ONLY,
    effect: { type: 'special', specialId: 'room_transference_buff' }
  },
  boots_sigil_transference_path: {
    id: 'boots_sigil_transference_path',
    name: 'Conductive Path',
    description: 'Transference mana regen (+10%/hr at 100% coverage)',
    category: 'special',
    baseCapacityCost: 20,
    maxStacks: 1,
    allowedEquipmentCategories: FEET_ONLY,
    effect: { type: 'special', specialId: 'room_transference_regen' }
  },
};
