- Szczegóły
- 1514
# Defeat munchkins, collect coins. Everything as usual.
# Use AND to check existence and type in one statement.
while True:
enemy = hero.findNearestEnemy()
# With AND, the type is only checked if enemy exists.
if enemy and enemy.type == "munchkin":
hero.attack(enemy)