zoukankan      html  css  js  c++  java
  • 「网易官方」极客战记(codecombat)攻略-沙漠-钥匙陷阱-key-traps

    (点击图片进入关卡)

    这些钥匙是如此近,但不要急于亲自拿。

    简介

    你必须释放圣骑士。要做到这一点,你需要三个钥匙。

    使用你的宠物来获得这些钥匙。 不要试图用你的英雄收集他们。

    默认代码

    # 获得三把钥匙并释放圣骑士。
    def onSpawn(event):
        # 宠物需要找到并拿回3个钥匙。
        # 您需要下一个类型的物品:
        # "bronze-key", "silver-key"和 "gold-key"

     

    pet.on("spawn", onSpawn)
    while True:
        enemy = hero.findNearestEnemy()
        if enemy and enemy.team == "ogres":
            hero.attack(enemy)
        if hero.health < 300:
            # 你也可以在主线程中使用宠物
            potion = pet.findNearestByType("potion")
            if potion:
                hero.moveXY(potion.pos.x, potion.pos.y)

    概览

    你已经掌握了最近这个关卡所需的技能。 如果您在这个关卡遇到问题,请尝试返回并重新掌握您的技能。

    注意物品类型和拼写错误。 物品类型是字符串。

    提醒你一下:

    potion = pet.findNearestByType("potion")
    pet.fetch(potion)

    钥匙陷阱 解法

    # 获得三把钥匙并释放圣骑士。
    def onSpawn(event):
        # 宠物需要找到并拿回3个钥匙。
        # 您需要下一个类型的物品:
        # "bronze-key", "silver-key"和 "gold-key"
        pet.fetch(pet.findNearestByType("bronze-key"))
        pet.fetch(pet.findNearestByType("silver-key"))
        pet.fetch(pet.findNearestByType("gold-key"))
    pet.on("spawn", onSpawn)
    while True:
        enemy = hero.findNearestEnemy()
        if enemy and enemy.team == "ogres":
            hero.attack(enemy)
        if hero.health < 300:
            # 你也可以在主线程中使用宠物
            potion = pet.findNearestByType("potion")
            if potion:
                hero.moveXY(potion.pos.x, potion.pos.y)
     
    本攻略发于极客战记官方教学栏目,原文地址为:
     
  • 相关阅读:
    使用 linux kernel +busybox 定制linux系统
    记一次golang的内存泄露
    关于Queries_per_sec 性能计数器
    NUMA导致的MySQL服务器SWAP问题分析
    Drop Table对MySQL的性能影响分析
    当MySQL数据库遇到Syn Flooding
    tcp_tw_recycle参数引发的数据库连接异常
    一例数据同步异常问题分析
    MySQL大量线程处于Opening tables的问题分析
    MySQL DeadLock故障排查过程
  • 原文地址:https://www.cnblogs.com/codecombat/p/13222989.html
Copyright © 2011-2022 走看看