修复倭瓜生效后不能在原种植位置种植植物的bug
This commit is contained in:
parent
ced6b55b2b
commit
d2bc785f8e
@ -81,10 +81,11 @@ nuitka --mingw --standalone --onefile --show-progress --show-memory --output-dir
|
||||
## 已知bug
|
||||
|
||||
以下问题囿于个人目前的能力与精力,没有修复:
|
||||
* 所有关卡完成后无法再玩
|
||||
* 植物刚刚种植会立刻攻击,而非像原版一样有间歇时间
|
||||
* 冷冻的僵尸未用蓝色滤镜标识
|
||||
* 这个想不到很好的实现方法,可能会想一种替代方案
|
||||
* 魅惑的僵尸未用红色滤镜标识
|
||||
* 这个可能会作为一种“特性”
|
||||
|
||||
**欢迎提供[Pull requests](https://github.com/wszqkzqk/pypvz/pulls)或修复方法建议,也欢迎在这里反馈新的bug()**
|
||||
|
||||
|
||||
@ -51,6 +51,9 @@ class Map():
|
||||
if '花盆(未实现)' in self.map[map_y][map_x][c.MAP_PLANT]:
|
||||
if ((self.map[map_y][map_x][c.MAP_PLANT] | {'花盆(未实现)', '南瓜头(未实现)'} == {'花盆(未实现)', '南瓜头(未实现)'})
|
||||
and (plantName not in self.map[map_y][map_x][c.MAP_PLANT])): # 例外植物:集合中填花盆和南瓜头,只要这里没有这种植物就能种植;判断方法:并集
|
||||
if plantName in {c.SPIKEWEED}: # 不能在花盆上种植的植物
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
elif plantName == '花盆(未实现)': # 这一格本来没有花盆而且新来的植物是花盆,可以种
|
||||
return True
|
||||
@ -70,6 +73,9 @@ class Map():
|
||||
if c.LILYPAD in self.map[map_y][map_x][c.MAP_PLANT]:
|
||||
if ((self.map[map_y][map_x][c.MAP_PLANT] | {c.LILYPAD, '花盆(未实现)', '南瓜头(未实现)'} == {c.LILYPAD, '花盆(未实现)', '南瓜头(未实现)'})
|
||||
and (plantName not in self.map[map_y][map_x][c.MAP_PLANT])): # 例外植物:集合中填花盆和南瓜头,只要这里没有这种植物就能种植;判断方法:并集
|
||||
if plantName in {c.SPIKEWEED}: # 不能在睡莲上种植的植物
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
@ -567,11 +567,12 @@ class PotatoMine(Plant):
|
||||
|
||||
|
||||
class Squash(Plant):
|
||||
def __init__(self, x, y):
|
||||
def __init__(self, x, y, mapObjSet):
|
||||
Plant.__init__(self, x, y, c.SQUASH, c.PLANT_HEALTH, None)
|
||||
self.orig_pos = (x, y)
|
||||
self.aim_timer = 0
|
||||
self.squashing = False
|
||||
self.mapObjSet = mapObjSet
|
||||
|
||||
def loadImages(self, name, scale):
|
||||
self.idle_frames = []
|
||||
@ -622,6 +623,8 @@ class Squash(Plant):
|
||||
if self.canAttack(zombie):
|
||||
zombie.setDamage(1800, damageType=c.ZOMBIE_RANGE_DAMAGE)
|
||||
self.health = 0 # 避免僵尸在原位啃食
|
||||
print(self.orig_pos)
|
||||
self.mapObjSet.remove(c.SQUASH)
|
||||
self.kill()
|
||||
elif self.aim_timer == 0:
|
||||
self.aim_timer = self.current_time
|
||||
|
||||
@ -498,7 +498,7 @@ class Level(tool.State):
|
||||
elif self.plant_name == c.POTATOMINE:
|
||||
new_plant = plant.PotatoMine(x, y)
|
||||
elif self.plant_name == c.SQUASH:
|
||||
new_plant = plant.Squash(x, y)
|
||||
new_plant = plant.Squash(x, y, self.map.map[map_y][map_x][c.MAP_PLANT])
|
||||
elif self.plant_name == c.SPIKEWEED:
|
||||
new_plant = plant.Spikeweed(x, y)
|
||||
elif self.plant_name == c.JALAPENO:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user