def get_monsters_to_place(state): max_monsters_table = [[2, 0], [3, 3], [5, 5]] max_monsters = Util.from_dungeon_level(state, max_monsters_table) # choose random number of monsters monster_chances = { MonsterConstants.ORC: 80, MonsterConstants.TROLL: Util.from_dungeon_level(state, [[15, 3], [30, 5], [60, 7]]) } num_monsters = libtcod.random_get_int(0, 0, max_monsters) monsters = [Util.random_choice(monster_chances) for i in range(num_monsters)] return monsters
def get_items_to_place(state): max_items_table = [[3, 0], [5, 3]] max_items = Util.from_dungeon_level(state, max_items_table) item_chances = { ItemConstants.HEALTH_POTION: 35, ItemConstants.SCROLL_OF_LIGHTNING_BOLT: Util.from_dungeon_level(state, [[25, 1]]), ItemConstants.SCROLL_OF_FIREBALL: Util.from_dungeon_level(state, [[25, 1]]), ItemConstants.SCROLL_OF_CONFUSE: Util.from_dungeon_level(state, [[10, 1]]), } equipment_chances = { EquipmentConstants.SWORD: 50, # Util.from_dungeon_level(state, [[5, 4]]), EquipmentConstants.SHIELD: 50 # Util.from_dungeon_level(state, [[15, 8]]), } num_total_items = libtcod.random_get_int(0, 0, max_items) num_items = libtcod.random_get_int(0, 0, num_total_items) num_equipments = num_total_items - num_items items = [Util.random_choice(item_chances) for i in range(num_items)] equipments = [Util.random_choice(equipment_chances) for i in range(num_equipments)] return items, equipments