diff --git a/battlecode25/engine/game/game.py b/battlecode25/engine/game/game.py index 06dbb1c..04eba7d 100644 --- a/battlecode25/engine/game/game.py +++ b/battlecode25/engine/game/game.py @@ -56,9 +56,15 @@ def __init__(self, code, initial_map: InitialMap, game_fb: GameFB, game_args): self.id_to_robot: dict[int, RobotInfo] = {} self.robot_exec_order = [] for robot_info in initial_map.initial_bodies: - self.spawn_robot(robot_info.type, robot_info.location, robot_info.team, id=robot_info.id) + robot = self.spawn_robot(robot_info.type, robot_info.location, robot_info.team, id=robot_info.id) self.ruins[self.loc_to_index(robot_info.location)] = True + # Start towers at lvl 2, defer upgrade action until first turn + if robot.type.is_tower_type(): + new_type = robot.type.get_next_level() + robot.upgrade_tower() + self.update_defense_towers(robot.team, new_type) + def run_round(self): if self.running: self.round += 1 diff --git a/battlecode25/engine/game/robot.py b/battlecode25/engine/game/robot.py index 3f69866..2df2141 100644 --- a/battlecode25/engine/game/robot.py +++ b/battlecode25/engine/game/robot.py @@ -95,6 +95,9 @@ def process_beginning_of_round(self): if self.type.money_per_turn != 0: self.game.team_info.add_coins(self.team, self.type.money_per_turn + self.game.count_resource_patterns(self.team) * GameConstants.EXTRA_RESOURCES_FROM_PATTERN) + # Add upgrade action for initial upgrade + if self.type.is_tower_type() and self.game.round == 1 and self.type.level == 2: + self.game.game_fb.add_upgrade_action(self.id, self.type, self.health, self.paint) def process_beginning_of_turn(self): self.action_cooldown