![](https://img.haomeiwen.com/i3531127/d3f74803a2bf0ca6.png)
只是为了Mark下,只是为了Mark下,只是为了Mark下!!
我知道:
绝对不是最好的代码,甚至不是好的代码!
绝对需要拼上最好的装备,虽然没用人民币,但是前面积攒的宝石几乎用花了!
照搬也不一定能通过,因为敌人是随机出现的!
![](https://img.haomeiwen.com/i3531127/33a863cd3747bd4f.png)
# 突破重围,进入圣殿,消灭食人魔首领
# 找到生命值最低的盟友
def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = hero.findFriends()
for friend in friends:
if friend.type != "paladin" or friend.type != "soldier":
continue
if friend.health < lowestHealth and friend.health < friend.maxHealth:
lowestHealth = friend.health
lowestFriend = friend
return lowestFriend
def commandPaladin(paladin):
if paladin.canCast("heal", hero):
hero.command(paladin, "cast", "heal", hero)
'''
enemy = paladin.findNearestEnemy()
if enemy:
hero.command(paladin, "attack", enemy)
else:
hero.command(paladin, "shield")
'''
def commandGriffin(friend):
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
else:
pass
def commandPeasant(friend):
item = friend.findNearestItem()
if item:
hero.command(friend, "move", item.pos)
def commandSoldier(friend):
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
else:
pass
def commandArcher(friend):
fang = friend.findNearest(hero.findByType("fangrider"))
enemy = friend.findNearestEnemy()
if fang:
hero.command(friend, "attack", fang)
elif enemy:
hero.command(friend, "attack", enemy)
else:
pass
def commandFriends():
# 指挥你的队友
friends = hero.findFriends()
for friend in friends:
if friend.type == "archer":
commandArcher(friend)
elif friend.type == "soldier":
commandSoldier(friend)
elif friend.type == "griffin-rider":
commandGriffin(friend)
elif friend.type == "paladin":
commandPaladin(friend)
kill = 0
commandFriends()
hero.moveXY(40, 37)
while True:
commandFriends()
mis = hero.findByType("catapult")
for m in mis:
hero.attack(m)
kill += 1
if kill >= 2:
break
hero.moveXY(40, 37)
while hero.gold > hero.costOf("griffin-rider"):
hero.summon("griffin-rider")
commandFriends()
enemies = hero.findEnemies()
for enemy in enemies:
hero.attack(enemy)
kill = 0
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", {"x":100, "y":34})
hero.moveXY(100, 34)
commandFriends()
while True:
commandFriends()
hero.move({"x":hero.pos.x + 5, "y":34})
towers = hero.findByType("tower")
for t in towers:
while t.health > 0:
hero.attack(t)
kill += 1
if kill >= 2:
break
while hero.gold > hero.costOf("griffin-rider"):
hero.summon("griffin-rider")
#commandFriends()
enemies = hero.findEnemies()
for enemy in enemies:
hero.attack(enemy)
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", {"x":160, "y":34})
hero.moveXY(160, 34)
kill = 0
while True:
commandFriends()
hero.move({"x":hero.pos.x + 5, "y":25})
wars = hero.findByType("warlock")
for w in wars:
while w.health > 0:
hero.attack(w)
kill += 1
if kill >= 2:
break
while hero.gold > hero.costOf("griffin-rider"):
hero.summon("griffin-rider")
commandFriends()
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", {"x":274, "y":34})
hero.moveXY(274, 34)
while True:
commandFriends()
boss = hero.findByType("chieftain")
while boss.health > 0:
hero.attack(boss)
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
网友评论