From 4a527d19464f84480c841c1110b48254d843452e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=A4=96=E4=B9=8B=E7=A5=9E?= Date: Sun, 8 May 2022 17:53:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=92=96=E5=95=A1=E8=B1=86bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/component/plant.py | 2 -- source/state/level.py | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/component/plant.py b/source/component/plant.py index 028c9c4..f7d862d 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -1181,12 +1181,10 @@ class CoffeeBean(Plant): def idling(self): if (self.frame_index + 1) == self.frame_num: self.mapContent[c.MAP_SLEEP] = False - # 注意:这里有bug —— 未判断本行的睡眠蘑菇是否在这一格 for plant in self.plant_group: if plant.can_sleep: if plant.state == c.SLEEP: plantMapX, _ = self.map.getMapIndex(plant.rect.centerx, plant.rect.bottom) - print(plantMapX, self.map_x) if plantMapX == self.map_x: plant.state = c.IDLE plant.setIdle() diff --git a/source/state/level.py b/source/state/level.py index cd16aac..840babe 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -491,6 +491,8 @@ class Level(tool.State): for i in self.plant_groups[map_y]: if (x >= i.rect.x and x <= i.rect.right and y >= i.rect.y and y <= i.rect.bottom): + if i.name in {c.HOLE, c.ICE_FROZEN_PLOT}: + continue # 优先移除花盆、睡莲上的植物而非花盆、睡莲本身 if len(self.map.map[map_y][map_x][c.MAP_PLANT]) >= 2: if c.LILYPAD in self.map.map[map_y][map_x][c.MAP_PLANT]: @@ -1233,6 +1235,8 @@ class Level(tool.State): for i in self.plant_groups[map_y]: if (x >= i.rect.x and x <= i.rect.right and y >= i.rect.y and y <= i.rect.bottom): + if i.name in {c.HOLE, c.ICE_FROZEN_PLOT}: + continue # 优先选中睡莲、花盆上的植物 if len(self.map.map[map_y][map_x][c.MAP_PLANT]) >= 2: if c.LILYPAD in self.map.map[map_y][map_x][c.MAP_PLANT]: