[已解决](猎手和猎物Hunters and Prey)这一关好像有问题bugsssssss

> def pickUpCoin():
>     coin = hero.findNearestItem()
>     hero.move(coin.pos)

> def summonTroops():
>     while hero.gold > hero.costOf("soldier"):
>         hero.summon("soldier")
     
> def commandSoldier(soldier):
>     for soldier in hero.findFriends():
>         enemy = soldier.findNearestEnemy()
>         if enemy:
>             hero.command(soldier, "attack", enemy)

> def commandArcher(archer):
>     for archer in hero.findFriends():
>         enemy = archer.findNearestEnemy()
>         if enemy and archer.distanceTo(enemy) < 25:
>             hero.command(archer, "attack", enemy)
>         else:
>             hero.command(archer, "move", archer.pos)
>     
> while True:
>     pickUpCoin()
>     summonTroops()
>     friends = hero.findFriends()
>     enemy = hero.findNearestEnemy()
>     
>     for friend in friends:
>         if friend.type == "soldier":
>             commandSoldier(friend)
>         elif friend.type == "archer":
>             commandArcher(friend)

报错,报错位置在hero.command(archer, “move”, archer.pos),内容如下,为什么会变成“Reindeer”?求教~

然后改成如下代码,不报错了
但是archer一有敌人来就移动,定位到驯鹿的位置,也会移动
不知道为什么,求教大神

def commandArcher(archer):
    hero.command(archer, "move", {"x":22, "y":archer.pos.y})
    enemy = archer.findNearestEnemy()
    if enemy and archer.distanceTo(enemy) < 25:
        hero.command(archer, "defend", enemy)

一个可怕的事实:我把while True全部不执行,也就是说只是定义了各个函数但是没有调用,运行,archers居然还是行动了(移动+射击),好可怕:joy:

问题在于:commandSoldier(soldier)里命令了所有friends攻击,将这里的代码修改后成功过关