Exemple #1
0
def run_room(player_inventory, rooms_visited):
    room_visited = utils.room_visited_check(rooms_visited, 11)
    if room_visited == True:
        print(Fore.BLUE + Style.BRIGHT + room_description_visited +
              Style.RESET_ALL)
    else:
        print(Fore.BLUE + Style.BRIGHT + room_description + Style.RESET_ALL)
    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("Which direction do you want to go?",
                                     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 = 12
                done_with_room = True
            elif go_where == 'south':
                next_room = 10
                done_with_room = True
            else:
                print(go_where, 'is not a valid direction')
                # END of WHILE LOOP
        else:
            print('the command', the_command, 'has not been implemented')
    return next_room
Exemple #2
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room14_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 = -5

    done_with_room = True
    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 = 6
                done_with_room = True
            else:
                print('You cannot go:', go_where)
        else:
            print("The command:", the_command,
                  "has not been implemented in Room 14")

    # 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 #4
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
Exemple #5
0
def run_room(player_inventory, rooms_visited):
    # Let the user know what the room looks like
    print(Fore.BLUE + Style.BRIGHT + room8_description + Style.RESET_ALL)
    # 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("Which direction do you want to go?",
                                     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 = 5
                done_with_room = True
            if go_where == 'east':
                if utils.has_a(player_inventory, 'key') == True:
                    next_room = 9
                    done_with_room = True
                else:
                    print('The door is locked')
            else:
                print(go_where, 'is not a valid direction')
                # END of WHILE LOOP
        else:
            print('the command', the_command, 'has not been implemented')
    return next_room
Exemple #6
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 #7
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 #8
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 #9
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 #10
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 #11
0
def run_room(player_inventory, rooms_visited):
    # Let the user know what the room looks like
    print(Fore.BLUE + Style.BRIGHT + room4_description + Style.RESET_ALL)

    # valid commands for this room
    commands = ["go", "confront", "help"]
    no_args = ["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 = 5
                done_with_room = True
            else:
                print(go_where, 'is not a valid direction')
                # END of WHILE LOOP
        elif the_command == 'confront':
            if utils.has_a(player_inventory, 'gun') == True:
                chance = random.randint(1, 10)
                if chance < 7:
                    print(
                        "You shoot and kill the bear. In the bear's nest is a suit of armor. You feel even more powerful"
                    )
                    utils.take_item(player_inventory, room_inventory, 'armor')
                    print("You head east")
                    time.sleep(2)
                    next_room = 5
                    done_with_room = True
                else:
                    print(
                        'You shoot at the bear, but miss. The bear rips your body into ribbons of flesh'
                    )
                    next_room = 0
                    done_with_room = True
            else:
                print(
                    "The bear is angry, it rips your body into ribbons of flesh"
                )
                next_room = 0
                done_with_room = True
        else:
            print('the command', the_command, 'has not been implemented')
    return next_room
Exemple #12
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 #13
0
def run_room(player_inventory, rooms_visited):
    description = '''
    . . .
    You are in a brightly lit room. The room appears to be an office. There is a desk. There is a door to the SOUTH
    
'''
    #
    #
    # if room_inventory['key'] > 0:
    #     description = description + '\nYou notice a key on the desk'
    # else:
    #     description = description + '\nThe desk surface is empty'
    #
    print(Fore.BLUE + Style.BRIGHT + description + Style.RESET_ALL)


    # 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 == 'north':
                next_room = 1
                done_with_room = True
            if direction == 'south':
                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':
            take_what = response[1]
            # What are they trying to take?
            if take_what == "gun":
                if utils.has_a(room_inventory, 'gun'):
                    utils.take_item(player_inventory, room_inventory, 'gun')
                    gun_prompt = "  In the desk is a gun. You feel powerful"
                    print(Fore.BLUE + Style.BRIGHT + gun_prompt + Style.RESET_ALL)
                else:
                    gun_taken = '   You already took the gun'
                    print(Fore.BLUE + Style.BRIGHT + gun_taken + Style.RESET_ALL)

            else:
                print("You can not take,", take_what)
    # end of main while loop
    return next_room
Exemple #14
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 #15
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
Exemple #16
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
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 #18
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 #19
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 #20
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 #21
0
def run_room(player_inventory, rooms_visited):
    # Let the user know what the room looks like
    print(Fore.BLUE + Style.BRIGHT + room5_description + Style.RESET_ALL)

    # valid commands for this room
    commands = ["go", "confront", "help"]
    no_args = ["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 = 8
                done_with_room = True
            else:
                print(go_where, 'is not a valid direction')
                # END of WHILE LOOP
        elif the_command == 'confront':
            confront = '''
    The shark tells you of a top secret room to the NORTH that can take you to safety.
            '''
            print(Fore.BLUE + Style.BRIGHT + confront + Style.RESET_ALL)
            answer_shark = False
            while not answer_shark:
                trust_shark = input(
                    "Do you trust the shark and go to the secret room?")
                if trust_shark.lower() == 'yes':
                    next_room = 6
                    answer_shark = True
                elif trust_shark.lower() == 'no':
                    next_room = 8
                    answer_shark = True
                else:
                    print("Response not valid")
            done_with_room = True
        else:
            print('the command', the_command, 'has not been implemented')
    return next_room
Exemple #22
0
def run_room(player_inventory, rooms_visited):
    room_visited = utils.room_visited_check(rooms_visited, 1)
    if room_visited == True:
        print(Fore.BLUE + Style.BRIGHT + description_visited + Style.RESET_ALL)
    else:
        print(Fore.BLUE + Style.BRIGHT + description + Style.RESET_ALL)
    # valid commands for this room
    commands = ["go", "take", "drop", "use", "examine", "status", "help", "dev"]
    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 == 'dev':
            next_room = int(response[1])
            done_with_room = True
        elif the_command == 'go':
            direction = response[1]
            # 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':
                next_room = 3
                done_with_room = True
                print("You open the door to the east.")
            elif direction == 'west' and utils.room_visited_check(rooms_visited, 1):
                next_room = 6
                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':
            print("There is nothing to take here.")
        elif the_command == 'drop':
            drop_what = response[1]
            if drop_what in inventory.keys():
                del inventory[drop_what]
                print("You no longer possess,", drop_what)

    # end of while loop
    return next_room
Exemple #23
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 #24
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room12_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("Go up or down?", commands, no_args)
        the_command = response[0]

        # now deal with the command
        if the_command == 'go':
            go_where = response[1].lower()
            if go_where == 'west':
                next_room = 11
                done_with_room = True
            elif go_where == 'up':
                next_room = 14
                done_with_room = True
            elif go_where == 'down':
                next_room = 15
                done_with_room = True
            else:
                print("Can't go", go_where)
        else:
            print("You can't do that in this room.")
    # END of WHILE LOOP
    return next_room
Exemple #25
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
Exemple #26
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 #27
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 #28
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 #29
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 #30
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