[SOLVED]Long range division-Python-Help


#1

I’m stuck… Anyone can help me ? Thank you.

# Destroy the mines!
# Use say to call out the range to the mines.
# Use division to calculate the range.

enemy = hero.findNearestEnemy()
distanceToEnemy = hero.distanceTo(enemy)

# Say first Range: distanceToEnemy divided by 3
hero.say(distanceToEnemy / 3)
hero.say("Fire!")
# Say second range: distanceToEnemy divided by 1.5
hero.say(distanceToEnemy / 1.5)
hero.say("Fire!")

# Say these things for motivation. Really. Trust us.
hero.say("Woo hoo!")
hero.say("Here we go!")
hero.say("Charge!!")

# Now, use a while-true loop to attack the enemies.
while True:
    enemy = hero.findNearestEnemy()
    if enemy :
        hero.attack(enemy)

#2

What happens when you run the code? Are you getting an error message? What does your hero do?

Please post a screen shot of your equipment. This may be a gear issue.


#3

My hero can’t defeat the ogres. Thank you.



#4

This is an equipment/gear issue. That wand isn’t inflicting much damage. It only inflicts 2.5 damage with each strike. Those two ogres have a combined total of 150 health. That means, with that wand, you would have to hit the two of them with 60 fire balls (30 a piece). You simply don’t have the time for that.

Either get a much better wand or just use a hero with a good sword. Your code is fine.


#5

Just sloved! Thank you so much~ :smile: