极客战记前三章一些较难关卡攻略

 时间:2024-10-28 17:20:03

1、地牢KITHGARD之门# 建造三个围栏来阻挡食人魔!hero.moveDown()hero.buildXY("fence", 36, 34)hero.buildXY("fence", 36, 28)hero.moveRight()hero.moveRight()hero.moveRight()

极客战记前三章一些较难关卡攻略

2、森林 野马while True: # 你怎么寻找最近的友好单位? # 马=? horse = hero.findNearest(hero.findFriends()) if horse: x1 = horse.pos.x - 4 x2 = horse.pos.x + 3 if x1 >= 1: # 移动到马的y坐标,但使用x1作为x坐标。 hero.moveXY(x1, horse.pos.y) elif x2 <= 79: # 移动到马的y坐标,但使用x2作为x坐标。 hero.moveXY(x2, horse.pos.y) distance = hero.distanceTo (horse) if distance <= 10: hero.say("Whoa") # 移到到红色的x来使马返回农场。 hero.moveXY(27, 54) # 移回牧场开始寻找下一匹马。

极客战记前三章一些较难关卡攻略

3、森林 嘲弄# Attack munchkins, call brawlers and ignore burls.# This function defines the hero's behaviour about enemies.def dealEnemy(enemy): # If enemy.type is "munchkin": if enemy.type is "munchkin": hero.attack(enemy) # Then attack it: pass # If the enemy's type is "brawler": if enemy.type is "brawler" : # Then say something to call the brawler: hero.say("help") passwhile True: enemy = hero.findNearestEnemy() if enemy: dealEnemy(enemy) else: hero.moveXY(30, 34)

极客战记前三章一些较难关卡攻略

4、沙漠 哨兵while True: flagGreen = hero.findFlag("green") flagBlack = hero.findFlag("black") if flagGreen: hero.buildXY("fence", flagGreen.pos.x, flagGreen.pos.y) hero.pickUpFlag(flagGreen)# 如果是绿色旗子,就建立一个栅栏。# Build a "fence" at flagGreen's position.# 记住要捡起旗子,在你都完成之后! if flagBlack: # 如果是黑色旗子,就建立一个火焰陷阱 hero.buildXY("fire-trap", flagBlack.pos.x, flagBlack.pos.y) hero.pickUpFlag(flagBlack)# Build a "fire-trap" at flagBlack's position.# 记住要捡起旗子,在你都完成之后 ! else: # 回到中间。 hero.moveXY(43, 31)

极客战记前三章一些较难关卡攻略

5、沙漠 诱饵转# 我们在测试一个新的战斗单位:诱饵(decoy)。# 创建4个诱饵,然后汇报给 NariadecoysBuilt = 0while True: coin = hero.findNearestItem() if coin: # 掠夺金币! hero.moveXY(coin.pos.x, coin.pos.y) pass # 每个诱饵消费25个金币。 # 让它知道当你有超过25个金币的时候 if hero.gold >= 25: # buildXY a "decoy" hero.buildXY("decoy", hero.pos.x, hero.pos.y) # 当你一直走的时候,保持统计你创建的诱饵的数量。 decoysBuilt += 1 if decoysBuilt == 4: # 当你创建了4个诱饵时跳出循环 break pass hero.say("完成创建诱饵!")hero.moveXY(14, 36)# 去找 Naria 并告诉她你创建了多少个诱饵。hero.say("I duilded "+decoysBuilt+" decoys !")

极客战记前三章一些较难关卡攻略

6、沙漠 团队合作# 宝石很快就会消失。 你需要帮助!# findItems()返回一个项目数组。items = hero.findItems()# Get the first gem from the array.# Don't forget that the first index is 0.gem0 = items[0]# # 告诉 Bruno 拿到 gem0hero.say("Bruno " + gem0)# You can reference the gem without a variable.hero.say("Matilda " + items[1])# Create a variable for the last gem, items[2]:gem2 =items[2]# Move to that gem's position using moveXY()hero.moveXY(gem2.pos.x, gem2.pos.y)

极客战记前三章一些较难关卡攻略

7、沙漠 疯狂的MAXwhile True: farthest = None maxDistance = 0 enemyIndex = 0 enemies = hero.findEnemies() # 查看全部敌人,找出最远的那个。 while enemyIndex < len(enemies): target = enemies[enemyIndex] enemyIndex += 1 # 是不是存在远得看不到的敌人? distance = hero.distanceTo(target) if distance > maxDistance: maxDistance = distance farthest = target if farthest: # 干掉最远的敌人! # 如果敌人血量大于0就保持攻击。 while farthest.health > 0: if hero.isReady("cleave"): hero.cleave(farthest) elif hero.isReady("bash"): hero.bash(farthest) else: hero.attack(farthest) pass

极客战记前三章一些较难关卡攻略

8、沙漠 一打宝石# 打败前来劫掠的食人魔,让他们把金币交出来!def findMostHealth(enemies): target = None targetHealth = 0 enemyIndex = 0 while enemyIndex < len(enemies): enemy = enemies[enemyIndex] if enemy.health > targetHealth: target = enemy targetHealth = enemy.health enemyIndex += 1 return targetdef valueOverDistance(item): return item.value / hero.distanceTo(item)# 返回有最高 valueOverDistance(item) 的物品。def findBestItem(items): bestItem = None bestValue = 0 itemsIndex = 0 while itemsIndex < len(items): item = items[itemsIndex] if valueOverDistance(item) > bestValue: bestItem = item bestValue = valueOverDistance(item) itemsIndex += 1 return bestItemwhile True: enemies = hero.findEnemies() enemy = findMostHealth(enemies) if enemy and enemy.health > 15: while enemy.health > 0: hero.attack(enemy) else: coins = hero.findItems() coin = None coin = findBestItem(coins) if coin: hero.moveXY(coin.pos.x, coin.pos.y)

极客战记前三章一些较难关卡攻略
  • 培训类雅思如何备考
  • 家里有盖盖虫怎么消除
  • 炉石传说狂野模式偶数猎怎么玩
  • 三国群英传-争霸联盟洞窟系统
  • 数码宝贝手游中羁绊卡牌有什么用
  • 热门搜索
    我爱祖国手抄报大全 共筑中国梦手抄报 爱的手抄报 关于大自然的手抄报 和谐校园手抄报 简单漂亮元旦节手抄报 爱眼手抄报内容 手抄报图片大全2年级 手抄报模板大全 元宵节手抄报 一等奖