When I try to collect items, I just attack the enemy. Here is my code.
Ogres are attacking a nearby settlement!
Be careful, though, for the ogres have sown the ground with poison.
Gather coins and defeat the ogres, but avoid the burls and poison!
enemy = hero.findNearestEnemy()
if enemy.type == “munchkin” or enemy.type == “thrower”:
item = hero.findNearestItem()
# Check the item type to make sure the hero doesn’t pick up poison!
# Look for types: ‘gem’ and ‘coin’
if item.type == “gem” or item.type == “coin”: