[SOLVED] The One Wizard Bonus Help!

hello guys, i just wanna get all the bonus
code:

def attackM():
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type == 'munchkin':
        if hero.isReady("chain-lightning"):
            hero.cast("chain-lightning", enemy)
        else:
            hero.attack(enemy)
def attackS():
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type == 'scout':
        hero.attack(enemy)
        if hero.isReady("root"):
            hero.cast("root", enemy)
        else:
            if hero.isReady("chain-lightning"):
                hero.cast("chain-lightning", enemy)
            else:
                pass
def attackO():
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type == 'ogre':
        if hero.isReady("chain-lightning"):
            hero.cast("chain-lightning", enemy)
        else:
            hero.moveXY(1, 36)
def attackC():
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type == 'catapult':
        if hero.isReady("lightning-bolt"):
            hero.cast("lightning-bolt", enemy)
        else:
            hero.attack(enemy)
def regen():
    if hero.isReady("regen"):
        hero.cast("regen", hero)
while True:
    attackM()
    attackS()
    attackO()
    attackC()
    enemy = hero.findNearestEnemy()
    if not enemy:
        hero.moveXY(6, 36)
        if hero.health < hero.maxHealth:
            regen()

1 Like

Hey Jason,

Can you please describe the Problem!!

Cheers,
Coding With Goutham / ColdFire

2 Likes

You need a better strategy than that to get all the bonuses, it took me, with all of my mastery (LOL, jkjk, but I am good) around a week of thinking about it and some hard coded values using enemy names, for example, you can’t be using chain-lightning when there is only a few enemies

2 Likes

Yeah, that is true,

you could use a

if len(enemies) > n:
     if hero.isReady('chain-lightning', enemy)
          hero.cast('chain-lightning', enemy)

to cast chain lightning when there are many enemies

1 Like

Just a side note which I forgot to mention:

n is supposed to be a number you choose!!

1 Like

That’s obvious… and it requires more than the number of enemies

1 Like

Oh, i already finished it, and thanks

Yep, Glad to help!!

@Jason_king_lin can you changed the title to [SOLVED] The One Wizard Bonus Help!

Cheers,
ColdFire

Can you also mark a solution, please?

@PeterPalov already helped me finished

1 Like

Nice!! (20 Characters)