def _room_living(w, h, wall_material, floor_material): M = room_default(w, h, wall_type=wall_material, floor_type=floor_material) if h < 17: num_rooms = (h - 3) // 3 for i in range(num_rooms): room_y = i * 3 poor_room = _room_poor(4, 4, wall_material, floor_material, direction='right') M.meld(poor_room, 0, room_y) poor_room = _room_poor(4, 4, wall_material, floor_material, direction='left') M.meld(poor_room, 5, room_y) M[w-1, h-2] = C.door_open_empty() M[1, h-2].put(A.animal_spider()) corridor_h = h - num_rooms * 3 - 1 if corridor_h > 2: M[1, h-corridor_h].put(T.washtub()) M[2, h-corridor_h].put(T.washtub()) M[w-2, h-corridor_h].put(T.furniture_stool()) M.scatter(1, h-corridor_h, w-2, h-1, [(A.animal_cat())]) elif h >= 17: rich_room_h = 5 + (h - 2) % 3 rich_1 = _room_rich(5, rich_room_h, wall_material, floor_material) M.meld(rich_1, 0, 0) rich_2 = _room_rich(5, rich_room_h, wall_material, floor_material) M.meld(rich_2, 4, 0) M[w-1, rich_room_h+1] = C.door_open_empty() M[1, rich_room_h+1].put(A.animal_spider()) M.scatter(1, rich_room_h, w-1, rich_room_h+2, [(A.animal_cat())]) num_rooms = (h - rich_room_h - 3) // 3 for i in range(num_rooms): room_y = i * 3 poor_room = _room_poor(4, 4, wall_material, floor_material, direction='right') M.meld(poor_room, 0, rich_room_h+2+room_y) poor_room = _room_poor(4, 4, wall_material, floor_material, direction='left') M.meld(poor_room, 5, rich_room_h+2+room_y) return M
def _interior_garden(w, h, wall_material, floor_material): M = Map(w, h, fill_cell=C.floor_flagged) garden_part = Map(w // 2, h, fill_cell=C.flora_grass) for y in range(0, h): garden_part[w // 2 - 1, y] = C.floor_flagged() for x in range(1, w // 2 - 1): for y in range(1, 4): garden_part[x, y] = C.floor_flagged() for x in range(2, w // 2): garden_part[x, 2].put(T.water_trough()) for y in range(h - 3, h): garden_part[0, y] = C.flora_tree() garden_part[1, y].put(T.water_trough()) garden_part[2, y] = C.flora_flower() garden_part[w // 2 - 2, 0] = C.flora_flower() garden_part[0, h - 5].put(T.furniture_sofa()) garden_part[1, h - 5].put(T.furniture_table_round()) garden_part[2, h - 6].put(T.urn()) M.meld(garden_part, 0, 0) garden_part2 = deepcopy(garden_part) garden_part2.hmirror() M.meld(garden_part2, w // 2 + w % 2, 0) for x in range(0, w // 2 - 1): M[x, h - 4] = C.floor_flagged() M.scatter(0, 0, w - 1, h - 1, [A.animal_cat()]) return M
def _room_kitchen(w, h, wall_material, floor_material): M = room_default(w, h, wall_type=wall_material, floor_type=floor_material) storage = room_default(6, 6, wall_type=wall_material, floor_type=floor_material) M.meld(storage, 0, 0) M[5, h-3] = C.door_open_empty() M[10, h-1] = C.door_open_empty() M[7, 0] = C.door_closed_window() for x in range(1, 3): for y in range(1, 3): M[x, y] = C.flora_mushroom_button() storage_items = [ T.furniture_barrel(), T.furniture_barrel(), T.furniture_barrel(), T.furniture_barrel(), T.furniture_box_filled(), T.furniture_box_filled(), T.bag(), T.food_leaf() ] storage_w = 6 M.scatter(1, 1, 5, h-1, storage_items, exclude=[ (storage_w-2, h-3), (storage_w-3, h-3), (storage_w-4, h-3), (storage_w-3, h-4), (1, 1), (1, 2), (2, 1), (2, 2) ]) for x in range(8, 11): M[x, 1].put(T.furniture_hearth()) for x in range(8, 11): M[x, 3].put(T.furniture_table()) M[13, 1] = C.stairs_down() M[11, 1].put(T.bucket()) for y in range(1, 3): M[6, y].put(T.food_meat()) M[6, 4].put(T.food_egg()) M[11, 3].put(T.furniture_box_filled()) M.scatter(6, 1, 14, 5, [A.animal_cat()]) if w > 15: num_of_items = (w - 15) * 2 food_items = [ T.furniture_barrel(), T.furniture_barrel(), T.furniture_barrel(), T.furniture_box_filled(), T.furniture_box_filled(), T.bag() ] M.scatter(15, 1, w-1, h-1, random.sample(food_items, min(len(food_items), num_of_items))) return M
def _room_shop(w, h, shop_type, wall_material, floor_material): M = room_default(w, h, wall_type=wall_material, floor_type=floor_material) M[w // 2, h - 1] = C.door_closed() M[1, h - 2].put(T.light_lantern_oil()) shop_counter_h = h // 2 - 1 for x in range(w - 3): cell_x = 2 + x M[cell_x, shop_counter_h].put(T.furniture_longtable_showcase()) M[w - 2, shop_counter_h - 1].put(T.money_pile()) type_items = { 'food': [T.food_meat(), T.food_carrot(), T.food_apple()], 'jewelry': [T.necklace(), T.necklace_star(), T.ring()], 'clothe': [T.clothes_coat(), T.clothes_hat(), T.clothes_belt()], 'weapon': [T.weapon_sword_rapier(), T.weapon_naginata(), T.weapon_crossbow()], 'armor': [T.helmet(), T.armor_mail(), T.clothes_belt()], 'potion': [T.potion_health(), T.potion_mana_empty(), T.potion_magic()], 'tool': [T.tool_tongs(), T.tool_pickaxe(), T.tool_broom()], 'magic': [T.magic_orb(), T.weapon_stave(), T.potion_stamina()] } M.scatter(2, 1, w - 2, 2, type_items[shop_type]) type_items = { 'food': [ T.furniture_box_filled(), T.furniture_box_filled(), T.bag(), T.food_milk() ], 'jewelry': [T.mineral_crystal(), T.bag(), T.necklace(), T.ring()], 'clothe': [ T.clothes_boots_right(), T.clothes_shirt(), T.clothes_shirt_inverted(), T.clothes_sweater() ], 'weapon': [ T.weapon_sword(), T.weapon_sword_saber(), T.weapon_spear(), T.weapon_dagger() ], 'armor': [ T.helmet(), T.armor_mail(), T.furniture_mannequin(), T.shield_buckler() ], 'potion': [ T.potion_magic_empty(), T.potion_stamina(), T.dining_bottle(), T.potion_health_empty() ], 'tool': [ T.tool_nails(), T.tool_scissors(), T.tool_fishingrod(), T.tool_pitchfork() ], 'magic': [ T.weapon_stave(), T.book_magic(), T.scroll_magic(), T.scroll_curled() ] } coord_exclude = [(x, y) for x in range(2, w - 2) for y in range(shop_counter_h + 2, shop_counter_h + 4)] coord_exclude.append((w // 2, h - 2)) M.scatter(2, shop_counter_h + 1, w - 1, h - 1, type_items[shop_type], exclude=coord_exclude) cat_place_x = random.randint(1, 2) cat_place_y = random.randint(shop_counter_h + 1, h - 3) M[cat_place_x, cat_place_y].put(A.animal_cat()) return M
def room_shop(w, h, shop_type, wall_material, floor_material): M = room_default(w, h, wall_type=wall_material, floor_type=floor_material) M[w // 2, h - 1] = C.door_closed() M[1, h - 2].put(T.light_lantern_oil()) shop_counter_h = h // 2 - 1 for x in range(w - 3): cell_x = 2 + x M[cell_x, shop_counter_h].put(T.furniture_longtable_showcase()) M[w - 2, shop_counter_h - 1].put(T.money_pile()) type_items = { 'food': [T.food_meat, T.food_carrot, T.food_apple], 'jewelry': [T.necklace, T.necklace_star, T.ring], 'clothe': [T.clothes_coat, T.clothes_hat, T.clothes_belt], 'weapon': [T.weapon_sword_rapier, T.weapon_naginata, T.weapon_crossbow], 'armor': [T.helmet, T.armor_mail, T.clothes_belt], 'potion': [T.potion_health, T.potion_mana_empty, T.potion_magic], 'tool': [T.tool_tongs, T.tool_pickaxe, T.tool_broom], 'magic': [T.magic_orb, T.weapon_stave, T.potion_stamina] } all_coord = [] for item_class in type_items[shop_type]: while True: x = random.randint(1, w // 2) y = 1 if (x, y) not in all_coord: M[x, y].put(item_class()) all_coord.append((x, y)) break type_items = { 'food': [T.furniture_box_filled, T.furniture_box_filled, T.bag, T.food_milk], 'jewelry': [T.mineral_crystal, T.bag, T.necklace, T.ring], 'clothe': [ T.clothes_boots_right, T.clothes_shirt, T.clothes_shirt_inverted, T.clothes_sweater ], 'weapon': [ T.weapon_sword, T.weapon_sword_saber, T.weapon_spear, T.weapon_dagger ], 'armor': [T.helmet, T.armor_mail, T.furniture_mannequin, T.shield_buckler], 'potion': [ T.potion_magic_empty, T.potion_stamina, T.dining_bottle, T.potion_health_empty ], 'tool': [T.tool_nails, T.tool_scissors, T.tool_fishingrod, T.tool_pitchfork], 'magic': [T.weapon_stave, T.book_magic, T.scroll_magic, T.scroll_curled] } all_coord = [] for item_class in type_items[shop_type]: while True: x = random.randint(w // 2 + 1, w - 2) y = random.randint(shop_counter_h + 1, h - 2) if (x, y) not in all_coord: M[x, y].put(item_class()) all_coord.append((x, y)) break cat_place_x = random.randint(1, 2) cat_place_y = random.randint(shop_counter_h + 1, h - 3) M[cat_place_x, cat_place_y].put(A.animal_cat()) return M