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]: