"""Tuning constants, palettes, and progression tables for Underdepths. All magic numbers live here so balancing is a one-file edit. """ from __future__ import annotations # --- Grid / viewport -------------------------------------------------------- # TILE: int = 24 MAP_WIDTH: int = 80 MAP_HEIGHT: int = 50 SIGHT_RADIUS: int = 8 FLOORS: int = 10 MAX_LEVEL: int = 10 # --- Base palette / colors -------------------------------------------------- # # Tiles COLORS: dict[str, tuple[int, int, int]] = { "wall_visible": (60, 60, 70), "wall_explored": (30, 30, 35), "floor_visible": (40, 35, 30), "floor_explored": (20, 18, 15), "void": (6, 5, 8), # entity accent hues (dominant sprite color per type) "player": (225, 225, 235), "rat": (150, 110, 75), "goblin": (95, 165, 75), "skeleton_archer": (215, 215, 205), "orc_warrior": (155, 55, 50), "wraith": (160, 95, 205), "green_slime": (125, 205, 85), "ancient_dragon": (205, 65, 50), # feature / item accents "stairs": (240, 220, 80), "weapon": (240, 220, 80), # yellow "armor": (95, 145, 230), # blue "potion": (220, 85, 85), # red "scroll": (95, 220, 220), # cyan # UI "ui_border": (150, 130, 95), "ui_border_hi": (200, 180, 130), "ui_bg": (15, 12, 18), "ui_panel": (24, 20, 28), "hp_full": (190, 55, 60), "hp_back": (60, 22, 24), "xp_full": (90, 170, 230), "xp_back": (26, 34, 48), "log_combat": (235, 235, 235), "log_damage": (225, 90, 90), "log_levelup": (130, 225, 100), "log_item": (240, 220, 90), "log_miss": (170, 170, 170), "prompt": (245, 235, 180), "shadow": (0, 0, 0), "highlight": (255, 255, 255), } # Sprite-palette keys (single chars in data/sprites.py grids) -> RGB. # "." is transparent. Keys are intentionally short; phase 4 sprites use them. PALETTE: dict[str, tuple[int, int, int] | None] = { ".": None, # transparent "K": (18, 14, 20), # dark outline "k": (40, 32, 38), # soft outline "W": (95, 85, 72), # warm light shade (stone/skin highlight) "s": (62, 56, 50), # mid shade (stone/skin) "h": (38, 33, 30), # dark shade (stone/skin shadow) "d": (24, 20, 18), # deep shadow "w": (245, 245, 250), # white (bone / sclera) "g": (120, 200, 80), # green (goblin / slime) "G": (70, 150, 55), # dark green "r": (200, 60, 50), # red (orc / dragon) "R": (140, 35, 30), # dark red "p": (160, 95, 205), # purple (wraith) "P": (95, 55, 140), # dark purple "b": (95, 145, 230), # blue (armor / magic) "y": (240, 220, 80), # yellow (stairs / weapon / gold) "o": (225, 150, 60), # orange (fire / accents) "c": (95, 220, 220), # cyan (scroll) "m": (220, 85, 85), # muted red (potion) "e": (90, 230, 120), # eye glow green "E": (120, 200, 255), # eye glow blue } # --- Progression: XP and level-up tables (plan.md §7) ----------------------- # # Cumulative XP required to REACH a given level (keyed by level 1..10). XP_THRESHOLDS: dict[int, int] = { 1: 0, 2: 30, 3: 70, 4: 140, 5: 250, 6: 400, 7: 600, 8: 850, 9: 1150, 10: 1500, } # Stat gains applied when leveling INTO a given level. LEVEL_HP_GAIN: dict[int, int] = {2: 10, 3: 10, 4: 10, 5: 10, 6: 15, 7: 15, 8: 15, 9: 15, 10: 20} LEVEL_POWER_GAIN: dict[int, int] = {2: 1, 3: 1, 4: 1, 5: 1, 6: 2, 7: 2, 8: 2, 9: 2, 10: 3} # --- Player base stats (plan.md §7) ---------------------------------------- # PLAYER_BASE: dict[str, int | float] = { "hp": 50, "max_hp": 50, "power": 4, "armor": 0, "accuracy": 5, "evasion": 2, "crit_chance": 0.10, "speed": 1, } # --- Per-floor spawn distribution (plan.md §1) ----------------------------- # # (min, max) enemies / items per floor. Floor 9 is the boss arena. ENEMY_COUNT: dict[int, tuple[int, int]] = { 0: (3, 4), 1: (3, 4), 2: (4, 6), 3: (4, 6), 4: (5, 7), 5: (5, 7), 6: (6, 8), 7: (6, 8), 8: (7, 9), } ITEM_COUNT: dict[int, tuple[int, int]] = { 0: (2, 3), 1: (2, 3), 2: (2, 3), 3: (2, 3), 4: (3, 4), 5: (3, 4), 6: (3, 4), 7: (3, 4), 8: (4, 5), 9: (2, 2), } # --- Key bindings (plan.md Controls) --------------------------------------- # # Map of intent -> pygame key constant names; resolved in phase 4 input layer. KEY_BINDINGS: dict[str, list[str]] = { "move_n": ["K_UP", "K_k"], "move_s": ["K_DOWN", "K_j"], "move_w": ["K_LEFT", "K_h"], "move_e": ["K_RIGHT", "K_l"], "pickup": ["K_g"], "inventory": ["K_i"], "equipment": ["K_e"], "quaff": ["K_q"], "read": ["K_r"], "descend": ["K_f"], "save_quit": ["K_s"], "help": ["K_QUESTION"], "mute": ["K_m"], "cancel": ["K_ESCAPE"], }