[SOLVED] Need help with Kithgard Brawl

Hello,

In Kithgard Brawl, i need to Mana Blast with Pender to slay some munchkins but it’s says:‘I can’t cast spell on the target’:

Pls help.

Here’s my code:

def onSpawn(e):
    while True:
        # Find and fetch a "potion":
        potion = pet.findNearestByType("potion")
        if potion:
            pet.fetch(potion)
pet.on('spawn', onSpawn)

def getPosition(x, y):
    return {"x":x, "y":y}

def summonFriend(friendType):
    if self.costOf(friendType) < self.gold:
        self.summon(friendType)
    if hero.isReady("summon-undead"):
        hero.cast("summon-undead")
    if hero.isReady("summon-burl"):
        hero.cast("summon-burl")
    

def moveToPosition(pos):
    while self.distanceTo(pos) > 0:
        if self.isReady("jump"):
            self.jumpTo(pos)
        else:
            self.move(pos)

def heroAttack():
    enemies = self.findEnemies()
    enemy = self.findNearest(enemies)
    if enemy:
        if self.isReady("chain-lightning") and hero.distanceTo(enemy)<30:
            hero.cast("chain-lightning", enemy)
        elif self.isReady("mana-blast") and hero.distanceTo(enemy)<10:
            hero.cast("mana-blast", enemy)
        elif self.isReady("drain-life") and enemy and hero.distanceTo(enemy)<10:
            hero.cast("drain-life", enemy)
        elif self.isReady("fear") and hero.distanceTo(enemy)<10:
            hero.cast("fear", enemy)
        elif self.isReady("poison-cloud") and enemy and hero.distanceTo(enemy)<30:
            hero.cast("poison-cloud", enemy)
        elif self.isReady("reset-cooldown") and enemy:
            hero.resetCooldown("summon-burl")
        elif self.isReady("earthskin"):
            hero.cast("earthskin", hero)
        else:
            self.attack(enemy)

   

def defendHero(pos):
    friends = self.findFriends()
    for i in friends:
        if not i.type=='burl' and not i.type=='skeleton':
            self.command(i, "defend", pos)
while True:
    flag = hero.findFlag("green")
    summonFriend("archer")
    heroAttack()
    defendHero(self.pos)
    if flag:
        hero.buildXY("caltrops", hero.pos.x, hero.pos.y)
        hero.removeFlag(flag)


And my hero:

hero

Because manaBlast is an ability that Pender has by default, it isn’t used by self.cast("mana-blast") but instead in has its own ability: self.manaBlast()

Thanks you !(20chars.)

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.