Code is below, it works fine, I just don’t know what to do with the poison bottle. I thought you should just ignore it, but I don’t get the last coin from not collecting it. Do I attack the potion or something?
def regenAlly(ally):
self.cast("regen", ally)
def healAlly(ally):
self.cast("heal", ally)
def growAlly(ally):
self.cast("grow", ally)
def attackEnemy(enemy):
self.cast("drain-life", enemy)
def shrinkEnemy(enemy):
self.cast("shrink", enemy)
def takeItem(item):
hero.moveXY(item.pos.x, item.pos.y)
def poisonOgre(enemy):
self.cast("force-bolt", enemy)
def cloudEnemy(enemy):
self.cast("poison-cloud", enemy)
while True:
hero.moveXY(18, 40)
enemy = hero.findNearestEnemy()
ally = hero.findNearestFriend()
item = hero.findNearestItem()
if item:
if item.type == "potion":
hero.moveXY(item.pos.x, item.pos.y)
if item.type == "poison":
poisonOgre(item)
if ally:
if ally.type == "soldier":
healAlly(ally)
if ally.type == "goliath":
growAlly(ally)
else:
if ally.type != "soldier" and "goliath":
regenAlly(ally)
if enemy:
if enemy.type == "brawler":
shrinkEnemy(enemy)
if enemy.type == "ogre":
poisonOgre(enemy)
if enemy.type =="scout":
cloudEnemy(enemy)
else:
hero.say(enemy.type)
hero.moveXY(18,24)
enemy = hero.findNearestEnemy()
ally = hero.findNearestFriend()
item = hero.findNearestItem()
if item:
if item.type == "potion":
hero.moveXY(item.pos.x, item.pos.y)
if item.type == "poison":
poisonOgre(item)
if ally:
if ally.type == "soldier":
healAlly(ally)
if ally.type == "goliath":
growAlly(ally)
else:
if ally.type != "soldier" and "goliath":
regenAlly(ally)
if enemy:
if enemy.type == "brawler":
shrinkEnemy(enemy)
if enemy.type == "ogre":
poisonOgre(enemy)
if enemy.type =="scout":
cloudEnemy(enemy)
else:
hero.say(enemy.type)
hero.moveXY(34,40)
enemy = hero.findNearestEnemy()
ally = hero.findNearestFriend()
item = hero.findNearestItem()
if item:
if item.type == "potion":
hero.moveXY(item.pos.x, item.pos.y)
if item.type == "poison":
poisonOgre(item)
if ally:
if ally.type == "soldier":
healAlly(ally)
if ally.type == "goliath":
growAlly(ally)
else:
if ally.type != "soldier" and "goliath":
regenAlly(ally)
if enemy:
if enemy.type == "brawler":
shrinkEnemy(enemy)
if enemy.type == "ogre":
poisonOgre(enemy)
if enemy.type =="scout":
cloudEnemy(enemy)
else:
hero.say(enemy.type)
hero.moveXY(34,24)
enemy = hero.findNearestEnemy()
ally = hero.findNearestFriend()
item = hero.findNearestItem()
if item:
if item.type == "potion":
hero.moveXY(item.pos.x, item.pos.y)
if item.type == "poison":
poisonOgre(item)
if ally:
if ally.type == "soldier":
healAlly(ally)
if ally.type == "goliath":
growAlly(ally)
if ally.type == "zana":
hero.say(zana)
else:
if ally.type != "soldier" and "goliath":
regenAlly(ally)
if enemy:
if enemy.type == "brawler":
shrinkEnemy(enemy)
if enemy.type == "ogre":
poisonOgre(enemy)
if enemy.type =="scout":
cloudEnemy(enemy)
else:
hero.say(enemy.type)
hero.moveXY(50,40)
enemy = hero.findNearestEnemy()
ally = hero.findNearestFriend()
item = hero.findNearestItem()
if item:
if item.type == "potion":
hero.moveXY(item.pos.x, item.pos.y)
if item.type == "poison":
poisonOgre(item)
if ally:
if ally.type == "soldier":
healAlly(ally)
if ally.type == "goliath":
growAlly(ally)
else:
if ally.type != "soldier" and "goliath":
regenAlly(ally)
if enemy:
if enemy.type == "brawler":
shrinkEnemy(enemy)
if enemy.type == "ogre":
poisonOgre(enemy)
if enemy.type =="scout":
cloudEnemy(enemy)
else:
hero.say(enemy.type)
hero.moveXY(50,24)
enemy = hero.findNearestEnemy()
ally = hero.findNearestFriend()
item = hero.findNearestItem()
if item:
if item.type == "potion":
hero.moveXY(item.pos.x, item.pos.y)
if item.type == "poison":
poisonOgre(item)
if ally:
if ally.type == "soldier":
healAlly(ally)
if ally.type == "goliath":
growAlly(ally)
else:
if ally.type != "soldier" and "goliath":
regenAlly(ally)
if enemy:
if enemy.type == "brawler":
shrinkEnemy(enemy)
if enemy.type == "ogre":
poisonOgre(enemy)
if enemy.type =="scout":
cloudEnemy(enemy)
else:
hero.say(enemy.type)
hero.moveXY(66,40)
enemy = hero.findNearestEnemy()
ally = hero.findNearestFriend()
item = hero.findNearestItem()
if item:
if item.type == "potion":
hero.moveXY(item.pos.x, item.pos.y)
if item.type == "poison":
poisonOgre(item)
if ally:
if ally.type == "soldier":
healAlly(ally)
if ally.type == "goliath":
growAlly(ally)
else:
if ally.type != "soldier" and "goliath":
regenAlly(ally)
if enemy:
if enemy.type == "brawler":
shrinkEnemy(enemy)
if enemy.type == "ogre":
poisonOgre(enemy)
if enemy.type =="scout":
cloudEnemy(enemy)
else:
hero.say(enemy.type)
hero.moveXY(66,24)
enemy = hero.findNearestEnemy()
ally = hero.findNearestFriend()
item = hero.findNearestItem()
if item:
if item.type == "potion":
hero.moveXY(item.pos.x, item.pos.y)
if item.type == "poison":
poisonOgre(item)
if ally:
if ally.type == "soldier":
healAlly(ally)
if ally.type == "goliath":
growAlly(ally)
else:
if ally.type != "soldier" and "goliath":
regenAlly(ally)
if enemy:
if enemy.type == "brawler":
shrinkEnemy(enemy)
if enemy.type == "ogre":
poisonOgre(enemy)
if enemy.type =="scout":
cloudEnemy(enemy)
else:
hero.say(enemy.type)
hero.moveXY(78, 33)
break