咖啡豆bug修复说明

This commit is contained in:
星外之神 2022-05-08 17:53:26 +08:00
parent 8656af0d59
commit 4a527d1946
2 changed files with 4 additions and 2 deletions

View File

@ -1181,12 +1181,10 @@ class CoffeeBean(Plant):
def idling(self): def idling(self):
if (self.frame_index + 1) == self.frame_num: if (self.frame_index + 1) == self.frame_num:
self.mapContent[c.MAP_SLEEP] = False self.mapContent[c.MAP_SLEEP] = False
# 注意这里有bug —— 未判断本行的睡眠蘑菇是否在这一格
for plant in self.plant_group: for plant in self.plant_group:
if plant.can_sleep: if plant.can_sleep:
if plant.state == c.SLEEP: if plant.state == c.SLEEP:
plantMapX, _ = self.map.getMapIndex(plant.rect.centerx, plant.rect.bottom) plantMapX, _ = self.map.getMapIndex(plant.rect.centerx, plant.rect.bottom)
print(plantMapX, self.map_x)
if plantMapX == self.map_x: if plantMapX == self.map_x:
plant.state = c.IDLE plant.state = c.IDLE
plant.setIdle() plant.setIdle()

View File

@ -491,6 +491,8 @@ class Level(tool.State):
for i in self.plant_groups[map_y]: for i in self.plant_groups[map_y]:
if (x >= i.rect.x and x <= i.rect.right and if (x >= i.rect.x and x <= i.rect.right and
y >= i.rect.y and y <= i.rect.bottom): 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 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]: 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]: for i in self.plant_groups[map_y]:
if (x >= i.rect.x and x <= i.rect.right and if (x >= i.rect.x and x <= i.rect.right and
y >= i.rect.y and y <= i.rect.bottom): 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 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]: if c.LILYPAD in self.map.map[map_y][map_x][c.MAP_PLANT]: