From 445e6488d671a8765667cae12f885b1c2d574be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Thu, 12 May 2022 22:55:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=83=E5=92=AC=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E5=88=A4=E6=96=ADbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/state/level.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/source/state/level.py b/source/state/level.py index 8bbe4c6..6fcbac0 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -1046,19 +1046,22 @@ class Level(tool.State): if zombie.state != c.ATTACK: continue # 没有新的植物种下时不用刷新 - elif not self.newPlantAndPositon: + if not self.newPlantAndPositon: continue - else: - # 被攻击对象是植物时才可能刷新 - if zombie.prey_is_plant: - # 新植物种在被攻击植物同一格时才可能刷新 + # 被攻击对象是植物时才可能刷新 + if zombie.prey_is_plant: + # 新植物种在被攻击植物同一格时才可能刷新 + mapX, mapY = self.map.getMapIndex(zombie.prey.rect.centerx, zombie.prey.rect.centery) + if (mapX, mapY) == self.newPlantAndPositon[1]: # 如果被攻击植物是睡莲和花盆,同一格种了植物必然刷新 - mapX, mapY = self.map.getMapIndex(zombie.prey.rect.centerx, zombie.prey.rect.centery) - if ((mapX, mapY) == self.newPlantAndPositon[1] and - (zombie.prey.name not in {c.LILYPAD, "花盆(未实现)"})): - # 如果被攻击植物不是睡莲和花盆,同一格种了南瓜头才刷新 - if self.newPlantAndPositon[0] != "南瓜头(未实现)": - continue + # 如果被攻击植物不是睡莲和花盆,同一格种了南瓜头才刷新 + if ((zombie.prey.name not in {c.LILYPAD, "花盆(未实现)"}) + and (self.newPlantAndPositon[0] != "南瓜头(未实现)")): + continue + else: + continue + else: + continue if zombie.canSwim and (not zombie.swimming): continue