"""Centralized constant values and render assets for zombie_escape."""

from __future__ import annotations

from .config import DEFAULT_CONFIG
from .level_blueprints import GRID_COLS, GRID_ROWS, TILE_SIZE
from .render_assets import FogRing, RenderAssets

# --- Screen and window configuration ---
LOGICAL_SCREEN_WIDTH = 400
LOGICAL_SCREEN_HEIGHT = 300
RENDER_SCREEN_WIDTH = 400
RENDER_SCREEN_HEIGHT = 300
DEFAULT_WINDOW_SCALE = 2.0  # Keep ~800x600 OS window while rendering at 400x300
WINDOW_SCALE_MIN = 1.0
WINDOW_SCALE_MAX = DEFAULT_WINDOW_SCALE * 2  # Allow up to 1600x1200 windows
SCREEN_WIDTH = LOGICAL_SCREEN_WIDTH  # Logical render width
SCREEN_HEIGHT = LOGICAL_SCREEN_HEIGHT  # Logical render height
FPS = 60
STATUS_BAR_HEIGHT = 18

# --- Level dimensions derived from blueprint grid ---
LEVEL_GRID_COLS = GRID_COLS
LEVEL_GRID_ROWS = GRID_ROWS
CELL_SIZE = TILE_SIZE
LEVEL_WIDTH = LEVEL_GRID_COLS * CELL_SIZE
LEVEL_HEIGHT = LEVEL_GRID_ROWS * CELL_SIZE

# --- Player and companion settings ---
PLAYER_RADIUS = 6
PLAYER_SPEED = 1.4
FOV_RADIUS = 80
FOG_RADIUS_SCALE = 1.2
FOG_MAX_RADIUS_FACTOR = 1.55
FOG_HATCH_PIXEL_SCALE = 2
COMPANION_RADIUS = PLAYER_RADIUS
COMPANION_FOLLOW_SPEED = PLAYER_SPEED * 0.7
COMPANION_COLOR = (0, 200, 70)

# --- Survivor settings (Stage 4) ---
SURVIVOR_RADIUS = PLAYER_RADIUS - 1
SURVIVOR_COLOR = (220, 220, 255)
SURVIVOR_APPROACH_RADIUS = 48
SURVIVOR_APPROACH_SPEED = PLAYER_SPEED * 0.35
SURVIVOR_SPAWN_RATE = 0.07
SURVIVOR_MAX_SAFE_PASSENGERS = 5
SURVIVOR_SPEED_PENALTY_PER_PASSENGER = 0.08
SURVIVOR_MIN_SPEED_FACTOR = 0.35
SURVIVOR_OVERLOAD_DAMAGE_RATIO = 0.2
SURVIVOR_MESSAGE_DURATION_MS = 2000
SURVIVOR_CONVERSION_LINE_KEYS = [
    "stages.stage4.conversion_lines.line1",
    "stages.stage4.conversion_lines.line2",
    "stages.stage4.conversion_lines.line3",
]

# --- Flashlight settings ---
DEFAULT_FLASHLIGHT_BONUS_SCALE = float(
    DEFAULT_CONFIG.get("flashlight", {}).get("bonus_scale", 1.35)
)
FLASHLIGHT_WIDTH = 10
FLASHLIGHT_HEIGHT = 8
FLASHLIGHT_PICKUP_RADIUS = 13
DEFAULT_FLASHLIGHT_SPAWN_COUNT = 2

# --- Footprint settings ---
FOOTPRINT_RADIUS = 2
FOOTPRINT_OVERVIEW_RADIUS = 3
FOOTPRINT_COLOR = (110, 200, 255)
FOOTPRINT_STEP_DISTANCE = 40
FOOTPRINT_LIFETIME_MS = 135000
FOOTPRINT_MAX = 320
FOOTPRINT_MIN_FADE = 0.3

# --- Zombie settings ---
ZOMBIE_RADIUS = 6
ZOMBIE_SPEED = 0.6
NORMAL_ZOMBIE_SPEED_JITTER = 0.15
ZOMBIE_SPAWN_DELAY_MS = 5000
MAX_ZOMBIES = 400
INITIAL_ZOMBIES_INSIDE = 15
ZOMBIE_INTERIOR_SPAWN_RATE = 0.015
ZOMBIE_SPAWN_PLAYER_BUFFER = 140
ZOMBIE_MODE_CHANGE_INTERVAL_MS = 5000
ZOMBIE_SIGHT_RANGE = FOV_RADIUS * 2.0
FAST_ZOMBIE_BASE_SPEED = PLAYER_SPEED * 0.81
FAST_ZOMBIE_SPEED_JITTER = 0.075
ZOMBIE_SEPARATION_DISTANCE = ZOMBIE_RADIUS * 2.2

# --- Car and fuel settings ---
CAR_WIDTH = 15
CAR_HEIGHT = 25
CAR_SPEED = 2
CAR_HEALTH = 20
CAR_WALL_DAMAGE = 1
CAR_ZOMBIE_DAMAGE = 1
CAR_HINT_DELAY_MS_DEFAULT = 300000
FUEL_CAN_WIDTH = 11
FUEL_CAN_HEIGHT = 15
FUEL_PICKUP_RADIUS = 12
FUEL_HINT_DURATION_MS = 1600

# --- Wall and beam settings ---
INTERNAL_WALL_GRID_SNAP = CELL_SIZE
INTERNAL_WALL_HEALTH = 40
OUTER_WALL_HEALTH = 9999
STEEL_BEAM_HEALTH = INTERNAL_WALL_HEALTH * 2

# --- Rendering assets shared with draw routines ---
FOG_RINGS = [
    FogRing(radius_factor=0.82, thickness=2),
    FogRing(radius_factor=0.99, thickness=4),
    FogRing(radius_factor=1.16, thickness=6),
    FogRing(radius_factor=1.33, thickness=8),
    FogRing(radius_factor=1.5, thickness=12),
]

RENDER_ASSETS = RenderAssets(
    screen_width=SCREEN_WIDTH,
    screen_height=SCREEN_HEIGHT,
    status_bar_height=STATUS_BAR_HEIGHT,
    player_radius=PLAYER_RADIUS,
    fov_radius=FOV_RADIUS,
    fog_radius_scale=FOG_RADIUS_SCALE,
    fog_max_radius_factor=FOG_MAX_RADIUS_FACTOR,
    fog_hatch_pixel_scale=FOG_HATCH_PIXEL_SCALE,
    fog_rings=FOG_RINGS,
    footprint_radius=FOOTPRINT_RADIUS,
    footprint_overview_radius=FOOTPRINT_OVERVIEW_RADIUS,
    footprint_lifetime_ms=FOOTPRINT_LIFETIME_MS,
    footprint_min_fade=FOOTPRINT_MIN_FADE,
    internal_wall_grid_snap=INTERNAL_WALL_GRID_SNAP,
    default_flashlight_bonus_scale=DEFAULT_FLASHLIGHT_BONUS_SCALE,
)

__all__ = [
    "LOGICAL_SCREEN_WIDTH",
    "LOGICAL_SCREEN_HEIGHT",
    "RENDER_SCREEN_WIDTH",
    "RENDER_SCREEN_HEIGHT",
    "DEFAULT_WINDOW_SCALE",
    "WINDOW_SCALE_MIN",
    "WINDOW_SCALE_MAX",
    "SCREEN_WIDTH",
    "SCREEN_HEIGHT",
    "FPS",
    "STATUS_BAR_HEIGHT",
    "LEVEL_GRID_COLS",
    "LEVEL_GRID_ROWS",
    "CELL_SIZE",
    "LEVEL_WIDTH",
    "LEVEL_HEIGHT",
    "PLAYER_RADIUS",
    "PLAYER_SPEED",
    "FOV_RADIUS",
    "FOG_RADIUS_SCALE",
    "FOG_MAX_RADIUS_FACTOR",
    "FOG_HATCH_PIXEL_SCALE",
    "COMPANION_RADIUS",
    "COMPANION_FOLLOW_SPEED",
    "COMPANION_COLOR",
    "SURVIVOR_RADIUS",
    "SURVIVOR_COLOR",
    "SURVIVOR_APPROACH_RADIUS",
    "SURVIVOR_APPROACH_SPEED",
    "SURVIVOR_SPAWN_RATE",
    "SURVIVOR_MAX_SAFE_PASSENGERS",
    "SURVIVOR_SPEED_PENALTY_PER_PASSENGER",
    "SURVIVOR_MIN_SPEED_FACTOR",
    "SURVIVOR_OVERLOAD_DAMAGE_RATIO",
    "SURVIVOR_MESSAGE_DURATION_MS",
    "SURVIVOR_CONVERSION_LINE_KEYS",
    "DEFAULT_FLASHLIGHT_BONUS_SCALE",
    "FLASHLIGHT_WIDTH",
    "FLASHLIGHT_HEIGHT",
    "FLASHLIGHT_PICKUP_RADIUS",
    "DEFAULT_FLASHLIGHT_SPAWN_COUNT",
    "FOOTPRINT_RADIUS",
    "FOOTPRINT_OVERVIEW_RADIUS",
    "FOOTPRINT_COLOR",
    "FOOTPRINT_STEP_DISTANCE",
    "FOOTPRINT_LIFETIME_MS",
    "FOOTPRINT_MAX",
    "FOOTPRINT_MIN_FADE",
    "ZOMBIE_RADIUS",
    "ZOMBIE_SPEED",
    "NORMAL_ZOMBIE_SPEED_JITTER",
    "ZOMBIE_SPAWN_DELAY_MS",
    "MAX_ZOMBIES",
    "INITIAL_ZOMBIES_INSIDE",
    "ZOMBIE_INTERIOR_SPAWN_RATE",
    "ZOMBIE_SPAWN_PLAYER_BUFFER",
    "ZOMBIE_MODE_CHANGE_INTERVAL_MS",
    "ZOMBIE_SIGHT_RANGE",
    "FAST_ZOMBIE_BASE_SPEED",
    "FAST_ZOMBIE_SPEED_JITTER",
    "ZOMBIE_SEPARATION_DISTANCE",
    "CAR_WIDTH",
    "CAR_HEIGHT",
    "CAR_SPEED",
    "CAR_HEALTH",
    "CAR_WALL_DAMAGE",
    "CAR_ZOMBIE_DAMAGE",
    "CAR_HINT_DELAY_MS_DEFAULT",
    "FUEL_CAN_WIDTH",
    "FUEL_CAN_HEIGHT",
    "FUEL_PICKUP_RADIUS",
    "FUEL_HINT_DURATION_MS",
    "INTERNAL_WALL_GRID_SNAP",
    "INTERNAL_WALL_HEALTH",
    "OUTER_WALL_HEALTH",
    "STEEL_BEAM_HEALTH",
    "FOG_RINGS",
    "RENDER_ASSETS",
]
