// ─── Room Types ────────────────────────────────────────────────────────────────
// Room types for spire floors
export type { RoomType } from '../types/game';

// Room generation rules:
// - Guardian floors (10, 20, 30, etc.) are ALWAYS guardian type
// - Every 5th floor (5, 15, 25, etc.) has a chance for special rooms
// - Other floors are combat with chance for swarm/speed
export const PUZZLE_ROOM_INTERVAL = 7; // Every 7 floors, chance for puzzle
// NOTE: These constants are used by the legacy room-utils.ts (test-only).
// The active spire system in spire-utils.ts uses its own internal probabilities.
export const SWARM_ROOM_CHANCE = 0.15; // 15% chance for swarm room (legacy)
export const SPEED_ROOM_CHANCE = 0.10; // 10% chance for speed room (legacy)
export const PUZZLE_ROOM_CHANCE = 0.20; // 20% chance for puzzle room on puzzle floors (legacy)

// Puzzle room definitions - themed around attunements
export const PUZZLE_ROOMS: Record<string, {
  name: string;
  attunements: string[];
  baseProgressPerTick: number;
  attunementBonus: number;
  description: string;
}> = {
  enchanter_trial: {
    name: "Enchanter's Trial",
    attunements: ['enchanter'],
    baseProgressPerTick: 0.02,
    attunementBonus: 0.03,
    description: "Decipher ancient enchantment runes."
  },
  fabricator_trial: {
    name: "Fabricator's Trial",
    attunements: ['fabricator'],
    baseProgressPerTick: 0.02,
    attunementBonus: 0.03,
    description: "Construct a mana-powered mechanism."
  },
  invoker_trial: {
    name: "Invoker's Trial",
    attunements: ['invoker'],
    baseProgressPerTick: 0.02,
    attunementBonus: 0.03,
    description: "Commune with guardian spirits."
  },
  hybrid_enchanter_fabricator: {
    name: "Fusion Workshop",
    attunements: ['enchanter', 'fabricator'],
    baseProgressPerTick: 0.015,
    attunementBonus: 0.025,
    description: "Enchant and construct in harmony."
  },
  hybrid_enchanter_invoker: {
    name: "Ritual Circle",
    attunements: ['enchanter', 'invoker'],
    baseProgressPerTick: 0.015,
    attunementBonus: 0.025,
    description: "Bind pact energies into enchantments."
  },
  hybrid_fabricator_invoker: {
    name: "Golem Forge",
    attunements: ['fabricator', 'invoker'],
    baseProgressPerTick: 0.015,
    attunementBonus: 0.025,
    description: "Channel guardian power into constructs."
  },
};

// Swarm room configuration
export const SWARM_CONFIG = {
  minEnemies: 3,
  maxEnemies: 6,
  hpMultiplier: 0.4,  // Each enemy has 40% of normal floor HP
  armorBase: 0,       // Swarm enemies start with no armor
  armorPerFloor: 0.01, // Gain 1% armor per 10 floors
};

// Speed room configuration (dodging enemies)
export const SPEED_ROOM_CONFIG = {
  baseDodgeChance: 0.25,  // 25% base dodge chance
  dodgePerFloor: 0.005,   // +0.5% dodge per floor
  maxDodge: 0.50,         // Max 50% dodge
  speedBonus: 0.5,        // 50% less time to complete if dodged
};

// Armor scaling for normal floors
export const FLOOR_ARMOR_CONFIG = {
  baseChance: 0,          // No armor on floor 1-9
  chancePerFloor: 0.01,   // +1% chance per floor after 10
  maxArmorChance: 0.5,    // Max 50% of floors have armor
  minArmor: 0.05,         // Min 5% armor
  maxArmor: 0.25,         // Max 25% armor on non-guardians
};
