Codecombat's grim determination

Source: Internet
Author: User

#  your goal is to protect  Reynaldo#  find the lowest-life Samurai 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 lowestfrienddef commandpeasant (peasant):     item =  peasant.findnearestitem ()      if item:        hero.command (peasant,  " Move ",  item.pos) Def commandgriffin (Griffin):    target =  Hero.findnearest (Hero.findbytype (' Warlock '))     if target:         hero.command (griffin,  "attack",  target)     else:         target = griffin.findnearestenemy () Def commandPaladin (Paladin):    #  use function  lowesthealthpaladin ()   Find the warrior with the lowest health value and cure      #  You can use  paladin.cancast ("Heal")   and  command (paladin,  "cast",  "Heal",  Target)     #  Samurai can also defend: command (paladin,  "shield")     #  Don't forget they can also attack     target = hero.findnearest (Hero.findbytype (' Warlock '))      if paladin.health&nbSp;< 250:        hero.command (paladin,  "shield")      else:        if paladin.cancast ("Heal"):             healtarget = lowesthealthpaladin ()             # and healtarget and  healtarget.health < 400:             if healtarget:                 hero.command (paladin,  "cast",  "Heal",  healtarget)                  else:             target = paladin.findnearestenemy ()           &Nbsp;  hero.command (paladin,  "attack",  target)              def commandfriends ():    #  command your teammates      friends = hero.findfriends ()     for friend in friends :        if friend.type ==  "Peasant":             commandpeasant (Friend)                      if friend.type  ==  "Griffin-rider":             Commandgriffin (Friend)                      if friend.type ==  "Paladin":              commandpaladin (Friend) while true:    commandfriends ()     #   Summon   Griffin Knight     if hero.gold >= hero.costof ("Griffin-rider"):         hero.summon ("Griffin-rider")


This article is from the "Ops" blog, please make sure to keep this source http://67263992.blog.51cto.com/3718090/1886941

Codecombat's grim determination

Related Keywords:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.