From 5556852ba68d9ab96d1d9e7366ec4c99b003efb8 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, 17 Apr 2022 20:57:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=AA=E9=80=80bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/constants.py | 2 +- source/state/level.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/constants.py b/source/constants.py index b2331d2..958478f 100755 --- a/source/constants.py +++ b/source/constants.py @@ -105,7 +105,7 @@ MAP_STATE_TILE = {MAP_PLANT:set(), MAP_SLEEP:False, MAP_PLOT_TYPE:MAP_TILE} BACKGROUND_OFFSET_X = 220 MAP_OFFSET_X = 35 MAP_OFFSET_Y = 100 -MAP_POOL_OFFSET_X = 35 # 暂时还不清楚数据 +MAP_POOL_OFFSET_X = 40 # 暂时还不清楚数据 MAP_POOL_OFFSET_Y = 115 # 暂时还不清楚数据 MAP_ROOF_OFFSET_X = 35 # 暂时还不清楚数据 MAP_ROOF_OFFSET_Y = 105 # 暂时还不清楚数据 diff --git a/source/state/level.py b/source/state/level.py index 4ed1390..30b9efb 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -535,7 +535,7 @@ class Level(tool.State): #print('addPlant map[%d,%d], grid pos[%d, %d] pos[%d, %d]' % (map_x, map_y, x, y, pos[0], pos[1])) def setupHintImage(self): - pos = self.canSeedPlant() + pos = self.canSeedPlant(self.plant_name) if pos and self.mouse_image: if (self.hint_image and pos[0] == self.hint_rect.x and pos[1] == self.hint_rect.y): @@ -670,11 +670,13 @@ class Level(tool.State): x, y = plant.getPosition() map_x, map_y = self.map.getMapIndex(x, y) if self.bar_type != c.CHOSSEBAR_BOWLING: - # 更改地图类型、添加南瓜头、睡莲、花盆后可能也需要改这里 - self.map.removeMapPlant(map_x, map_y, plant.name) + try: + self.map.removeMapPlant(map_x, map_y, plant.name) + except KeyError: + pass # 将睡眠植物移除后更新睡眠状态 if plant.state == c.SLEEP: - self.map[map_y][map_x][c.MAP_SLEEP] = False + self.map.map[map_y][map_x][c.MAP_SLEEP] = False # 用铲子铲不用触发植物功能 if not shovel: if (plant.name == c.CHERRYBOMB or plant.name == c.JALAPENO or