forked from vadim-job-hg/CodeCombat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TeleportLasso.py
19 lines (17 loc) · 757 Bytes
/
TeleportLasso.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# https://codecombat.com/play/level/teleport-lasso
# Our wizards teleport ogres from their camp here.
# They appear for a short period and they are stunned.
# If you attack an ogre, it stays here and can counterattack.
# Attack only weak and near ogres.
# Our wizards teleport ogres from their camp here.
# They appear for a short period and they are stunned.
# If you attack an ogre, it stays here and can counterattack.
# Attack only weak and near ogres.
while True:
enemy = hero.findNearestEnemy()
if enemy:
distance = hero.distanceTo(enemy)
# If enemy's type is "munchkin" AND the distance to it less than 20 metres.
if enemy and enemy.type == 'munchkin' and distance < 20:
# Then attack it.
hero.attack(enemy)