Exemple #1
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    utils.print_description(room9_description)


    # valid commands for this room
    commands = ["go", "take", "drop", "use", "status"]
    no_args = ["status"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands, no_args)
        response = utils.scrub_response(response)
        the_command = response[0]

        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == 'south':
                is_locked = room8_state['door locked']
                if not is_locked:
                    next_room = 8
                    done_with_room = True
                else:
                    print('The door to Room 8 is locked.')
            else:
                print('You cannot go:', go_where)
        elif the_command == 'take':
            take_what = response[1]
            utils.take_item(player_inventory, room9_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room9_inventory, drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory)
            utils.room_status(room9_inventory)
        elif the_command == 'use':
            use_what = response[1]
            if use_what in player_inventory:
                if use_what == 'key':
                    direction = utils.prompt_question('Which door would you like to use the key on?', ['south'])
                    if direction.lower() == 'south':
                        print('The door was already unlocked')

                else:
                    print('You have no way to use:', use_what)
            else:
                print("You don't have:", use_what)
        else:
            print('The command:', the_command, 'has not been implemented in room 9.')


            # END of WHILE LOOP
    return next_room
def run_room(player_inventory):
    print(room13_description)

    commands = ["go", "take", "drop", "use", "status", "examine"]
    no_args = ["status", "examine"]

    next_room = -1

    done_with_room = False
    while not done_with_room:
        response = utils.ask_command("What do you want to do?", commands, no_args)
        the_command = response[0]

        if the_command == "go":
            go_where = response[1]
            if go_where == "west":
                next_room = 10
                done_with_room = True
            else:
                print("You cannot go", go_where)
        elif the_command == "take":
            take_what = response[1]
            utils.take_item(player_inventory, room13_inventory, take_what)
        elif the_command == "drop":
            drop_what = response[1]
            utils.drop_item(player_inventory, room13_inventory, drop_what)
        elif the_command == "status":
            utils.player_status(player_inventory)
            utils.room_status(room13_inventory)
        elif the_command == "examine":
            print(room13_description)
        elif the_command == "use":
            use_what = response[1]
            if use_what == "ruby":
                utils.use_gem("ruby", player_inventory, room13_status)
                if room13_status["ruby"] == 1 and room13_status["sapphire"] == 1 and room13_status["emerald"] == 1:
                    print(end_game)
                    next_room = 42
                    done_with_room = True
            elif use_what == "sapphire":
                utils.use_gem("sapphire", player_inventory, room13_status)
                if room13_status["ruby"] == 1 and room13_status["sapphire"] == 1 and room13_status["emerald"] == 1:
                    print(end_game)
                    next_room = 42
                    done_with_room = True
            elif use_what == "emerald":
                utils.use_gem("emerald", player_inventory, room13_status)
                if room13_status["ruby"] == 1 and room13_status["sapphire"] == 1 and room13_status["emerald"] == 1:
                    print(end_game)
                    next_room = 42
                    done_with_room = True
            elif use_what == "torch":
                utils.use_torch1(use_what, player_inventory)
            else:
                print("There is no reason to use,", use_what, "here")

        else:
            print("I do not understand:", the_command)

    return next_room
Exemple #3
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room5_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "examine", "status", "unlock"]
    no_args = ["examine", "status"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    print(
        "the face on the door's eyes glow red as it says, in order to pass ye must answer me."
    )
    response = input(
        "What is it that when you take away the whole, \nyou still have some left over?"
    )
    while not response.lower() == "wholesome":
        print("WRONG!!!!.")
        response = input(
            "Try again. What is it that when you take away the whole, \nyou still have some left over?"
        )
    utils.player_health["health"] = 20
    print("you pass, I have restored you to your full health")
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0].lower()
        response = utils.scrub_response(response)
        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == "north":
                next_room = 7
                done_with_room = True
            elif go_where == "south":
                next_room = 3
                done_with_room = True
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room5_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room5_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room5_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room5_inventory, room5_locked,
                         response)
        else:
            print("The command:", the_command,
                  "has not been implemented in room 5")

    return next_room
Exemple #4
0
def run_room(player_inventory):

    if room5_status["east_locked"] == 1:
        print(room5_description)
    else:
        print(room5_description_no_vines)

    commands = ["go", "take", "drop", "use", "status", "examine"]
    no_args = ["status", "examine"]

    next_room = -1

    done_with_room = False
    while not done_with_room:
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]

        if the_command == "go":
            go_where = response[1]
            if go_where == "south":
                next_room = 6
                done_with_room = True
            elif go_where == "north":
                next_room = 4
                done_with_room = True
            elif go_where == "east":
                if room5_status["east_locked"] == 1:
                    print("Vines block your path, try burning them down")
                else:
                    next_room = 8
                    done_with_room = True
            else:
                print("You cannot go", go_where)
        elif the_command == "status":
            utils.player_status(player_inventory)
            utils.room_status(room5_inventory)
        elif the_command == "examine":
            if room5_status["east_locked"] == 1:
                print(room5_description)
            else:
                print(room5_description_no_vines)
        elif the_command == "take":
            take_what = response[1]
            utils.take_item(player_inventory, room5_inventory, take_what)
        elif the_command == "use":
            use_what = response[1]
            if use_what == "torch":
                utils.use_torch(use_what, player_inventory, room5_status,
                                "east_locked")
            else:
                print("There is no reason to use,", use_what, "here")
        elif the_command == "drop":
            drop_what = response[1]
            utils.drop_item(player_inventory, room5_inventory, drop_what)
        else:
            print("I do not understand", the_command)

    return next_room
Exemple #5
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room7_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "examine", "status", "help"]
    no_args = ["examine", "status", "help"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]

        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == 'east':
                next_room = 8
                done_with_room = True
            elif go_where == 'north':
                if utils.has_a(player_inventory, 'golden goblet') == True:
                    print("The door is slammed shut")
                else:
                    next_room = 2
                    done_with_room = True
            else:
                print('You cannot go:', go_where)
        elif the_command == 'take':
            response = utils.scrub_response(response)
            take_what = response[1]
            utils.take_item(player_inventory, r7_inventory, take_what)
            if take_what == 'golden goblet':
                print("The door suddenly slams to the north!")
        elif the_command == 'drop':
            response = utils.scrub_response(response)
            drop_what = response[1]
            utils.drop_item(player_inventory, r7_inventory, drop_what)
            if drop_what == 'golden goblet':
                print("The door to the north swings back open!")
        elif the_command == 'status':
            utils.player_status(player_inventory)
            utils.room_status(r7_inventory)
        elif the_command == 'examine':
            print(room7_description)
        elif the_command == 'help':
            utils.player_help()
        else:
            print("The command:", the_command,
                  "has not been implemented in Room 7")

    # END of WHILE LOOP
    return next_room
Exemple #6
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room3_description)
    global kobold_alive

    # valid commands for this room
    commands = ["go", "take", "drop", "examine", "status", "unlock", "attack"]
    no_args = ["examine", "status"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1
    kobold_health = 12
    kobold_atk_org = 5


    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands, no_args)
        the_command = response[0].lower()
        response = utils.scrub_response(response)

        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == "west":
                next_room = 1
                done_with_room = True
            elif go_where == "north":
                next_room = 5
                done_with_room = True
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room3_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room3_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room3_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room3_inventory, room3_locked, response)
        elif the_command == "attack":
            x = utils.attack(player_inventory, "kobold", kobold_health, kobold_alive, response)
            kobold_health = x
            if x <= 0:
                print("the kobold is dead")
                kobold_alive = False
        else:
            print("The command:", the_command, "has not been implemented in room 3")
        x = utils.creature_action(kobold_alive, player_inventory, kobold_atk_org, "kobold")
        if x:
            next_room = 666
            done_with_room = True
    return next_room
Exemple #7
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room4_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "examine", "status", "unlock"]
    no_args = ["examine", "status"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0].lower()
        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == "west":
                is_locked = room4_locked["west"]
                if not is_locked:
                    next_room = 6
                    done_with_room = True
                if is_locked:
                    print("door is locked")
            elif go_where == "south":
                next_room = 8
                done_with_room = True
            elif go_where == "east":
                next_room = 2
                done_with_room = True
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room4_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room4_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room4_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room4_inventory, room4_locked,
                         response)
        else:
            print("The command:", the_command,
                  "has not been implemented in room 4")
        if utils.player_health["health"] < 20:
            utils.player_health["health"] = utils.player_health["health"] + 1
            print(
                "you've been healed one hp by the refreshing light of the blessing of mara"
            )
    return next_room
Exemple #8
0
def run_room(player_inventory):
    coin_count = room8_inventory["coin"]
    if coin_count < 1:
        print(room8_description_no_coin)
    else:
        print(room8_description)

    commands = ["go", "take", "drop", "use", "status", "examine"]
    no_args = ["status", "examine"]

    next_room = -1

    done_with_room = False
    while not done_with_room:
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]

        if the_command == "go":
            go_where = response[1]
            if go_where == "south":
                next_room = 7
                done_with_room = True
            elif go_where == "west":
                next_room = 5
                done_with_room = True
            elif go_where == "east":
                next_room = 9
                done_with_room = True
            else:
                print("You cannot go", go_where)
        elif the_command == "status":
            utils.player_status(player_inventory)
            utils.room_status(room8_inventory)
        elif the_command == "examine":
            coin_count = room8_inventory["coin"]
            if coin_count < 1:
                print(room8_description_no_coin)
            else:
                print(room8_description)
        elif the_command == "take":
            take_what = response[1]
            utils.take_item(player_inventory, room8_inventory, take_what)
        elif the_command == "use":
            use_what = response[1]
            if use_what == "torch":
                utils.use_torch1(use_what, player_inventory)
            else:
                print("There is no reason to use,", use_what, "here")
        elif the_command == "drop":
            drop_what = response[1]
            utils.drop_item(player_inventory, room8_inventory, drop_what)
        else:
            print("I do not understand", the_command)

    return next_room
Exemple #9
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room5_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "examine", "status", "help"]
    no_args = ["examine", "status", "help"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]

        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == 'south':
                next_room = 4
                done_with_room = True
            elif go_where == 'west':
                next_room = 6
                done_with_room = True
            else:
                print('You cannot go:', go_where)
        elif the_command == 'take':
            response = utils.scrub_response(response)
            take_what = response[1]
            utils.take_item(player_inventory, r5_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, r5_inventory, drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory)
            utils.room_status(r5_inventory)
        elif the_command == 'examine':
            print(room5_description)
        elif the_command == 'use':
            use_what = response[1]
            if use_what == 'button':
                player_inventory['special_item2'] = 7
                print("The button is pressed")
        elif the_command == 'help':
            utils.player_help()
        else:
            print("The command:", the_command,
                  "has not been implemented in Room 5")

    # END of WHILE LOOP
    return next_room
Exemple #10
0
def run_room(player_inventory):
    room2_description = '''
    . . . 2nd room ...
    You are in a brightly lit room. The room appears to be an office. There is a desk in the center of the room with
    a key and a flask on top. Next to the desk lies a unremarkable short sword covered in webs and dust. There is an exit 
    to the NORTH and to the SOUTH.'''

    print(room2_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "examine", "status", "help"]
    no_args = ["examine", "status", "help"]

    # nonsense room number, we need to figure out which room they want in the loop
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        response = utils.scrub_response(response)
        the_command = response[0]

        if the_command == 'go':
            direction = response[1]
            # Use your hand drawn map to help you think about what is valid
            if direction == 'north':
                next_room = 1
                done_with_room = True
            elif direction == 'south':
                next_room = 7
                done_with_room = True
            else:
                # In this room, there is nowhere else to go.
                print("There is no way to go,", direction)
        elif the_command == 'take':
            response = utils.scrub_response(response)
            take_what = response[1]
            utils.take_item(player_inventory, r2_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, r2_inventory, drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory)
            utils.room_status(r2_inventory)
        elif the_command == 'examine':
            print(room2_description)
        elif the_command == 'help':
            utils.player_help()
        else:
            print("Command not implemented in ROOM 2,", the_command)

    # end of main while loop
    return next_room
Exemple #11
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room5_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "examine", "status", "help"]
    no_args = ["examine", "status", "help"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]

        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == 'north':
                next_room = 4
                done_with_room = True
            elif go_where == 'south':
                next_room = 6
                done_with_room = True
            elif go_where == 'east':
                next_room = 13
                done_with_room = True
            else:
                print("Can't go", go_where)
        elif the_command == 'take':
            response = utils.scrub_response(response)
            take_what = response[1]
            utils.take_item(player_inventory, room5_inventory, take_what)
        elif the_command == 'status':
            utils.player_status(player_inventory)
            utils.room_status(room5_inventory, room5_interacts)
        elif the_command == 'drop':
            response = utils.scrub_response(response)
            drop_what = response[1]
            utils.drop_item(player_inventory, room5_inventory, drop_what)
        elif the_command == 'help':
            print(
                "The valid commands are",
                commands,
                no_args,
            )
        else:
            print("that command is not supported yet")
    # END of WHILE LOOP
    return next_room
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room3_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "status", "examine"]
    no_args = ["status", "examine"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]

        # now deal with the command
        if the_command == 'go':
            go_where = response[1]
            if go_where == "west":
                next_room = 1
                done_with_room = True
            elif go_where == "east":
                next_room = 4
                done_with_room = True
            else:
                print("You cannot go,", go_where)
        elif the_command == 'take':
            take_what = response[1]
            utils.take_item(player_inventory, room3_inventory, take_what)
        elif the_command == "status":
            utils.room_status(room3_inventory)
            utils.player_status(player_inventory)
        elif the_command == "examine":
            print(room3_description)
        elif the_command == "use":
            use_what = response[1]
            if use_what == "torch":
                utils.use_torch1(use_what, player_inventory)
            else:
                print("There is no reason to use,", use_what, "here")
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room3_inventory, drop_what)
        else:
            print("I do not understand", the_command)

            # END of WHILE LOOP
    return next_room
Exemple #13
0
def run_room(player_inventory):
    description = '''
    . . . Main Room . . .
    You open your eyes. The room you see is unfamiliar. You see a brightly lit
    doorway to the SOUTH. To the EAST you see a closed door. 

    '''
    print(description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "examine", "status", "unlock"]
    no_args = ["examine", "status"]

    # nonsense room number, we need to figure out which room they want in the loop
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0].lower()
        response = utils.scrub_response(response)
        if the_command == 'go':
            direction = response[1].lower()
            # Use your hand drawn map to help you think about what is valid
            if direction == 'south':
                next_room = 2
                done_with_room = True
            elif direction == 'east':
                is_locked = room1_locked["east"]
                if not is_locked:
                    next_room = 3
                    done_with_room = True
                if is_locked:
                    print("door is locked")
            else:
                # In this room, there is nowhere else to go.
                print("There is no way to go,", direction)
        elif the_command == 'take':
            utils.take(player_inventory, room1_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room1_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room1_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room1_inventory, room1_locked,
                         response)
    # end of while loop
    return next_room
Exemple #14
0
def run_room(player_inventory):

    room10_description = '''
    . . . 10th Room ...
    The room is filled entirely with smoke. You can barely make out the door to the south. 
    The source of the smoke must be close by.
    '''

    print(room10_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "examine", "status", "help"]
    no_args = ["examine", "status", "help"]

    # nonsense room number, we need to figure out which room they want in the loop
    next_room = -1
    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands, no_args)
        the_command = response[0]

        if the_command == 'go':
            direction = response[1]
            # Use your hand drawn map to help you think about what is valid
            if direction == 'west':
                next_room = 6
                done_with_room = True
            elif direction == 'south':
                next_room = 11
                done_with_room = True
            else:
                # In this room, there is nowhere else to go.
                print("There is no way to go,", direction)
        elif the_command == 'take':
            response = utils.scrub_response(response)
            take_what = response[1]
            utils.take_item(player_inventory, room10_inventory, take_what)
        elif the_command == 'status':
            utils.player_status(player_inventory)
            utils.room_status(room10_inventory, room10_interacts)
        elif the_command == 'drop':
            response = utils.scrub_response(response)
            drop_what = response[1]
            utils.drop_item(player_inventory, room10_inventory, drop_what)
        elif the_command == 'help':
            print("The valid commands are", commands, no_args, )
        else:
            print("Command not implemented in ROOM 2,", the_command)

    # end of main while loop
    return next_room
Exemple #15
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room8_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "examine", "status", "unlock"]
    no_args = ["examine", "status"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands, no_args)
        the_command = response[0].lower()
        response = utils.scrub_response(response)
        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == "north":
                next_room = 4
                done_with_room = True
            elif go_where == "south":
                next_room = 10
                done_with_room = True
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room8_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room8_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room8_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room8_inventory, room8_locked, response)
        else:
            print("The command:", the_command, "has not been implemented in room 8")
        if not utils.has_a(player_inventory, "antidote"):
            utils.player_health["health"] = utils.player_health["health"] - 2
            print("your throat is burning and your eyes water, you lose two hp")
            if utils.player_health["health"] <= 0:
                next_room = 666
                done_with_room = True
    return next_room
Exemple #16
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room6_description)

    # valid commands for this room
    commands = ["go", "take", "drop", "examine", "status", "unlock"]
    no_args = ["examine", "status"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0].lower()
        response = utils.scrub_response(response)
        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == "east":
                next_room = 4
                done_with_room = True
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room6_inventory, response)
            print("debug response", response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room6_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room6_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room6_inventory, room6_locked,
                         response)
        else:
            print("The command:", the_command,
                  "has not been implemented in room 6")
    return next_room
Exemple #17
0
def run_room(player_inventory):

    room2_description = '''
    . . . 
    You are in a brightly lit room. The room appears to be an office. 
    There is a key, pen and coffee mug on the corner of a desk.
    '''

    print(room2_description)

    # valid commands for this room
    commands = [
        "go", "take", "drop", "use", "examine", "status", "help", "open"
    ]
    no_args = ["examine", "status", "help"]

    # nonsense room number, we need to figure out which room they want in the loop
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]

        if the_command == 'go':
            direction = response[1].lower()
            # Use your hand drawn map to help you think about what is valid
            if direction == 'north':
                next_room = 1
                done_with_room = True
            else:
                # In this room, there is nowhere else to go.
                print("There is no way to go,", direction)
        elif the_command == 'take':
            response = utils.scrub_response(response)
            take_what = response[1]
            utils.take_item(player_inventory, room2_inventory, take_what)
        elif the_command == 'open':
            response = utils.scrub_response(response)
            if response[1] in room2_interacts:
                print("You opened", response[1])
            else:
                print("There is no", response[1], "to open")
        elif the_command == 'status':
            utils.player_status(player_inventory)
            utils.room_status(room2_inventory, room2_interacts)
        elif the_command == 'drop':
            response = utils.scrub_response(response)
            drop_what = response[1]
            utils.drop_item(player_inventory, room2_inventory, drop_what)
        elif the_command == 'help':
            print(
                "The valid commands are",
                commands,
                no_args,
            )
        else:
            print("Command not implemented in ROOM 2,", the_command)

    # end of main while loop
    return next_room
Exemple #18
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    # valid commands for this room
    room10_description = '''
        . . .  10th room ... 
        You find yourself in a darkly lit small room.
        '''

    if room10_inventory['rabbit'] > 0:
        room10_description = room10_description + "  A small rabbit sits on top of a large treasure chest."
    print(room10_description)

    commands = [
        "go", "take", "drop", "use", "drink", "examine", "status", "help"
    ]
    no_args = ["examine", "status", "help"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        response = utils.scrub_response(response)
        the_command = response[0].lower()

        # now deal with the command
        if the_command == 'go':
            direction = response[1].lower()
            if direction == 'east':
                next_room = 8
                done_with_room = True
            else:
                print("You cannot go", direction)
        elif the_command == 'take':
            take_what = response[1].lower()
            if take_what != 'rabbit':
                if take_what == 'treasure':
                    if room10_inventory['rabbit'] == 0:
                        utils.take_item(player_inventory, room10_inventory,
                                        take_what)
                        print(
                            "You find a tortoise named Maynard, and you get to keep him forever! THE END"
                        )
                        break
                    else:
                        print("The bunny still guards the treasure!")
                else:
                    utils.take_item(player_inventory, room10_inventory,
                                    take_what)
            else:
                print("You cannot take the rabbit.")
        elif the_command == 'status':
            utils.room_status(room10_inventory)
            utils.player_status(player_inventory)
        elif the_command == 'drink':
            potion = response[1]
            if potion == 'healing potion':
                if player_inventory['healing potion'] == 1:
                    print(
                        "You drink a healing potion. You gain 20 hit points.")
                    player_inventory[
                        'health'] = player_inventory['health'] + 20
                    print("Your health is now:", player_inventory['health'])
            elif potion == 'minor healing potion':
                if player_inventory['minor healing potion']:
                    print(
                        "You drink the minor healing potion. You gain 10 hit points."
                    )
                    player_inventory[
                        'health'] = player_inventory['health'] + 10
                    print("Your health is now:", player_inventory['health'])
            else:
                print("You do not have a healing potion Donny.")
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room10_inventory, drop_what)
        elif the_command == 'use':
            use_what = response[1]
            if use_what != 'holy hand grenade':
                if room10_inventory['rabbit'] > 0:
                    print("The rabbit seems to be immune to such attacks!")
                    print(
                        "The rabbit lunges and bites you for 10 points of damage!"
                    )
                    player_inventory[
                        'health'] = player_inventory['health'] - 10
                    print("Your health is now: ", player_inventory['health'])
                    if player_inventory['health'] <= 0:
                        print("You died! GAME OVER")
                        break
                else:
                    print("It does nothing.")
            if use_what == 'holy hand grenade':
                if room10_inventory['rabbit'] > 0:
                    blah = '''
                        After thoroughly reading the instructions, you count 'one......two.......five!, shit, three!!!"
                        the holy hand grenade sails through the air......... and hits the bunny on the head, killing him instantly. The holy hand grenade rolls
                        away and does nothing.
                        '''
                    print(blah)
                    room10_inventory['rabbit'] = 0
                else:
                    print("It does nothing.")
        elif the_command == 'examine':
            examine_what = response[1]
            if examine_what == 'map':
                utils.map(player_inventory)

            # END of WHILE LOOP - done_room
            # TODO return next room
    return next_room
Exemple #19
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    # valid commands for this room
    room6_description = '''
        . . .  6th room . . . 
        This room seems to have almost no purpose. Nothing but pictures hang on the wall. One of a mountain landscape with titled 'happy little accidents',
        one with a great battle scene between ancient men and a mammoth titled 'gory simplicity', and one of a wooden bowl of fruit titled 'pointless'.
        There is a door to the South, but it has no door knob, and no key hole. Just a thick layer of clay a soft stone cakes the front of the door.
        '''

    commands = [
        "go", "take", "drop", "use", "drink", "examine", "status", "help"
    ]
    no_args = ["examine", "status", "help"]

    print(room6_description)

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1
    door_writings = 0
    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        response = utils.scrub_response(response)
        the_command = response[0]

        # now deal with the command
        if the_command == 'go':
            direction = response[1].lower()
            if direction == 'west':
                next_room = 2
                done_with_room = True
            if direction == 'south':
                is_locked = room_state['door_locked']
                if not is_locked:
                    next_room = 12
                    done_with_room = True
                else:
                    print("The door is locked.")
            else:
                print("You cannot go", direction)
        elif the_command == 'take':
            take_what = response[1].lower()
            utils.take_item(player_inventory, room6_inventory, take_what)
        elif the_command == 'use':
            use_what = response[1]
            if use_what == 'pick axe':
                if room6_inventory['pick axe'] == 0:
                    print(
                        "You hack away the loose rock and clay to reveal a small bit of writing. It says: Answer this riddle correctly, and you may pass "
                        "through this door. (clears throat), thirty white horses on a red hill. First they champ, then they stamp, and then they "
                        "stand still. What is it?")
                    correct = False
                    while correct == False:
                        response = input("What is the answer?:")
                        if response != 'teeth':
                            print("Incorrect! Try Again!")
                        elif response == 'teeth':
                            print("Correct!")
                            door_locked = room_state["door_locked"]
                            correct = True
                            if door_locked:
                                room_state["door_locked"] = False
                                print("The door to the SOUTH is unlocked!")
                            else:
                                print("The door was already unlocked!")

        elif the_command == 'status':
            utils.room_status(room6_inventory)
            utils.player_status(player_inventory)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room6_inventory, drop_what)
        elif the_command == 'drink':
            potion = response[1]
            if potion == 'healing potion':
                if player_inventory['healing potion'] == 1:
                    print(
                        "You drink a healing potion. You gain 20 hit points.")
                    player_inventory[
                        'health'] = player_inventory['health'] + 20
                    print("Your health is now:", player_inventory['health'])
            elif potion == 'minor healing potion':
                if player_inventory['minor healing potion']:
                    print(
                        "You drink the minor healing potion. You gain 10 hit points."
                    )
                    player_inventory[
                        'health'] = player_inventory['health'] + 10
                    print("Your health is now:", player_inventory['health'])
            else:
                print("You do not have a healing potion Donny.")
        elif the_command == 'examine':
            examine_what = response[1]
            if examine_what == 'door':
                print(
                    "You notice some small cave paintings depicting the hunting of some kind of large animal."
                )
                door_writings = door_writings + 1
            if examine_what == 'gory simplicity':
                if door_writings == 1:
                    print(
                        "You notice the painting hides a secret alcove. Within the alcove lies a pick axe"
                    )
            if examine_what == 'happy little accidents':
                print(
                    "The painting is quite striking, and it seems to made by a strange man named Bob Ross."
                )
            if examine_what == 'pointless':
                print("It looks just like the title says it does: pointless.")
            if examine_what == 'map':
                utils.map(player_inventory)

            # END of WHILE LOOP - done_room
            # TODO return next room
    return next_room
Exemple #20
0
def run_room(player_inventory, player_equipped, combat_off_inventory,
             combat_spell_inventory, mobs, player_health):
    description = '''
    The room seems to look like an abandoned living space. There is an empty table in the center and a dusty study on the
    southern wall. There is a door to the north and a passage to the east.
    '''

    print(description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "status", "loot", "equip"]
    no_args = ["loot", "equip"]

    # nonsense room number, we need to figure out which room they want in the loop
    next_room = 8

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]
        if the_command == 'go':
            direction = response[1]
            if direction == 'north':
                if room_state['is_locked']:
                    print('''
            You suddenly hear a faint voice whisper, 'You may not go further into my residence if you do not
            identify my being. I have no legs, yet I can dance. I have no lungs, yet I breathe. I have no life to lose,
            yet I am capable of dying.'
                        ''')
                    while True:
                        print("Type 'Q' if you wish to stop guessing.")
                        answer = input("What am I?\n")
                        answer = answer.title()
                        if answer == 'Q':
                            print("You are done guessing.\n")
                            break
                        elif answer == 'Fire':
                            print(
                                "The voice catches your ear, saying 'You may enter'."
                            )
                            next_room = 10
                            room_state["is_locked"] = False
                            done_with_room = True
                            break
                        else:
                            print("The door does not move.\n")
                else:
                    print("The voice says, 'You may enter.'")
            elif direction == 'east':
                next_room = 5
                done_with_room = True
            else:
                print("\n\tYou may not go in that direction.\n\t")
        elif the_command == 'take':
            take_what = response[1]
            utils.take_item(player_inventory, room8_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room8_inventory, drop_what)
        elif the_command == 'status':
            status = response[1]
            if status == 'player':
                utils.player_status(player_inventory, player_equipped,
                                    player_health)
            elif status == 'room':
                utils.room_status(room8_inventory, room8_map,
                                  room8_loot_sources)
            else:
                print("That is not a valid option.")
        elif the_command == 'equip':
            utils.equip_item(player_equipped, player_inventory)
        elif the_command == 'loot':
            print("There is nothing to loot in this room.")
        elif the_command == 'use':
            interaction = response[1]
            if interaction == 'heal':
                if room_state['heal']:
                    if utils.has_a(player_inventory, 'Bolster'):
                        utils.heal(player_health, player_inventory,
                                   combat_spell_inventory)
                        room_state['heal'] = False
                    elif utils.has_a(player_inventory, 'Heal'):
                        utils.heal(player_health, player_inventory,
                                   combat_spell_inventory)
                        room_state['heal'] = False
                    else:
                        print("You do not have the heal spell!")
                else:
                    print("You have already used your heal in this room!\n")
        else:
            print("\n\tThat is not an available command in this room.\n\t")

    if player_health['pl_hp'] <= 0:
        print("A light consumes you...")
    else:
        print("\n\tYou press on the door and it slowly creaks ajar.")
        print("********************************************************\n")
    # end of main while loop
    return next_room
Exemple #21
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    # valid commands for this room
    room13_description = '''
        . . .  13th room ... 
        This room smells a lot like someone had a piss in it. A large shelf stands in the corner.
        '''

    if room13_inventory['bowling ball'] > 0:
        room13_description = room13_description + " A huge bowling ball sits on the table. On the front there is a name: Jeff Lebowski."
    if room13_inventory['sapphire'] > 0:
        room13_description = room13_description + " A sapphire the size of 2/17 of a mini-fridge sits on a pillow in the center of the room."
    if room13_inventory['rug'] > 0:
        room13_description = room13_description + " A rug that really ties the room together sits on the floor. There is a pee stain on it."
    print(room13_description)

    commands = [
        "go", "take", "drop", "use", "drink", "examine", "status", "help"
    ]
    no_args = ["examine", "status", "help"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        response = utils.scrub_response(response)
        the_command = response[0].lower()

        # now deal with the command
        if the_command == 'go':
            direction = response[1].lower()
            if direction == 'west':
                next_room = 12
                done_with_room = True
            else:
                print("You cannot go", direction)
        elif the_command == 'take':
            take_what = response[1].lower()
            utils.take_item(player_inventory, room13_inventory, take_what)
        elif the_command == 'status':
            utils.room_status(room13_inventory)
            utils.player_status(player_inventory)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room13_inventory, drop_what)
        elif the_command == 'drink':
            potion = response[1]
            if potion == 'healing potion':
                if player_inventory['healing potion'] == 1:
                    print(
                        "You drink a healing potion. You gain 20 hit points.")
                    player_inventory[
                        'health'] = player_inventory['health'] + 20
                    print("Your health is now:", player_inventory['health'])
            elif potion == 'minor healing potion':
                if player_inventory['minor healing potion']:
                    print(
                        "You drink the minor healing potion. You gain 10 hit points."
                    )
                    player_inventory[
                        'health'] = player_inventory['health'] + 10
                    print("Your health is now:", player_inventory['health'])
            else:
                print("You do not have a healing potion Donny.")
        elif the_command == 'examine':
            examine_what = response[1]
            if examine_what == 'map':
                utils.map(player_inventory)

            # END of WHILE LOOP - done_room
            # TODO return next room
    return next_room
Exemple #22
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    # valid commands for this room
    room3_description = '''
        . . .  3rd room ... 
        You are in a room that feels very familiar. There is a door to the north.
        '''

    if room3_inventory['sword'] > 0:
        room3_description = room3_description + " There is a sword hanging on the wall."
    if room3_inventory['clue'] > 0:
        room3_description = room3_description + " There is a clue on the desk."
    print(room3_description)

    commands = [
        "go", "take", "drop", "use", "drink", "examine", "status", "help"
    ]
    no_args = ["examine", "status", "help"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        response = utils.scrub_response(response)
        the_command = response[0].lower()

        # now deal with the command
        if the_command == 'go':
            direction = response[1].lower()
            if direction == 'west':
                next_room = 1
                done_with_room = True
            if direction == 'north':
                next_room = 4
                done_with_room = True
            else:
                print("You cannot go", direction)
        elif the_command == 'take':
            take_what = response[1].lower()
            utils.take_item(player_inventory, room3_inventory, take_what)
        elif the_command == 'status':
            utils.room_status(room3_inventory)
            utils.player_status(player_inventory)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room3_inventory, drop_what)
        elif the_command == 'examine':
            examine_what = response[1]
            if examine_what == 'clue':
                print(
                    "The clue reads: WITHIN THIS DUNGEON LIES A GREAT TREASURE. SEEK IT AT YOUR OWN RISK!!!"
                )
            if examine_what == 'sword':
                print("The sword is made of polished steel.")
            if examine_what == 'map':
                utils.map(player_inventory)
        else:
            print("Bleh")

            # END of WHILE LOOP - done_room
            # TODO return next room
    return next_room
Exemple #23
0
def run_room(player_inventory, player_equipped, combat_off_inventory,
             combat_spell_inventory, mobs, player_health):
    description = '''
    In the middle of the room is a fountain of blood. The fountain is elegantly designed with etchings of ancient battles
    between man and wolf.  The dark red light of the room fades into a ruby shade towards the middle of the room. There are
    passages going north and west.
    '''
    print(description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "status", "loot", "equip"]
    no_args = ["loot", "equip"]

    # nonsense room number, we need to figure out which room they want in the loop
    next_room = 4

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]
        if the_command == 'go':
            direction = response[1]
            if direction == 'north':
                next_room = 7
                done_with_room = True
            elif direction == 'west':
                next_room = 2
                done_with_room = True
            else:
                print("\n\tYou may not go in that direction.\n\t")
        elif the_command == 'take':
            take_what = response[1]
            utils.take_item(player_inventory, room4_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room4_inventory, drop_what)
        elif the_command == 'status':
            status = response[1]
            if status == 'player':
                utils.player_status(player_inventory, player_equipped,
                                    player_health)
            elif status == 'room':
                utils.room_status(room4_inventory, room4_map,
                                  room4_loot_sources)
            else:
                print("That is not a valid option.")
        elif the_command == 'equip':
            utils.equip_item(player_equipped, player_inventory)
        elif the_command == 'loot':
            print("There is nothing to loot in this room.")
        elif the_command == 'use':
            interaction = response[1]
            if interaction == 'heal':
                if room_state['heal']:
                    if utils.has_a(player_inventory, 'Bolster'):
                        utils.heal(player_health, player_inventory,
                                   combat_spell_inventory)
                        room_state['heal'] = False
                    elif utils.has_a(player_inventory, 'Heal'):
                        utils.heal(player_health, player_inventory,
                                   combat_spell_inventory)
                        room_state['heal'] = False
                    else:
                        print("You do not have the heal spell!")
                else:
                    print("You have already used your heal in this room!\n")
        else:
            print("\n\tThat is not an available command in this room.\n\t")

    if player_health['pl_hp'] <= 0:
        print("A light consumes you...")
    else:
        print("\n\tYou press on the door and it slowly creaks ajar.")
        print("********************************************************\n")
    # end of main while loop
    return next_room
def run_room(player_inventory):
    description = '''
    . . .Room 2. . . 
    You carefully walk down the stairs and descend into a cramped room with barrels stacked to 
    the ceiling. Whatever was inside them became rotten years ago and they expel a nearly 
    unbearable odor. Atop a barrel you see a *coin* glistening in the torchlight. You
    see stairs leading up to the north and stairs leading further down to the west.
    '''
    no_coin_description = '''
    . . .Room 2. . . 
    You carefully walk down the stairs and descend into a cramped room with barrels stacked to 
    the ceiling. Whatever was inside them became rotten years ago and they expel a nearly 
    unbearable odor. 
    You see stairs leading up to the north and stairs leading further down to the 
    west.
    '''

    coin_count = room2_inventory["coin"]
    if coin_count < 1:
        print(no_coin_description)
    else:
        print(description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "status", "examine"]
    no_args = ["status", "examine"]

    # nonsense room number, we need to figure out which room they want in the loop
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]

        if the_command == 'go':
            direction = response[1]
            # Use your hand drawn map to help you think about what is valid
            if direction == 'north':
                next_room = 1
                done_with_room = True
            elif direction == "west":
                next_room = 14
                done_with_room = True
            else:
                print("There is no way to go,", direction)
        elif the_command == 'take':
            take_what = response[1]
            utils.take_item(player_inventory, room2_inventory, take_what)
        elif the_command == "status":
            utils.room_status(room2_inventory)
            utils.player_status(player_inventory)
        elif the_command == "examine":
            coin_count = room2_inventory["coin"]
            if coin_count < 1:
                print(no_coin_description)
            else:
                print(description)
        elif the_command == "use":
            use_what = response[1]
            if use_what == "torch":
                utils.use_torch1(use_what, player_inventory)
            else:
                print("There is no reason to use,", use_what, "here")
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room2_inventory, drop_what)
        else:
            print("I do not understand", the_command)

    # end of main while loop
    return next_room
Exemple #25
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room13_description)
    global lizard_man_alive

    # valid commands for this room
    commands = ["go", "take", "drop", "examine", "status", "unlock", "attack"]
    no_args = [
        "examine",
        "status",
    ]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1
    kobold_king_atk = 7
    kobold_king_health = 20

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0].lower()
        response = utils.scrub_response(response)
        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == "north":
                is_locked = room13_locked["north"]
                if not is_locked:
                    next_room = 547
                    done_with_room = True
                if is_locked:
                    print("door is sealed with special glowing symbols")
            elif go_where == "south":
                next_room = 11
                done_with_room = True
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room13_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room13_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room13_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room13_inventory, room13_locked,
                         response)
        elif the_command == "attack":
            x = utils.attack(player_inventory, "lizard man",
                             kobold_king_health, lizard_man_alive, response)
            kobold_king_health = x + 1.5
            if x <= 0:
                lizard_man_alive = False
                print(
                    '''The lizard man falls to the ground with a satisfying thud. His face is locked in a final expression of
                pain and rage before going limp. Victory is yours. The door at the end of the hall's sealing runes fade away.
                ''')
                room13_locked["north"] = False
        else:
            print("The command:", the_command,
                  "has not been implemented in room 13")
        x = utils.creature_action(lizard_man_alive, player_inventory,
                                  kobold_king_atk, "lizard man")
        if x:
            next_room = 666
            done_with_room = True
    return next_room
Exemple #26
0
def run_room(player_inventory, player_equipped, combat_off_inventory,
             combat_spell_inventory, mobs, player_health):
    description = '''
    A glowing aura of blinding light floats in the center of the room. The aura hums and swirls, cascading light throughout
    the seemingly infinite room.
    '''
    print(description)

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "status", "loot", "equip"]
    no_args = ["loot", "equip"]

    # nonsense room number, we need to figure out which room they want in the loop
    next_room = 3

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]
        if the_command == 'go':
            direction = response[1]
            if direction == 'south':
                next_room = 9
                done_with_room = True
            else:
                print("\n\tYou may not go in that direction.\n\t")
        elif the_command == 'take':
            take_what = response[1]
            utils.take_item(player_inventory, room12_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room12_inventory, drop_what)
        elif the_command == 'status':
            status = response[1]
            if status == 'player':
                utils.player_status(player_inventory, player_equipped,
                                    player_health)
            elif status == 'room':
                utils.room_status(room12_inventory, room12_map,
                                  room12_loot_sources)
            else:
                print("That is not a valid option.")
        elif the_command == 'equip':
            utils.equip_item(player_equipped, player_inventory)
        elif the_command == 'loot':
            while True:
                print("The available loot sources are:\n")
                for key in room12_loot_sources.keys():
                    print("\t\t", key)
                chosen = input(
                    "\nWhich would you like to loot? Type 'Q' if you wish to stop looting.\n\t"
                )
                chosen = chosen.title()
                if chosen == 'Q':
                    break
                elif chosen in room12_loot_sources:
                    utils.loot(chosen, room12_loot_sources, player_inventory)
                    break
                else:
                    print("That is not an available loot source.\n")
        elif the_command == 'use':
            interaction = response[1]
            if interaction == 'heal':
                print(
                    "A strange wind blows through the room and snuffs out the magic you are trying to use."
                )
        else:
            print("\n\tThat is not an available command in this room.\n\t")

    if player_health['pl_hp'] <= 0:
        print("A light consumes you...")
    else:
        print("\n\tYou close you eyes and the light fades.\n\t")
        print("The torch you had placed has been burned up.")
    # end of main while loop
    return next_room
Exemple #27
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    # valid commands for this room
    room9_description = '''
        . . .  9th room ... 
        This room is brightly lit with candles, and the granite walls are slick with dew.
        '''

    if room9_inventory['gold key'] > 0:
        room9_description = room9_description + " The gold key hangs from a hook."
    if room9_inventory['holy hand grenade'] > 0:
        room9_description = room9_description + " A holy hand grenade rests on a golden pillow."
    print(room9_description)

    commands = [
        "go", "take", "drop", "use", "drink", "examine", "status", "help"
    ]
    no_args = ["examine", "status", "help"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        response = utils.scrub_response(response)
        the_command = response[0]

        # now deal with the command
        if the_command == 'go':
            direction = response[1].lower()
            if direction == 'west':
                next_room = 8
                done_with_room = True
            else:
                print("You cannot go", direction)
        elif the_command == 'take':
            take_what = response[1].lower()
            utils.take_item(player_inventory, room9_inventory, take_what)
        elif the_command == 'status':
            utils.room_status(room9_inventory)
            utils.player_status(player_inventory)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room9_inventory, drop_what)
        elif the_command == 'drink':
            potion = response[1]
            if potion == 'healing potion':
                if player_inventory['healing potion'] == 1:
                    print(
                        "You drink a healing potion. You gain 20 hit points.")
                    player_inventory[
                        'health'] = player_inventory['health'] + 20
                    print("Your health is now:", player_inventory['health'])
            elif potion == 'minor healing potion':
                if player_inventory['minor healing potion']:
                    print(
                        "You drink the minor healing potion. You gain 10 hit points."
                    )
                    player_inventory[
                        'health'] = player_inventory['health'] + 10
                    print("Your health is now:", player_inventory['health'])
            else:
                print("You do not have a healing potion Donny.")
        elif the_command == 'examine':
            examine_what = response[1]
            if examine_what == 'holy hand grenade':
                print("The grenade has directions that read:")
                phoo = '''
                
                And the Lord spake, saying, First shalt
               thou take out the Holy Pin.

               Then, shalt thou count to three, no more,
               no less.

              Three shalt be the number thou shalt
              count, and the number of the counting
              shalt be three.

              Four shalt thou not count,
              nor either count thou two, excepting that
              thou then proceed to three.

              Five is right out. 

              Once the number three,
              being the third number, be reached, then
              lobbest thou thy Holy Hand Grenade of
              Antioch towards thy foe, who being
              naughty in my sight, shall snuf it.
              '''
                print(phoo)
            if examine_what == 'map':
                utils.map(player_inventory)

            # END of WHILE LOOP - done_room
            # TODO return next room
    return next_room
Exemple #28
0
def run_room(player_inventory):
    global rat_alive
    description = '''
    . . . 
    You are in a brightly lit room. The room appears to be an office. There are doors exiting heading west and north.
    There is a large rat lying on the table.'''

    print(description)

    # valid commands for this room
    commands = ["go", "take", "drop", "examine", "status", "attack", "unlock"]
    no_args = ["examine", "status"]

    # nonsense room number, we need to figure out which room they want in the loop
    next_room = -1
    rat_health = 5
    rat_atk_org = 3

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0].lower()
        response = utils.scrub_response(response)
        if the_command == 'go':
            direction = response[1].lower()
            # Use your hand drawn map to help you think about what is valid
            if direction == 'north':
                next_room = 1
                done_with_room = True
            elif direction == "west":
                next_room = 4
                done_with_room = True
            else:
                # In this room, there is nowhere else to go.
                print("There is no way to go", direction)
        elif the_command == 'take':
            utils.take(player_inventory, room2_inventory, response)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room2_inventory, room2_locked,
                         response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room2_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room2_inventory)
        elif the_command == "attack":
            x = utils.attack(player_inventory, "rat", rat_health, rat_alive,
                             response)
            rat_health = x
            if x <= 0:
                print("the rat is dead")
                rat_alive = False
        else:
            print("Command not implemented in ROOM 2,", the_command)
        x = utils.creature_action(rat_alive, player_inventory, rat_atk_org,
                                  "rat")
        if x:
            next_room = 666
            done_with_room = True
    # end of main while loop
    return next_room
Exemple #29
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    # valid commands for this room
    room8_description = '''
        . . .  8th room ... 
        You are standing in a hallway. There is a door to the EAST and a locked door to the WEST. 
        '''

    if room8_inventory['elven greatsword'] > 0:
        room8_description = room8_description + " There is an elven greatsword hanging on the wall."
    if room8_inventory['book'] > 0:
        room8_description = room8_description + " There is a book on a desk."
    print(room8_description)

    commands = [
        "go", "take", "drop", "use", "drink", "examine", "status", "help"
    ]
    no_args = ["examine", "status", "help"]

    # nonsense room number,
    # In the loop below the user should eventually ask to "go" somewhere.
    # If they give you a valid direction then set next_room to that value
    next_room = -1

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        response = utils.scrub_response(response)
        the_command = response[0].lower()

        # now deal with the command
        if the_command == 'go':
            direction = response[1].lower()
            if direction == 'west':
                is_locked = room_state['door_locked']
                if not is_locked:
                    next_room = 10
                    done_with_room = True
                else:
                    print("The door is locked.")
            if direction == 'east':
                next_room = 9
                done_with_room = True
            if direction == 'south':
                next_room = 5
                done_with_room = True
            else:
                print("You cannot go", direction)
        elif the_command == 'take':
            take_what = response[1].lower()
            utils.take_item(player_inventory, room8_inventory, take_what)
        elif the_command == 'status':
            utils.room_status(room8_inventory)
            utils.player_status(player_inventory)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room8_inventory, drop_what)
        elif the_command == 'use':
            use_what = response[1]
            if use_what == 'gold key':
                if 'gold key' not in player_inventory.keys():
                    print("You don't have a gold key!")
                else:
                    door_locked = room_state["door_locked"]
                    if door_locked:
                        room_state["door_locked"] = False
                        print("The door to the WEST is unlocked!")
                    else:
                        print("The door was already unlocked!")
        elif the_command == 'drink':
            potion = response[1]
            if potion == 'healing potion':
                if player_inventory['healing potion'] == 1:
                    print(
                        "You drink a healing potion. You gain 20 hit points.")
                    player_inventory[
                        'health'] = player_inventory['health'] + 20
                    print("Your health is now:", player_inventory['health'])
            elif potion == 'minor healing potion':
                if player_inventory['minor healing potion']:
                    print(
                        "You drink the minor healing potion. You gain 10 hit points."
                    )
                    player_inventory[
                        'health'] = player_inventory['health'] + 10
                    print("Your health is now:", player_inventory['health'])
            else:
                print("You do not have a healing potion Donny.")
        elif the_command == 'examine':
            examine_what = response[1]
            if examine_what == 'book':
                print("The book has no writing in it.")
            if examine_what == 'map':
                utils.map(player_inventory)

            # END of WHILE LOOP - done_room
            # TODO return next room
    return next_room
Exemple #30
0
def run_room(player_inventory):

    room6_description = ''' 
    . . .Room 6. . .
    You enter a room filled with wooden crates stacked three high, 
    they all have some odd characters inscribed on their sides that you 
    are unable to read. There are empty flasks, small empty bags with the 
    names of herbs written on them, and in the corner of the room you see
    one, lone, shimmering, *coin*.
    You see a passage to the north, and east'''

    room6_descripton_no_coin =  ''' 
    . . .Room 6. . .
    You enter a room filled with wooden crates stacked three high, 
    they all have some odd characters inscribed on their sides that you 
    are unable to read. There are empty flasks and small empty bags with the 
     names of herbs written on them.
     You see a passage to the north, and east'''
    coin_count = room6_inventory["coin"]
    if coin_count < 1:
        print(room6_descripton_no_coin)
    else:
        print(room6_description)

    commands = ["go", "take", "drop", "use", "status", "examine"]
    no_args = ["status", "examine"]

    next_room = -1

    done_with_room = False
    while not done_with_room:
        response = utils.ask_command("What do you want to do?", commands, no_args)
        the_command = response[0]

        if the_command == "go":
            go_where = response[1]
            if go_where == "north":
                next_room = 5
                done_with_room = True
            elif go_where == "east":
                next_room = 7
                done_with_room = True
            else:
                print("You cannot go", go_where)
        elif the_command == "status":
            utils.player_status(player_inventory)
            utils.room_status(room6_inventory)
        elif the_command == "examine":
            coin_count = room6_inventory["coin"]
            if coin_count < 1:
                print(room6_descripton_no_coin)
            else:
                print(room6_description)
        elif the_command == "take":
            take_what = response[1]
            utils.take_item(player_inventory, room6_inventory, take_what)
        elif the_command == "use":
            use_what = response[1]
            if use_what == "torch":
                utils.use_torch1(use_what, player_inventory)
            else:
                print("There is no reason to use,", use_what, "here")
        elif the_command == "drop":
            drop_what = response[1]
            utils.drop_item(player_inventory, room6_inventory, drop_what)
        else:
            print("I do not understand", the_command)

    return next_room