예제 #1
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
예제 #2
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
예제 #3
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
예제 #4
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
예제 #5
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
예제 #6
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
예제 #7
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
예제 #8
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
예제 #9
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room12_description)
    global tree_container

    # valid commands for this room
    commands = [
        "go", "take", "drop", "use", "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

    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 = 10
                done_with_room = True
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room12_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room12_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room12_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room12_inventory, room12_locked,
                         response)
        elif the_command == "attack":
            if tree_container:
                if response[1] == "tree" or "roots":
                    if utils.has_a(player_inventory, "axe"):
                        print(
                            "you chop away the roots revealing the key and helm"
                        )
                        room12_inventory["helm"] = 1
                        room12_inventory["key"] = 1
                        tree_container = False
                    else:
                        print("this action requires an axe")
                else:
                    print("your option for attacking is roots")
            else:
                print("you alredy chopped away the roots")
        else:
            print("The command:", the_command,
                  "has not been implemented in room 12")

    return next_room
예제 #10
0
def run_room(player_inventory):
    global mimic_alive
    # Let the user know what the room looks like
    print(room9_description)

    # valid commands for this room
    commands = [
        "go", "take", "drop", "use", "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
    mimic_health = 10
    mimic_atk = 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 = 7
                done_with_room = True
            elif go_where == "east":
                next_room = 11
                done_with_room = True
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room9_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room9_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room9_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room9_inventory, room9_locked,
                         response)
        elif the_command == "attack":
            x = utils.attack(player_inventory, "mimic", mimic_health,
                             mimic_alive, response)
            mimic_health = x
            if x <= 0:
                print("the mimic is dead")
                mimic_alive = False
        else:
            print("The command:", the_command,
                  "has not been implemented in room 9")
        x = utils.creature_action(mimic_alive, player_inventory, mimic_atk,
                                  "mimic")
        if x:
            next_room = 666
            done_with_room = True
        if not mimic_alive:
            utils.health = utils.player_health["health"] + 2
            print(
                "the relaxed feeling o the library heals you 2 hp as you loosen up and your heart rate slows. \nThe smell of old books comforts you, it is friendly magic that's at work here"
            )
    return next_room
예제 #11
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    global wolves_alive
    print(room7_description)

    # valid commands for this room
    commands = [
        "go", "take", "drop", "use", "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
    wolves_health = 15
    wolves_atk = 7

    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 == "south":
                next_room = 5
                done_with_room = True
            elif go_where == "east":
                is_locked = room7_locked["east"]
                if not is_locked:
                    next_room = 9
                    done_with_room = True
                if is_locked:
                    print("door is locked")
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room7_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room7_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room7_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room7_inventory, room7_locked,
                         response)
        elif the_command == "attack":
            x = utils.attack(player_inventory, "wolves", wolves_health,
                             wolves_alive, response)
            wolves_health = x
            if x <= 0:
                print("the wolves are dead")
                wolves_alive = False
        else:
            print("The command:", the_command,
                  "has not been implemented in room 7")
        x = utils.creature_action(wolves_alive, player_inventory, wolves_atk,
                                  "wolves")
        if x:
            next_room = 666
            done_with_room = True
    return next_room
예제 #12
0
def run_room(player_inventory):
    # Let the user know what the room looks like
    print(room11_description)
    global kobolds_alive

    # valid commands for this room
    commands = ["go", "take", "drop", "use", "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
    kobolds_health = 15
    kobolds_atk = 6

    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 = 9
                done_with_room = True
            elif go_where == "north":
                is_locked = room11_locked["north"]
                if not is_locked:
                    next_room = 13
                    done_with_room = True
                if is_locked:
                    print("door is locked")
            else:
                print("That direction is not an option")
        elif the_command == 'take':
            utils.take(player_inventory, room11_inventory, response)
        elif the_command == 'drop':
            utils.drop(player_inventory, room11_inventory, response)
        elif the_command == "status":
            utils.player_status(player_inventory)
        elif the_command == "examine":
            utils.examine(room11_inventory)
        elif the_command == "unlock":
            utils.unlock(player_inventory, room11_inventory, room11_locked, response)
        elif the_command == "attack":
            x = utils.attack(player_inventory, "kobolds", kobolds_health, kobolds_alive, response)
            kobolds_health = x
            if x <= 0:
                print("the kobolds are dead")
                kobolds_alive = False
        else:
            print("The command:", the_command, "has not been implemented in room 11")
        x = utils.creature_action(kobolds_alive, player_inventory, kobolds_atk, "kobolds")
        if x:
            next_room = 666
            done_with_room = True
        if utils.has_a(player_inventory, "healing rune"):
            for i in range(3):
                if utils.player_health["health"] < 20:
                    utils.player_health["health"] = utils.player_health["health"] + 1
                print("you've been healed extra for having the healing rune and by the magical pool")
        else:
            for i in range(2):
                if utils.player_health["health"] < 20:
                    utils.player_health["health"] = utils.player_health["health"] + 1
            print("you've been healed for being by the magical pool")
    return next_room