I am working on storming the farm house mission and have been trying to do the following action:
I would like my hero to move to the flag then check to see if there is an enemy less than 10 away if so cleave if ready, else bash if ready else attack if cleave and bash are not ready. Then sheild if enemy is greater than 10 away. What I get is move to flag and check to see enemy and random cleaves and bashes but no attacking and no shielding. Any thoughts on what I can check to improve my code?
loop: flag = self.findFlag() enemy = self.findNearestEnemy() distance = self.distanceTo(enemy) if flag: self.say("Maybe I should do something with that flag?") self.pickUpFlag(flag) if enemy: if distance < 10: ready = self.isReady("cleave") if ready: self.cleave(enemy) else: self.attack(enemy) elif distance > 10: self.shield() else: pass else: pass