Ejemplo n.º 1
0
 def open_file(filename):
     global x
     f = open(filename)
     buf = ansiparse.read_to_buffer(f)
     buf.x = x
     x += buf.width
     return buf
Ejemplo n.º 2
0
def create_room(name, prop):
    log.debug("Creating room: %r", name)
    filename = os.path.join('data','maps',name)
    f = open(filename)
    buf = ansiparse.read_to_buffer(f, width=state.config.viewport_width-2, max_height=state.config.viewport_height-2, crop=True)
    
    room = Room(name, buf, prop)
    room.move_player(room.start_x,room.start_y)
    #add some fluff
    if name == "beach.ans":
        room.explore_messages = [
        "<LIGHTBLUE>You are surrounded by water, with no other islands anywhere on the horizon.",
        "<YELLOW>There is a faded trail leading off to the east."
        ]
    if name == "ruins.ans":
        room.explore_messages = [
        "<YELLOW>The trail leads to a massive shrine of unknown origin.",
        "<WHITE>In the center of the shrine is a chasm with stairs leading down.",
        ]
    if name == "e-1.ans":
        room.explore_messages = [
        "<WHITE>The room sparkles with impossibly beautiful gems.",
        ]
    if name == "wse-1.ans":
        room.explore_messages = [
        "<LIGHTGREEN>This room is terrifyingly unnatural.",
        "<LIGHTMAGENTA>Your sanity begs you to leave quickly.",
        ]
    if name == 'w-1.ans':
        room.explore_messages = [
        "<LIGHTGREY>This appears to be the remains of an ancient prison",
        ]
    if name == 'nse-1.ans':
        room.explore_messages = [
        "<LIGHTGREY>Flooding has taken over much of this cavern.",
        ]
    if name == 'ns-1.ans':
        room.explore_messages = [
        "<LIGHTGREEN>This room is lush with plant life. You feel a bit like a bug in a forest.",
        ]
    if name == 'victory.ans':
        room.explore_messages = [
        "<WHITE>Congratulations! You are victorious over the magic of Melimnor.",
        "<LIGHTGREY>We hope you had fun.",
        "<DARKGREY>Thanks for playing!",
        ]
    #prop messages
    if prop == 'key':
        room.explore_messages.append(
        "<YELLOW>There is a key in this room!"
        )
    return room