頂峰之門 救我 "python"

大家好,我是新來的,我在頂峰之門卡關,可以請大家幫忙嗎?
這是我的代碼,我不知道如何讓自己回血。

# 突破至聖殿,並擊敗食人魔首領
def attackSikll():
    enemy = hero.findNearestEnemy()
    if enemy and hero.distanceTo(enemy) < 10:
        if hero.isReady("bash"):
            hero.bash(enemy)
        else:
            hero.attack(enemy)

def PickUpcoin():
    item = hero.findNearestItem()
    if item and hero.distanceTo(item):
        hero.move(item.pos)
    
def commandtroop():
    if hero.gold > hero.costOf("griffin-rider"):
        hero.summon("griffin-rider")
    
    
    
while True:
    flag = hero.findFlag("green")
    health = hero.health
    if flag:
        if hero.isReady("jump"):
            hero.jumpTo(flag)
        else:
            hero.pickUpFlag(flag)
    attackSikll()
    PickUpcoin()
    commandtroop()
    friend()
    
    

def friend():
    enemy = hero.findNearest(hero.findEnemies())
    if enemy:
        # 遍歷你所有的士兵,命令他們攻擊。
        soldiers = hero.findFriends()
        soldierIndex = 0
        while soldierIndex<len(soldiers):
            soldier = soldiers[soldierIndex]
            hero.command(soldier, "attack", enemy)
            soldierIndex+=1

謝謝

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

I think he say this

1 Like

And the word below his pic says this and sry to get off topic
image

Please do not post solutions, as it ruins the learning experience for others

1 Like

你可以发一个链接吗?

1 Like

Oh really? I am sorry.
I will remove that.

Thank you
20 charasc

1 Like

Maybe I should intentionally put some mistakes in when I try to help?
Like I post some code that works, but I intentionally put in mistakes, so the guy can learn?
How did you get the lucky title?

Try avoiding posting entire codes, you can post little bits of code to get him/her starting but not entire codes

I won a giveaway hosted by Chaboi in discord

1 Like

maybe he means blood as for health and pinnacle gate as summits gat or smthn? idk

CodeCombat - Coding games to learn Python and JavaScript?
this is my code.
Sorry, my English is not good.

如果你的英文不是很好,也可以用中文沟通
可以描述你的问题吗?还有可以发我你的装备吗?
谢谢

我不知道如何讓血量回血,所以在第2關就死了


謝謝!

Thank you very much for your assistance. After some twists and turns, I broke the barrier. Thank you all for your help.
非常感謝大家的協助,經過一番波折,我破關了。非常感謝大家的幫忙。

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.