So, I’m not too familiar with the boss star but I know the stuff enough to know that canCast should be a function of Paladin but it says that he has no method of canCast
CODE:
def summonSoldier():
if hero.gold > 20:
hero.summon('soldier')
def summonPaladin():
if hero.gold > 50:
hero.summon('paladin')
def CommandPaladin():
for friend in hero.findFriends():
if friend.type == "paladin":
paladin = hero.findByType("paladin")
if hero.Health < hero.maxHealth / 4:
hero.command(paladin, "cast", "heal", "hero")
pass
if target:
hero.command(paladin, "attack", target)
def CommandSoldier():
for friend in hero.findFriends():
if friend.type == "soldier":
soldier = hero.findByType("soldier")
if coin:
hero.command(friend, "move", {"x": coin.pos.x, "y": coin.pos.y})
def attack(target):
ArchMage = hero.findByType("thrower" or "shaman", hero.findEnemies())
len = len(ArchMage)
while len > 0:
hero.attack(ArchMage[len-1])
len -= 1
if target:
if (hero.canCast('chain-lightning', target)):
hero.cast('chain-lightning', target)
else:
hero.attack(target)
def Findcoins():
leftCoins = []
rightCoins = []
allCoins = hero.findItems()
for coin in allCoins:
if coin.pos.x < hero.pos.x:
leftCoins.append(coin)
else:
rightCoins.append(coin)
leftPeasants = []
rightPeasants = []
for friend in hero.findFriends():
if friend.type == "peasant":
for peasant in hero.findByType("peasant"):
if peasant.pos.x < hero.pos.x:
leftPeasants.append(peasant)
else:
rightPeasants.append(peasant)
for coin in leftCoins:
if coin:
hero.command(leftPeasants[0], "move", {"x": coin.pos.x, "y": coin.pos.y})
for coin in rightCoins:
if coin:
hero.command(rightPeasants[0], "move", {"x": coin.pos.x, "y": coin.pos.y})
while True:
target = hero.findNearestEnemy()
summonSoldier()
summonPaladin()
CommandPaladin()
CommandSoldier()
attack(target)
Findcoins()