But you have 4 boss star, not 2.
Boss Star II : a little bit more damage to the hero, all warriors alive and not wounded, no code change:
for Lidia: First attack the most dangerous enemies. The skeletons are neutralized so the shamans are
the the biggest threat.
So I should command my soldiers to attack the Shamans first? And then attack the skeletons?
Lydia
Sorry I havenāt been posting on this topic a lot, Iām just taking a break from this level. Iāll let you guys know when Iām back.
Lydia
ok (200000characters)
Do you still need help with the level. Its literally been a month and you still havenāt completed itā¦
Yea ⦠I just⦠Iām just busy with school and homework and my mom wonāt pay for my subscription and I canāt get any new armour to complete the freaking level! Im sorry, Iāve been stressed lately. Iām just taking a break with CodeCombat right now.
Lydia
Yeah, 8th grade is so stressful.
Iām back! Iām here to see if I can complete the level without getting new stuff.
Lydia
What is your current code?
def attackYeti():
yeti = hero.findByType("yeti")
if yeti:
hero.attack(yeti)
else:
break
def summon():
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
else:
break
def command():
friends = hero.findFriends()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
hero.command(friend, "attack", enemyF)
if not enemyF:
break
def friendMove():
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", {'x':53, 'y':47})
def attack():
enemy = hero.findNearestEnemy()
if enemy:
if hero.isReady("bash"):
hero.bash(enemy)
else:
hero.attack(enemy)
while True:
friends = hero.findFriends()
yeti = hero.findByType("yeti")
enemyF = friend.findNearestEnemy()
enemy = hero.findNearestEnemy()
if hero.gold > hero.costOf("soldier"):
summon()
for friend in friends:
if enemyF:
command()
if not enemyF:
friendMove()
if enemy:
if yeti:
attackYeti()
if not yeti:
attack()
My error:
My armor:
Lydia
You have to write
enemyF = friend.findNearestEnemy()
In āForā. Also, try to use chain-ligtning.
Like this?
for friend in friends:
enemyF = friend.findNearestEnemy()
Lydia
My updated code:
def attackYeti():
yeti = hero.findByType("yeti")
if yeti:
hero.attack(yeti)
else:
break
def summon():
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
else:
break
def command():
friends = hero.findFriends()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
hero.command(friend, "attack", enemyF)
if not enemyF:
break
def friendMove():
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", {'x':53, 'y':47})
def attack():
enemy = hero.findNearestEnemy()
if enemy:
if hero.isReady("bash"):
hero.bash(enemy)
else:
hero.attack(enemy)
while True:
friends = hero.findFriends()
yeti = hero.findByType("yeti")
enemy = hero.findNearestEnemy()
if hero.gold > hero.costOf("soldier"):
summon()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
command()
if not enemyF:
friendMove()
if enemy:
if yeti:
attackYeti()
if not yeti:
attack()
else:
hero.moveXY(19, 40)
But now it says that āyetiā is not defined.
Lydia
You have to write:
yeti = hero.findNearest(findByType("yeti"))
Oh ok thanks.
Lydia
20 chars
You completed it? (20 chars)
Now it says this:
Code:
def attackYeti():
yeti = hero.findNearest(findByType("yeti"))
if yeti:
hero.attack(yeti)
else:
break
def summon():
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
else:
break
def command():
friends = hero.findFriends()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
hero.command(friend, "attack", enemyF)
if not enemyF:
break
def friendMove():
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", {'x':53, 'y':47})
def attack():
enemy = hero.findNearestEnemy()
if enemy:
if hero.isReady("bash"):
hero.bash(enemy)
else:
hero.attack(enemy)
while True:
friends = hero.findFriends()
yeti = hero.findNearest(findByType("yeti"))
enemy = hero.findNearestEnemy()
if hero.gold > hero.costOf("soldier"):
summon()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
command()
if not enemyF:
friendMove()
if enemy:
if yeti:
attackYeti()
if not yeti:
attack()
else:
hero.moveXY(19, 40)
yeti = hero.findNearest(hero.findByType("yeti"))
My code now:
def attackYeti():
yeti = hero.findNearest(hero.findByType("yeti"))
if yeti:
hero.attack(yeti)
else:
break
def summon():
if hero.gold > hero.costOf("soldier"):
hero.summon("soldier")
else:
break
def command():
friends = hero.findFriends()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
hero.command(friend, "attack", enemyF)
if not enemyF:
break
def friendMove():
friends = hero.findFriends()
for friend in friends:
hero.command(friend, "move", {'x':53, 'y':47})
def attack():
enemy = hero.findNearestEnemy()
if enemy:
if hero.isReady("bash"):
hero.bash(enemy)
else:
hero.attack(enemy)
def collect():
item = hero.findNearestItem()
if item:
hero.move(item.pos)
else:
break
while True:
friends = hero.findFriends()
yeti = hero.findNearest(hero.findByType("yeti"))
enemy = hero.findNearestEnemy()
if hero.gold > hero.costOf("soldier"):
summon()
for friend in friends:
enemyF = friend.findNearestEnemy()
if enemyF:
command()
if not enemyF:
friendMove()
if enemy:
if yeti:
attackYeti()
if not yeti:
attack()
else:
hero.moveXY(19, 40)
I donāt think my hero actually attacksā¦
And for some reason my hero doesnāt collect the coins.
Lydia