Hello, on the level “grim determination” i receive message: "Line 37: command’s argument minion should have type unit, but not object: Taric. Hero Placeholder (team humans) can’t command Taric (team ogres)"
My code:
def commandGriffin(friend):
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
def commandPeasant(fr):
items = fr.findItems()
item = fr.findNearest(items)
hero.command(fr, "move", item.pos)
# Найти паладина с самым низким количеством здоровья.
def lowestHealthPaladin():
lowestHealth = 99999
lowestFriend = None
friends = hero.findFriends()
for friend in friends:
if friend.type != "paladin":
continue
if friend.health < lowestHealth and friend.health < friend.maxHealth:
lowestHealth = friend.health
lowestFriend = friend
return lowestFriend
def commandPaladin(paladin):
# Полечи паладина с низким количеством здоровья используя lowestHealthPaladin()
needH = lowestHealthPaladin()
if needH:
if paladin.canCast("heal"):
hero.command(paladin, "cast", "heal", needH)
# Ты можешь использовать paladin.canCast ("heal") и command(paladin, "cast", "heal", target)
# Паладины также могут использовать щит: command(paladin, "shield")
hero.command(paladin, "shield")
enemy = paladin.findNearestEnemy()
if enemy:
hero.command(paladin, "attack", enemy)
def commandFriends():
# Командуй своими союзниками.
friends = hero.findFriends()
#pal = 0
for friend in friends:
if friend.type == "peasant":
commandPeasant(friend)
pass
elif friend.type == "griffin-rider":
commandGriffin(friend)
pass
elif friend.type == "paladin":
#if hero.now() < 3 or hero.now() > 15:
#hero.say(friend.name+", "+friend.id)
#pal +=1
commandPaladin(friend)
#if hero.now() < 3 or hero.now() > 15:
# hero.say("Number of paladins: "+pal)
while True:
commandFriends()
#if hero.now() > 9 and hero.now() < 15:
#enemies = hero.findEnemies()
#for enemy in enemies:
#hero.say(enemy.type +", "+ enemy.name +", "+enemy.id)
if hero.gold >= hero.costOf("griffin-rider"):
hero.summon("griffin-rider")
How can i fix it?