Skip to content

Commit

Permalink
Start initial towers at lvl 2
Browse files Browse the repository at this point in the history
  • Loading branch information
TheApplePieGod committed Jan 22, 2025
1 parent c076a16 commit df10fbb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion battlecode25/engine/game/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions battlecode25/engine/game/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit df10fbb

Please sign in to comment.