修改土豆雷对撑杆跳的检查机制

This commit is contained in:
星外之神 2022-05-11 13:13:18 +08:00
parent 109265655b
commit 46780ee81e
3 changed files with 17 additions and 18 deletions

View File

@ -144,7 +144,7 @@ class Map():
self.map[map_y][map_x][c.MAP_SLEEP] = sleep self.map[map_y][map_x][c.MAP_SLEEP] = sleep
def removeMapPlant(self, map_x, map_y, plantName): def removeMapPlant(self, map_x, map_y, plantName):
self.map[map_y][map_x][c.MAP_PLANT].remove(plantName) self.map[map_y][map_x][c.MAP_PLANT].discard(plantName)
def getRandomMapIndex(self): def getRandomMapIndex(self):
map_x = random.randint(0, self.width-1) map_x = random.randint(0, self.width-1)

View File

@ -705,7 +705,9 @@ class PotatoMine(Plant):
self.is_init = False self.is_init = False
def canAttack(self, zombie): def canAttack(self, zombie):
if (pg.sprite.collide_circle_ratio(0.55)(zombie, self) and if (self.name == c.POLE_VAULTING_ZOMBIE and (not self.jumped)):
return False
elif (pg.sprite.collide_circle_ratio(0.55)(zombie, self) and
(not self.is_init) and (not zombie.lostHead)): (not self.is_init) and (not zombie.lostHead)):
return True return True
return False return False

View File

@ -1191,10 +1191,7 @@ class Level(tool.State):
# 整理地图信息 # 整理地图信息
if self.bar_type != c.CHOSSEBAR_BOWLING: if self.bar_type != c.CHOSSEBAR_BOWLING:
try: # 避免炸弹等本身就不在集合里面的问题
self.map.removeMapPlant(map_x, map_y, targetPlant.name) self.map.removeMapPlant(map_x, map_y, targetPlant.name)
except KeyError:
pass
# 将睡眠植物移除后更新睡眠状态 # 将睡眠植物移除后更新睡眠状态
if targetPlant.state == c.SLEEP: if targetPlant.state == c.SLEEP:
self.map.map[map_y][map_x][c.MAP_SLEEP] = False self.map.map[map_y][map_x][c.MAP_SLEEP] = False