From 8cd22a114038da4a17be44ac7c2f929e4f9be3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Tue, 2 Aug 2022 14:49:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=97=E7=93=9C=E5=A4=B4bu?= =?UTF-8?q?g=E2=80=9C=E5=AE=89=E5=80=8D=E6=99=8B=E4=B8=89=E7=9A=84?= =?UTF-8?q?=E4=BF=9D=E9=95=96=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/state/level.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/state/level.py b/source/state/level.py index 84b31ee..9914f52 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -1076,11 +1076,19 @@ class Level(tool.State): # 在生效状态下忽略啃食碰撞但其他状况下不能忽略的情形 elif plant.name in c.SKIP_ZOMBIE_COLLISION_CHECK_WHEN_WORKING: if not plant.start_boom: - attackable_common_plants.append(plant) + attackable_common_plants.append(plant) else: if attackable_common_plants: # 默认为最右侧的一个植物 target_plant = max(attackable_common_plants, key=lambda i: i.rect.x) + map_x, map_y = self.map.getMapIndex(target_plant.rect.centerx, target_plant.rect.centery) + if c.PUMPKINHEAD in self.map.map[map_y][map_x][c.MAP_PLANT]: + for actual_target_plant in self.plant_groups[i]: + # 检测同一格的其他植物 + if self.map.getMapIndex(actual_target_plant.rect.centerx, actual_target_plant.rect.bottom) == (map_x, map_y): + if actual_target_plant.name == c.PUMPKINHEAD: + target_plant = actual_target_plant + break elif attackable_backup_plants: target_plant = max(attackable_backup_plants, key=lambda i: i.rect.x) map_x, map_y = self.map.getMapIndex(target_plant.rect.centerx, target_plant.rect.centery)