Skip to content

Commit

Permalink
Fix tower building exploit
Browse files Browse the repository at this point in the history
  • Loading branch information
hstennes committed Jan 9, 2025
1 parent 7091642 commit 519681b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions battlecode25/engine/game/robot_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ def remove_mark(self, loc: MapLocation) -> None:
self.game.game_fb.add_unmark_action(loc)

def assert_can_complete_tower_pattern(self, tower_type: UnitType, loc: MapLocation) -> None:
tower_type = tower_type.get_base_type()
self.assert_is_robot_type(self.robot.type)
self.assert_is_tower_type(tower_type)
self.assert_can_act_location(loc, GameConstants.BUILD_TOWER_RADIUS_SQUARED)
Expand Down Expand Up @@ -546,6 +547,7 @@ def can_complete_tower_pattern(self, tower_type: UnitType, loc: MapLocation) ->
return False

def complete_tower_pattern(self, tower_type: UnitType, loc: MapLocation) -> None:
tower_type = tower_type.get_base_type()
self.assert_can_complete_tower_pattern(tower_type, loc)
robot = self.game.spawn_robot(tower_type, loc, self.robot.team)
self.game.game_fb.add_spawn_action(robot.id, loc, robot.team, robot.type)
Expand Down

0 comments on commit 519681b

Please sign in to comment.