Пример #1
0
def _room_big_office(w, h):
    """
    Construct big office only for employees.
    """
    M = room_default(w,
                     h,
                     wall_type=C.wall_dungeon_smooth,
                     floor_type=C.floor_plank)

    # Place lanterns and bookcases from the center to the right end of the room.
    M[w // 2, 0] = C.door_closed_bars()
    for y in range(1, h - 3, 2):
        M[w - 2, y].put(T.light_lantern_oil())
        for x in range(w // 2 + 1, w - 1):
            M[x, y + 1].put(T.furniture_bookcase())

    # Place tables, chairs, etc.
    for y in range(3, h - 1, 2):
        M[1, y].put(T.furniture_table())
        M[2, y].put(T.furniture_chair())
        M[3, y].put(T.light_lantern_oil())
        M[6, y].put(T.furniture_table())
        M[7, y].put(T.furniture_chair())
        if w > 26:
            M[10, y].put(T.furniture_table())
            M[11, y].put(T.furniture_chair())
    all_coord = []
    for item_class in (T.furniture_bookcase, T.book_clear, T.book,
                       T.furniture_bookcase, T.furniture_bookcase,
                       T.scroll_text):
        while True:
            x = random.randint(1, w // 2 - 2)
            y = 1
            if (x, y) not in all_coord:
                M[x, y].put(item_class())
                all_coord.append((x, y))
                break

    return M
Пример #2
0
def room_prison_cell(w=5, h=5, direction='down'):
    if direction == 'left' or direction == 'right':
        w, h = h, w
    M = Map(w, h, fill_cell=C.floor_flagged)
    prison_cell_type = random.choice(['with_prisoner', 'with_bones', 'with_blood', 'with_spider'])
    
    # Create walls
    for x in range(0, w):
        M[x, 0] = C.wall_stone()
        M[x, h-1] = C.wall_stone()
    for y in range(0, h):
        M[0, y] = C.wall_stone()
        M[w-1, y] = C.wall_stone()
    
    # Create prison bars and door
    M[1, h-1] = C.wall_bars()
    M[3, h-1] = C.wall_bars()
    M[2, h-1] = C.door_closed_bars()

    # Place some things
    all_coord = []
    if prison_cell_type == 'with_prisoner':
        for item_class in (T.furniture_napsack, T.bucket, T.furniture_torch):
            while True:
                x = random.randint(1, 3)
                y = random.randint(1, h-2)
                if (x, y) not in all_coord:
                    M[x, y].put(item_class())
                    all_coord.append((x,y))
                    break
    elif prison_cell_type == 'with_bones':
        for item_class in (T.bones, T.bones_skull):
            while True:
                x = random.randint(1, 3)
                y = random.randint(1, h-2)
                if (x, y) not in all_coord:
                    M[x, y].put(item_class())
                    all_coord.append((x, y))
                    break
    elif prison_cell_type == 'with_blood':
        for item_class in (T.bones_remains, T.effect_blood):
            while True:
                x = random.randint(1, 3)
                y = random.randint(1, h-2)
                if (x, y) not in all_coord:
                    M[x, y].put(item_class())
                    all_coord.append((x, y))
                    break
    elif prison_cell_type == 'with_spider':
        for item_class in (T.web, T.web, A.animal_spider):
            while True:
                x = random.randint(1, 3)
                y = random.randint(1, h-2)
                if (x, y) not in all_coord:
                    M[x, y].put(item_class())
                    all_coord.append((x, y))
                    break
    
    if direction == 'up':
        M.vmirror()
    elif direction == 'left':
        M.transpose()
    elif direction == 'right':
        M.transpose()
        M.hmirror()

    return M