Spaces:
Sleeping
Sleeping
File size: 2,022 Bytes
12d64f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
"""
Gameplay constants for RTS game (costs, power, thresholds, capacities).
Separated for readability and reuse.
"""
from enum import Enum
class UnitType(str, Enum):
INFANTRY = "infantry"
TANK = "tank"
HARVESTER = "harvester"
HELICOPTER = "helicopter"
ARTILLERY = "artillery"
class BuildingType(str, Enum):
HQ = "hq"
BARRACKS = "barracks"
WAR_FACTORY = "war_factory"
REFINERY = "refinery"
POWER_PLANT = "power_plant"
DEFENSE_TURRET = "defense_turret"
# Red Alert Costs (aligned with UI labels)
UNIT_COSTS = {
UnitType.INFANTRY: 100,
UnitType.TANK: 500,
UnitType.ARTILLERY: 600,
UnitType.HELICOPTER: 800,
UnitType.HARVESTER: 200,
}
BUILDING_COSTS = {
BuildingType.HQ: 0,
BuildingType.BARRACKS: 500,
BuildingType.WAR_FACTORY: 800,
BuildingType.REFINERY: 600,
BuildingType.POWER_PLANT: 300,
BuildingType.DEFENSE_TURRET: 400,
}
# Power System - RED ALERT style
POWER_PRODUCTION = {
BuildingType.POWER_PLANT: 100, # Each power plant generates +100 power
BuildingType.HQ: 50, # HQ provides some base power
}
POWER_CONSUMPTION = {
BuildingType.BARRACKS: 20, # Barracks consumes -20 power
BuildingType.WAR_FACTORY: 30, # War Factory consumes -30 power
BuildingType.REFINERY: 10, # Refinery consumes -10 power
BuildingType.DEFENSE_TURRET: 15, # Defense turret consumes -15 power
}
LOW_POWER_THRESHOLD = 0.8 # If power < 80% of consumption, production slows down
LOW_POWER_PRODUCTION_FACTOR = 0.5 # Production speed at 50% when low power
# Harvester constants (Red Alert style)
HARVESTER_CAPACITY = 200
HARVEST_AMOUNT_PER_ORE = 50
HARVEST_AMOUNT_PER_GEM = 100
# Building placement constraints
# Max distance from HQ (in tiles) where new buildings can be placed
HQ_BUILD_RADIUS_TILES = 12
# Gameplay rule: allow multiple buildings of the same type (Barracks, War Factory, etc.)
# If set to False, players can construct only one building per type
ALLOW_MULTIPLE_SAME_BUILDING = True
|