""" Shared travel/stamina calculation helpers used by both game logic and map visualization """ import math def calculate_base_stamina_cost(from_location, to_location) -> int: """ Calculate base stamina cost for traveling between two locations. Based purely on Euclidean distance. This is the base cost used by: - Map visualization (to show connection costs) - Game logic (as starting point before player modifiers) Args: from_location: Location object with x, y coordinates to_location: Location object with x, y coordinates Returns: int: Base stamina cost (minimum 1) """ # Calculate Euclidean distance dx = to_location.x - from_location.x dy = to_location.y - from_location.y distance = math.sqrt(dx**2 + dy**2) # Base cost: 3 stamina per distance unit (rounded) # Minimum cost is 1 stamina base_cost = max(1, int(distance * 3 + 0.5)) return base_cost