「网易官方」极客战记(codecombat)攻略-森林-魔幻的考试-magic-exam

简介

现在开始另一个特殊的挑战吧!

走到有X标记的地方,打开门看看里面有什么。在每一个门里面将会是一个朋友、一个敌人,或者是意见物品。

这里有三个朋友和三个敌人。使用各种法术来帮助盟友并伤害敌人。在法术使用后门将会关闭,因此只有一个目标-一种法术。

这里有三对门(顶部或者底部),有相同颜色的X标记。每次你尝试,那对房间里的盟友和敌人都可以交换位置。

在这个级别除了findNearestEnemy之外,你可以使用findNearestFriend方法,它们的工作方式相同,但找到最近的盟友。

 

friend=hero.findNearestFriend()
if friend:
    hero.cast("heal",friend)

 

阅读提示以了解有关您可以施放的法术的更多信息。

使用您迄今为止学到的所有编码技能,创造性地解决这个难题。

完成这个关卡有多种方法; 试着找到一个大师级的最好的解决方案!

  • Bronze: 3
  • Silver: 12
  • Gold: 21

在这个关卡,你可以使用6种法术。魔法学院没有冷却时间,所以你可以随时使用法术。然而,两次在同一目标上施放咒语没有任何好处。

你能使用的法术有:

  • heal - Immediately heal the target for 300hp.
  • regen - Give the target regeneration, which restores health over time.
  • poison-cloud - An AOE spell which poisons all enemies within 10m of the target.
  • shrink - Reduce the size, mass, and health of the target.
  • force-bolt - A powerful magic bolt which can defeat strong ogres in one shot.
  • grow - Increase the size, mass, and health of the target.

最后两个房间里包含了饮剂瓶。其中一个是"poison",因此,你需要知道如何分辨他们。

首先,你需要使用findNearestitem方法去找到物品。

 

item = hero.findNearestEnemy()

 

然后检查它的type。每个单元或项目都有type属性,它是一个string

健康药水有"potion"标签,毒药水是"poison"标签

 

if item.type == "potion"
    # ...

 

带走一个你需要的项目

 

hero.moveXY(item.pos.x,item.pos.y)

 

就像你看到的,所有房间都配对,每对都有一对效果最好的法术。想想如何通过配对连接法术。

并且,大师喜欢做好准备的勇敢的学生。

也许有可能在没有死亡的情况下收集毒药?

魔幻的考试 解法

# 开放性关卡
 
 
本攻略发于极客战记官方教学栏目,原文地址为:
原文地址:https://www.cnblogs.com/codecombat/p/12718383.html