That help alot but when i break the first gate no troops attack any enemy
code =
def summonTroops():
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
if hero.gold > hero.costOf("archer"):
hero.summon("archer")
if hero.gold > hero.costOf("griffin-rider"):
hero.summon("griffin-rider")
def commandSoldier():
soldiers = hero.findByType("soldier")
for soldier in soldiers:
Senemies = soldier.findEnemies()
for Senemy in Senemies:
if Senemy and soldier:
hero.command(soldier, "attack", Senemy)
def commandArcher():
archers = hero.findByType("archer")
for archer in archers:
Aenemies = archer.findEnemies()
for Aenemy in Aenemies:
if Aenemy and archer:
hero.command(archer, "attack", Aenemy)
def commandPaladin():
paladins = hero.findByType("paladin")
for paladin in paladins:
Penemies = paladin.findEnemies()
Pfriend = paladin.findNearest(hero.findFriends())
for Penemy in Penemies:
if Penemy and paladin:
hero.command(paladin, "attack", Penemy)
if paladin.canCast("heal, Pfriend"):
hero.command(paladin, "cast, heal", Pfriend)
def heroAttack():
enemies = hero.findEnemies()
for enemy in enemies:
if enemy:
hero.attack(enemy)
if hero.isReady("chain-lightning"):
hero.cast("chain-lightning", enemy)
def pickUpFlags():
flag = hero.findFlag()
if flag:
hero.pickUpFlag(flag)
while True:
summonTroops()
commandSoldier()
commandArcher()
commandPaladin()
heroAttack()
pickUpFlags()