Hi guys. I am stuck on Kithgard Apprentice and I am quite stuck with how to get hero and command my paladin to attack without getting bounced back by the skeletons and that horrendous warlock. Here is my code and help would be very much appreciated:
# Your goal is to survive.
# Also have fun. Maybe win in the leaderboards!
# Good thing you never stumbled into this room the first time you were here, amirite?
def attackEnemies():
enemy = hero.findNearest(hero.findEnemies())
if enemy:
if hero.isReady("bash"):
hero.bash(enemy)
if hero.isReady("throw"):
hero.throw(enemy)
else:
hero.attack(enemy)
def summonTroops():
if hero.gold >= hero.costOf("paladin"):
hero.summon("paladin")
def commandTroops():
friends = hero.findFriends()
for friend in range(len(friends)):
enemy = hero.findNearest(hero.findEnemies())
if enemy:
hero.command(friend, "attack", enemy)
if friend.canCast("heal") and hero.health <= 1000:
hero.command(paladin, "cast", "heal", hero)
# Your goal is to survive.
# Also have fun. Maybe win in the leaderboards!
# Good thing you never stumbled into this room the first time you were here, amirite?
def lowestHealthFriend():
lowestHealth = 99999
lowestFriend = None
friends = hero.findFriends()
for friend in friends:
if friend.type != "paladin":
continue
if friend.health < lowestHealth and friend.health < friend.maxHealth:
lowestHealth = friend.health
lowestFriend = friend
return lowestFriend
def summonTroops():
if hero.gold >= hero.costOf("paladin"):
hero.summon("paladin")
def commandTroops():
friends = hero.findFriends()
for friend in friends:
if friend.canCast("heal"):
weakFriend = lowestHealthFriend()
if weakFriend:
hero.command(friend, "cast", "heal", weakFriend)
enemy = friend.findNearestEnemy()
if enemy:
hero.command(friend, "attack", enemy)
enemy = friend.findNearestEnemy()
if friend.distanceTo(enemy) > 10:
hero.command(friend, "shield")
def attackEnemies():
enemy = hero.findNearest(hero.findEnemies())
if enemy:
if hero.isReady("bash"):
hero.bash(enemy)
if hero.isReady("throw"):
hero.throw(enemy)
else:
hero.attack(enemy)
while True:
summonTroops()
commandTroops()
attackEnemies()
Because in this level you need just survive, I think you should go to that door, summon paladin, which can kill it, and go inside the room. Then, get all items, and summon lots of archers. Then shield, and your troops will defend you.
How do you open the door? When I was reading a post from, I think it was either @MunkeyShynes or @Deadpool198, they said they could not open the door, only with Okar stomping near it.