# Move to 'Zsofia' and get the secret number from her.
hero.moveXY(18, 20)
zso = hero.findNearestFriend().getSecret()

# Divide 'Zsofia's number by 4 to get 'Mihaly's number.
# Move to 'Mihaly' and say his magic number.
mih = zso / 4
hero.moveXY(30, 15)

# Idź za śladem monet do czerwonego X przy wyjściu.

while True:
    # Ta funkcja znajduje najbliższy przedmiot.
    item = hero.findNearestItem()
    if item:
        # To przechowuje  item.pos lub pozycję w zmiennych.
        itemPosition = item.pos

# Move to 'Eszter' and get the secret number from her.
hero.moveXY(16, 32)
esz = hero.findNearestFriend().getSecret()

# Multiply by 3 and subtract 2 to get 'Tamas's number.
# Remember to use parentheses to do calculations in the right order.
# Move to 'Tamas' and say his magic number.
tam = (esz * 3) - 2
hero.moveXY(24, 28)
hero.say(tam)

# Atakuj tylko wrogów typu "munchkin" i "thrower".
# Nie atakuj typu "burl". Uciekaj od typu "ogre"!
while True:
    enemy = hero.findNearestEnemy()
    
    # Pamiętaj: nie atakuj typu "burl"!
    if enemy.type == "burl":
        hero.say("Nie zatakuję tego Burla!")
    

# Twoim zadaniem jest powiedzieć im jaka jest odległość do ogrów.

# Ta funkcja znajduje najbliższego przeciwnika i zwraca odległość do niego.
# Jeśli nie ma wrogów, funkcja zwraca 0
def nearestEnemyDistance():
    enemy = hero.findNearestEnemy()
    result = 0
    if enemy: