From 96271fbfe155d57a73dfb20448e2a670a791282d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Wed, 13 Apr 2022 14:36:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=9F=E8=B1=86=E9=9B=B7?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=97=AA=E9=80=80=E7=9A=84bug?= 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 f03b679..b36bb75 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -677,7 +677,15 @@ class Level(tool.State): self.zombie_groups[map_y].remove(zombie) self.hypno_zombie_groups[map_y].add(zombie) elif (plant.name == c.POTATOMINE and not plant.is_init): # 土豆雷不是灰烬植物,不能用Boom - zombie.setDamage(1800) + for i in range(self.map_y_len): + if abs(i - map_y) > plant.explode_y_range: + continue + for zombie in self.zombie_groups[i]: + if ((abs(zombie.rect.centerx - x) <= plant.explode_y_range) or + ((zombie.rect.right - (x-plant.explode_x_range) > 20) or (zombie.rect.right - (x-plant.explode_x_range))/zombie.rect.width > 0.15, ((x+plant.explode_x_range) - zombie.rect.left > 20) or ((x+plant.explode_x_range) - zombie.rect.left)/zombie.rect.width > 0.15)[zombie.rect.x > x]): # 这代码不太好懂,后面是一个判断僵尸在左还是在右,前面是一个元组,[0]是在左边的情况,[1]是在右边的情况 + # 如果以后要区分防具和本体,这里要跟着改动,因为土豆雷不是灰烬植物 + zombie.health -= 1800 + # 避免僵尸在用铲子移除植物后还在原位啃食 plant.health = 0 plant.kill()