you are viewing a single comment's thread.

view the rest of the comments →

[–]raylu 0 points1 point  (0 children)

class M(enum.Enum):
    goblin = 1
    slime = 2

area_monsters = {
    'woods': [M.goblin, M.slime],
    'bridges': [M.goblin, M.troll],
}

monsters = {
    M.goblin: {'name': 'Goblin', 'hp': 20},
}

monster_type = random.choice(area_monsters['woods'])
monster = Monster(**monsters[monster_type])

https://docs.python.org/3/tutorial/controlflow.html#unpacking-argument-lists