Code gets stuck summoning


#1

while True:
enemy = self.findNearest(self.findEnemies())
friend = self.findNearest(self.findFriends())
flag = self.findNearest(self.findItems())
distance = self.distanceTo(enemy)

#code gets stuck here summoning burl after running through the first loop.

if self.isReady("summon-burl"):
    self.cast("summon-burl")
    pass

if enemy:
    self.attack(enemy)

if self.health < self.maxHealth:
    self.cast("regen", self)
    self.attack(enemy)
    
if friend and friend.health < friend.maxHealth and self.isReady("regen"):
    self.cast("regen", friend)
    self.attack(enemy)
    
if self.isReady("grow") and self.hasEffect("grow") == False:
    self.cast("grow", friend)
    self.attack(enemy)

if friend and friend.health <= 100 and self.isReady("invisibility"):
    self.cast("invisibility", friend)
    self.attack(enemy)
    
if enemy and self.isReady("chain-lightning"):
    enemyPos = enemy.pos
    enemyX = enemyPos.x
    enemyY = enemyPos.y
    self.cast("chain-lightning", enemy)
    self.attack(enemy)
    
if enemy and enemy.hasEffect("grow") and self.isReady("shrink"):
    self.cast("shrink", enemy)
    self.attack(enemy)
    
if enemy and self.isReady("shrink"):
    self.cast("shrink", enemy)
    self.attack(enemy)

what am i doing wrong?
This is the Defend the Garrison level


#2

try using self.canCast


#3

thank you, i replaced all of the .isReady with .canCast and that fixed where it was getting stuck at summoning burl, but then had issues with:

if self.isReady(“grow”) and self.hasEffect(“grow”) == False:
self.cast(“grow”, friend)
self.attack(enemy)

I actually removed self.hasEffect(“grorw”) == False:
and then like i said changed isReady to canCast, but it still had issues… works perfectly like i want it to when i just comment out this little section though.


#4

I think you need to restart the game. Meaning re-fresh the page. If that doesn’t work then I don’t know. Maybe try creating different code. Thanks for your time brother.


#5

yeah thats right brother