更改啃咬判断机制
This commit is contained in:
parent
02edab3516
commit
41538359d9
@ -1046,10 +1046,10 @@ class Level(tool.State):
|
|||||||
attackableCommonPlants.append(plant)
|
attackableCommonPlants.append(plant)
|
||||||
else:
|
else:
|
||||||
if attackableCommonPlants:
|
if attackableCommonPlants:
|
||||||
# 默认为列表中最后一个
|
# 默认为最右侧的一个植物
|
||||||
targetPlant = attackableCommonPlants[-1]
|
targetPlant = max(attackableCommonPlants, key=lambda i: i.rect.x)
|
||||||
elif attackableBackupPlant:
|
elif attackableBackupPlant:
|
||||||
targetPlant = attackableBackupPlant[-1]
|
targetPlant = max(attackableBackupPlant, key=lambda i: i.rect.x)
|
||||||
map_x, map_y = self.map.getMapIndex(targetPlant.rect.centerx, targetPlant.rect.bottom)
|
map_x, map_y = self.map.getMapIndex(targetPlant.rect.centerx, targetPlant.rect.bottom)
|
||||||
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:
|
||||||
for actualTargetPlant in self.plant_groups[i]:
|
for actualTargetPlant in self.plant_groups[i]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user