Skip to content

Commit 6152ac9

Browse files
Merge branch 'main' into public-release
2 parents 5198e0c + b6ff185 commit 6152ac9

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

battlecode25/engine/game/game.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def run_turn(robot: Robot):
7474
if self.team_info.get_execution_time(robot.team) >= GameConstants.MAX_TEAM_EXECUTION_TIME:
7575
self.resign(robot.team)
7676
if robot.disintegrated:
77-
self.destroy_robot(robot.id)
77+
self.destroy_robot(robot.id, True)
7878

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

9595
def stop(self):
9696
self.running = False
97-
self.each_robot_update(lambda robot: self.destroy_robot(robot.id))
97+
self.each_robot_update(lambda robot: self.destroy_robot(robot.id, False))
9898

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

186-
def destroy_robot(self, id):
186+
def destroy_robot(self, id, is_turn):
187187
robot: Robot = self.id_to_robot[id]
188188
self.robot_exec_order.remove(id)
189189
del self.id_to_robot[id]
190190
self.remove_robot_from_loc(robot.loc)
191191
robot.kill()
192-
self.game_fb.add_die_action(id, False)
193-
self.game_fb.add_died(id)
192+
if is_turn:
193+
self.game_fb.add_die_action(id, False)
194+
else:
195+
self.game_fb.add_died(id)
194196
self.team_info.add_unit_count(robot.team, -1)
195197
damage_decrease = 0
196198
if robot.type == UnitType.LEVEL_ONE_DEFENSE_TOWER:

battlecode25/engine/game/robot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def add_health(self, amount):
4545
self.health += amount
4646
self.health = min(self.health, self.type.health)
4747
if self.health <= 0:
48-
self.game.destroy_robot(self.id)
48+
self.game.destroy_robot(self.id, True)
4949

5050
def calc_paint_cooldown_multiplier(self):
5151
paint_percent = self.paint / self.type.paint_capacity

maps/DefaultSmall.map25

-1.95 KB
Binary file not shown.

0 commit comments

Comments
 (0)