diff --git a/source/component/map.py b/source/component/map.py index bc4745d..1f65f97 100755 --- a/source/component/map.py +++ b/source/component/map.py @@ -144,7 +144,7 @@ class Map(): self.map[map_y][map_x][c.MAP_SLEEP] = sleep 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): map_x = random.randint(0, self.width-1) diff --git a/source/component/plant.py b/source/component/plant.py index 10c586e..422e122 100755 --- a/source/component/plant.py +++ b/source/component/plant.py @@ -705,7 +705,9 @@ class PotatoMine(Plant): self.is_init = False 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)): return True return False diff --git a/source/state/level.py b/source/state/level.py index 2675802..df1d3dc 100644 --- a/source/state/level.py +++ b/source/state/level.py @@ -408,18 +408,18 @@ class Level(tool.State): self.numZombie = 0 # 新的僵尸生成机制:级别——权重生成 self.createZombieInfo = {# 生成僵尸:(级别, 权重) - c.NORMAL_ZOMBIE:(1, 4000), - c.FLAG_ZOMBIE:(1, 0), - c.CONEHEAD_ZOMBIE:(2, 4000), - c.BUCKETHEAD_ZOMBIE:(4, 3000), - c.NEWSPAPER_ZOMBIE:(2, 1000), - c.FOOTBALL_ZOMBIE:(7, 2000), - c.DUCKY_TUBE_ZOMBIE:(1, 0), # 作为变种,不主动生成 - c.CONEHEAD_DUCKY_TUBE_ZOMBIE:(2, 0), # 作为变种,不主动生成 - c.BUCKETHEAD_DUCKY_TUBE_ZOMBIE:(4, 0), # 作为变种,不主动生成 - c.SCREEN_DOOR_ZOMBIE:(4, 3500), - c.POLE_VAULTING_ZOMBIE:(2, 2000), - } + c.NORMAL_ZOMBIE:(1, 4000), + c.FLAG_ZOMBIE:(1, 0), + c.CONEHEAD_ZOMBIE:(2, 4000), + c.BUCKETHEAD_ZOMBIE:(4, 3000), + c.NEWSPAPER_ZOMBIE:(2, 1000), + c.FOOTBALL_ZOMBIE:(7, 2000), + c.DUCKY_TUBE_ZOMBIE:(1, 0), # 作为变种,不主动生成 + c.CONEHEAD_DUCKY_TUBE_ZOMBIE:(2, 0), # 作为变种,不主动生成 + c.BUCKETHEAD_DUCKY_TUBE_ZOMBIE:(4, 0), # 作为变种,不主动生成 + c.SCREEN_DOOR_ZOMBIE:(4, 3500), + c.POLE_VAULTING_ZOMBIE:(2, 2000), + } # 将僵尸与水上变种对应 self.convertZombieInPool = {c.NORMAL_ZOMBIE:c.DUCKY_TUBE_ZOMBIE, c.CONEHEAD_ZOMBIE:c.CONEHEAD_DUCKY_TUBE_ZOMBIE, @@ -1191,10 +1191,7 @@ class Level(tool.State): # 整理地图信息 if self.bar_type != c.CHOSSEBAR_BOWLING: - try: # 避免炸弹等本身就不在集合里面的问题 - self.map.removeMapPlant(map_x, map_y, targetPlant.name) - except KeyError: - pass + self.map.removeMapPlant(map_x, map_y, targetPlant.name) # 将睡眠植物移除后更新睡眠状态 if targetPlant.state == c.SLEEP: self.map.map[map_y][map_x][c.MAP_SLEEP] = False