How do I not target the palisades?
# Practice using modulo to loop over an array
# Choose the mix and order of units you want to summon by populating this array:
defendPoints = [{"x": 40, "y": 46},{"x": 40, "y": 42},{"x": 40, "y": 28},{"x": 40, "y": 24}]
summonTypes = ["soldier", "soldier", "soldier", "soldier","archer", "archer", "archer", "archer"]
def getGold():
item = hero.findNearestItem()
if item:
hero.moveXY(item.pos.x, item.pos.y)
def summonTroops():
type = summonTypes[len(hero.built) % len(summonTypes)]
if hero.gold >= hero.costOf(type):
hero.summon(type)
def commandTroops():
friends = hero.findFriends(unit.type == "soldier",unit.type == "archer")
for i in range(len(friends)):
friend = friends[i]
defendPoint = defendPoints[i%len(defendPoints)]
hero.command(friend, "defend", defendPoint)
while True:
getGold()
summonTroops()
commandTroops()