Kithgard Brawl glitch


#1

It seems that on line 8, evem though I defined enemy, it says that I need something to cast upon. here is my code

loop:
    enemy = self.findNearest(self.findEnemies())
    if self.canCast("drain-life", enemy):
        self.cast("drain-life", enemy) #(line 8)
    if self.distanceTo(enemy) < self.attackRange:
        self.attack(enemy)
    if self.canCast("fear"):
        self.cast("fear")

I removed the comments
also, I wont cast fear, attack, or do anything else


#2

You don’t check if there is an enemy in the first place. At the very beginning, it’s quite possible that there is none, so enemy is null. Therefore, you don’t have anything to cast upon.


#3

Also, you have to cast "fear" on a target; it doesn’t work if you don’t specify a second argument.