Skip to content

Commit

Permalink
Merge branch 'main' into public-release
Browse files Browse the repository at this point in the history
  • Loading branch information
TheApplePieGod committed Jan 29, 2025
2 parents 5198e0c + b6ff185 commit 6152ac9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions battlecode25/engine/game/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def run_turn(robot: Robot):
if self.team_info.get_execution_time(robot.team) >= GameConstants.MAX_TEAM_EXECUTION_TIME:
self.resign(robot.team)
if robot.disintegrated:
self.destroy_robot(robot.id)
self.destroy_robot(robot.id, True)

if self.running:
self.round += 1
Expand All @@ -94,7 +94,7 @@ def run_turn(robot: Robot):

def stop(self):
self.running = False
self.each_robot_update(lambda robot: self.destroy_robot(robot.id))
self.each_robot_update(lambda robot: self.destroy_robot(robot.id, False))

def move_robot(self, start_loc, end_loc):
self.add_robot_to_loc(end_loc, self.get_robot(start_loc))
Expand Down Expand Up @@ -183,14 +183,16 @@ def spawn_robot(self, type: UnitType, loc: MapLocation, team: Team, id=None):
self.team_info.add_defense_damage_increase(team, GameConstants.EXTRA_DAMAGE_FROM_DEFENSE_TOWER)
return robot

def destroy_robot(self, id):
def destroy_robot(self, id, is_turn):
robot: Robot = self.id_to_robot[id]
self.robot_exec_order.remove(id)
del self.id_to_robot[id]
self.remove_robot_from_loc(robot.loc)
robot.kill()
self.game_fb.add_die_action(id, False)
self.game_fb.add_died(id)
if is_turn:
self.game_fb.add_die_action(id, False)
else:
self.game_fb.add_died(id)
self.team_info.add_unit_count(robot.team, -1)
damage_decrease = 0
if robot.type == UnitType.LEVEL_ONE_DEFENSE_TOWER:
Expand Down
2 changes: 1 addition & 1 deletion battlecode25/engine/game/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def add_health(self, amount):
self.health += amount
self.health = min(self.health, self.type.health)
if self.health <= 0:
self.game.destroy_robot(self.id)
self.game.destroy_robot(self.id, True)

def calc_paint_cooldown_multiplier(self):
paint_percent = self.paint / self.type.paint_capacity
Expand Down
Binary file removed maps/DefaultSmall.map25
Binary file not shown.

0 comments on commit 6152ac9

Please sign in to comment.