Could you help me write the last lines, and tell me if I have errors in the code itself. I do not quite understand what I need to write in the last lines where it says "If the result is true incanAttack, then attack! "
def inAttackRange(enemy):
distance = hero.distanceTo(enemy)
# Почти все мечи имеют радиус поражения 3
if distance <= 3:
return True
else:
return False
Бей огров только когда они рядом.
while True:
# Найди ближайшего противника и сохрани его в переменную.
enemy = hero.findNearestEnemy()
# Вызови функцию inAttackRange(enemy)с врагом в качестве аргумента.
# и сохрани результат в переменную canAttack.
canAttack = inAttackRange(enemy)
# Если сохранённый в canAttack результат True, то атакуй!