Exemple #1
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 #2
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 #3
0
def run_room(player_inventory, player_equipped, combat_off_inventory, combat_spell_inventory, mobs, player_health):
    description = '''
           A puddle of blood covers the dungeon floor, coming from a body the wolf was feasting on. The body was the commanding
           officer who had given you a walk through the prison. There are passages going north, east, south, and west.
           '''
    next_room = 6
    done_with_room = False

    if room_state['encounter']:
        print("Before you are able to get a good look around, a wolf pounces at you!")
        utils.combat(player_equipped, player_inventory, combat_off_inventory, combat_spell_inventory, mobs, mob,
                     player_health, wolf_attack)
        room_state['encounter'] = False
        if player_health['pl_hp'] <= 0:
            next_room = 15
            done_with_room = True

    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

    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 = 11
                done_with_room = True
            elif direction == 'east':
                next_room = 7
                done_with_room = True
            elif direction == 'south':
                next_room = 2
                done_with_room = True
            elif direction == 'west':
                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, room6_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room6_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(room6_inventory, room6_map, room6_loot_sources)
            else:
                print("That is not a valid option.")
        elif the_command == 'equip':
            utils.equip_item(player_equipped, player_inventory)
        elif the_command == 'loot':
            while True:
                print("The available loot sources are:\n")
                for key in room6_loot_sources.keys():
                    print("\t\t", key)
                chosen = input("\nWhich would you like to loot? Type 'Q' if you wish to stop looting.\n\t")
                chosen = chosen.title()
                if chosen == 'Q':
                    break
                elif chosen in room6_loot_sources:
                    utils.loot(chosen, room6_loot_sources, player_inventory)
                    break
                else:
                    print("That is not an available loot source.\n")
        elif the_command == 'use':
            interaction = response[1]
            if interaction == 'heal':
                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 #4
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 giant hearth. Next to the hearth is an empty set of armor holding a sword in the fire,
    as if it were poking the flames. The sword shines bright red and is on fire, yet not bent or melting in the slightest.
    There is a passage to the south.
    '''

    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 = 10

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands,
                                     no_args)
        the_command = response[0]
        if the_command == 'go':
            direction = response[1]
            if direction == 'south':
                next_room = 8
                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, room10_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room10_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(room10_inventory, room10_map,
                                  room10_loot_sources)
            else:
                print("That is not a valid option.")
        elif the_command == 'equip':
            utils.equip_item(player_equipped, player_inventory)
        elif the_command == 'loot':
            while True:
                print("The available loot sources are:\n")
                for key in room10_loot_sources.keys():
                    print("\t\t", key)
                chosen = input(
                    "\nWhich would you like to loot? Type 'Q' if you wish to stop looting.\n\t"
                )
                chosen = chosen.title()
                if chosen == 'Q':
                    break
                elif chosen in room10_loot_sources:
                    utils.loot(chosen, room10_loot_sources, player_inventory)
                    break
                else:
                    print("That is not an available loot source.\n")
        elif the_command == 'use':
            interaction = response[1]
            if interaction == 'heal':
                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 #5
0
def run_room(player_inventory, player_equipped, combat_off_inventory, combat_spell_inventory, mobs, player_health):
    description = '''
    The northern wall has a bookcase covering it. The bookcase is filled with cobwebs and only contains one book.
    There are passages going east, south, 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 = 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]
        if the_command == 'go':
            direction = response[1]
            if direction == 'east':
                next_room = 9
                done_with_room = True
            elif direction == 'south':
                next_room = 4
                done_with_room = True
            elif direction == 'west':
                next_room = 6
                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, room7_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room7_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(room7_inventory, room7_map, room7_loot_sources)
            else:
                print("That is not a valid option.")
        elif the_command == 'equip':
            utils.equip_item(player_equipped, player_inventory)
        elif the_command == 'loot':
            while True:
                print("The available loot sources are:\n")
                for key in room7_loot_sources.keys():
                    print("\t\t", key)
                chosen = input("\nWhich would you like to loot? Type 'Q' if you wish to stop looting.\n\t")
                chosen = chosen.title()
                if chosen == 'Q':
                    break
                elif chosen in room7_loot_sources:
                    utils.loot(chosen, room7_loot_sources, player_inventory)
                    break
                else:
                    print("That is not an available loot source.\n")
        elif the_command == 'use':
            interaction = response[1]
            if interaction == 'heal':
                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 #6
0
def run_room(player_inventory, player_equipped, player_health,
             combat_spell_inventory):

    description = '''
    A red light persists throughout the room and shines down on an blood trail going north. There is a faint drip of water 
    coming from the ceiling. There are passages going north, east, south, and west.
    '''
    player_hp = utils.get_player_hp(player_health)
    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 = 2

    done_with_room = False
    if player_hp == 0:
        next_room = 15
        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]
        if the_command == 'go':
            direction = response[1]
            if direction == 'east':
                next_room = 4
                done_with_room = True
            elif direction == 'west':
                next_room = 3
                done_with_room = True
            elif direction == 'north':
                next_room = 6
                done_with_room = True
            elif direction == 'south':
                next_room = 1
                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, room2_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room2_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(room2_inventory, room2_map,
                                  room2_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 are no loot sources 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 #7
0
def run_room(player_inventory, player_equipped, combat_off_inventory, combat_spell_inventory, mobs, player_health):
    description = '''
    There are skeletons of small animals covering the ground. On the northern wall is gate with a massive bloody paw print
    covering what seems to be a keyhole. There are passages to the north and to the south.
    '''

    next_room = 11
    done_with_room = False

    print(description)

    if room_state['encounter']:
        print("Amongst the bones in the room stands a massive wolf with many scars covering it's face. It's beaming eyes"
              "match the same tint of red as the blood on it's claws. Around it's neck is a rope with a key on it.")
        utils.combat(player_equipped, player_inventory, combat_off_inventory, combat_spell_inventory, mobs, mob,
                     player_health, wolf_attack)
        room_state['encounter'] = False
        if player_health['pl_hp'] <= 0:
            next_room = 15
            done_with_room = True
        else:
            utils.take_item(player_inventory, room11_inventory, 'Key')

    # 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
    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("The door is locked.")
                else:
                    print("You enter the room.")
                    next_room = 13
                    done_with_room = True
            elif direction == 'south':
                next_room = 6
                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, room11_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room11_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(room11_inventory, room11_map, room11_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")
            if interaction == 'key':
                if utils.has_a(player_inventory, 'Key'):
                    if room_state['is_locked']:
                        print("You place the key into the keyhole and turn it until it clicks.\n")
                        room_state['is_locked'] = False
                        while True:
                            answer = input("Would you like to enter?")
                            answer = answer.title()
                            if answer == 'Yes':
                                next_room = 13
                                done_with_room = True
                                break
                            elif answer == 'No':
                                print("You back away from the room with the door still unlocked.")
                                break
                            else:
                                print("That is not a valid response.\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 #8
0
def run_room(player_inventory, player_equipped, combat_off_inventory,
             combat_spell_inventory, mobs, player_health):
    description = (
        "\nThe red light still shines in the dimly light room, exposing the gruesome scene of what used to"
        "\nguards. To the west is a mossy wall stained with blood. To the east is a wall with guard's corpse"
        "\npropped up against it. In the center are the torn shackles and another corpse. There's a passage going"
        "\nnorth.\n")

    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 = -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':
                if room_state['encounter']:
                    print(
                        "As you go to enter the next room, a Young Wolf attacks you!"
                    )
                    utils.combat(player_equipped, player_inventory,
                                 combat_off_inventory, combat_spell_inventory,
                                 mobs, mob, player_health, rat_attack)
                    room_state['encounter'] = False
                    if player_health['pl_hp'] <= 0:
                        next_room = 15
                        done_with_room = True
                    else:
                        next_room = 2
                        done_with_room = True
                else:
                    next_room = 2
                    done_with_room = True
            else:
                print("\n\tYou may not go in that direction.\n\t")
        elif the_command == 'take':
            response = utils.scrub_response(response)
            take_what = response[1]
            utils.take_item(player_inventory, room1_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room1_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(room1_inventory, room1_map,
                                  room1_loot_sources)
            else:
                print("That is not a valid option.")
        elif the_command == 'equip':
            utils.equip_item(player_equipped, player_inventory)
        elif the_command == 'loot':
            while True:
                print("The available loot sources are:\n")
                for key in room1_loot_sources.keys():
                    print("\t\t", key)
                chosen = input(
                    "\nWhich would you like to loot? Type 'Q' if you wish to stop looting.\n\t"
                )
                chosen = chosen.title()
                if chosen == 'Q':
                    break
                elif chosen in room1_loot_sources:
                    utils.loot(chosen, room1_loot_sources, player_inventory)
                    break
                else:
                    print("That is not an available loot source.\n")
        elif the_command == 'use':
            interaction = response[1]
            if interaction == 'heal':
                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("That is not an option in this room.")
        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("********************************************************")
    # end of while loop
    return next_room
Exemple #9
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 an ancient statue depicting a man with a sword fending off three wolves. The sword the warrior
    is holding is not cement like the statue, instead it looks like it's made of metal and has a realistic sheen. The warrior
    has an insignia on his arm saying 'Protector of the Flame'. There are passages going north and east.
    '''

    next_room = 3
    done_with_room = False

    print(description)

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

    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 = 5
                done_with_room = True
            elif direction == 'east':
                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, room3_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room3_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(room3_inventory, room3_map,
                                  room3_loot_sources)
            else:
                print("That is not a valid option.")
        elif the_command == 'equip':
            utils.equip_item(player_equipped, player_inventory)
        elif the_command == 'loot':
            while True:
                print("The available loot sources are:\n")
                for key in room3_loot_sources.keys():
                    print("\t\t", key)
                chosen = input(
                    "\nWhich would you like to loot? Type 'Q' if you wish to stop looting.\n\t"
                )
                chosen = chosen.title()
                if chosen == 'Q':
                    break
                elif chosen in room3_loot_sources:
                    utils.loot(chosen, room3_loot_sources, player_inventory)
                    break
                else:
                    print("That is not an available loot source.\n")
        elif the_command == 'use':
            interaction = response[1]
            if interaction == 'heal':
                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 #10
0
def run_room(player_inventory, player_equipped, combat_off_inventory,
             combat_spell_inventory, mobs, player_health):
    description = '''
    On the western wall there is a painting of a man neatly dressed, giving the impression of a baron or a bishop. Upon closer
    inspection you see the man has the paws of a wolf and his eyes are a dark red. On the northern wall is an empty torch
    sconce. There is a passage going west.
    '''

    next_room = 9
    done_with_room = False

    if room_state['encounter']:
        print(
            "You walk into the room and see a grimacing wolf with beaming red eyes staring you down. The wolf has jet black"
            "fur and massive talons.")
        utils.combat(player_equipped, player_inventory, combat_off_inventory,
                     combat_spell_inventory, mobs, mob, player_health,
                     alpha_attack)
        room_state['encounter'] = False
        if player_health['pl_hp'] <= 0:
            next_room = 15
            done_with_room = True
        else:
            print(description)

    else:
        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
    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 == 'west':
                next_room = 7
                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, 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':
            status = response[1]
            if status == 'player':
                utils.player_status(player_inventory, player_equipped,
                                    player_health)
            elif status == 'room':
                utils.room_status(room9_inventory, room9_map,
                                  room9_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")
            if interaction == 'torch':
                if room_state['is_locked']:
                    if utils.has_a(player_inventory, 'Torch'):
                        print(
                            "You place the torch inside the sconce and the wall behind it shakes. A blinding light consumes you"
                            "and carries you into a new passage.")
                        player_inventory[
                            'Torch'] = player_inventory['Torch'] - 1
                        next_room = 12
                        done_with_room = True
                    else:
                        print("You do not possess a torch!.\n")
                else:
                    print("You are once again consumed by the light.")
        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 #11
0
def run_room(player_inventory, player_equipped, combat_off_inventory,
             combat_spell_inventory, mobs, player_health):
    description = '''
    The ground is damp from the drool of the wolf and the walls contain scratches. The red light still persists throughout the room.
    There are passages going east, south, and west.
    '''
    next_room = 5
    done_with_room = False

    if room_state['encounter']:
        print(
            "In the middle of the stands a snarling wolf with deep red eyes and brown fur. You get a chance to look around the room."
        )
        print(description)
        utils.combat(player_equipped, player_inventory, combat_off_inventory,
                     combat_spell_inventory, mobs, mob, player_health,
                     wolf_attack)
        room_state['encounter'] = False
        if player_health['pl_hp'] <= 0:
            next_room = 15
            done_with_room = True
    else:
        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
    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 == 'west':
                next_room = 8
                done_with_room = True
            elif direction == 'east':
                next_room = 6
                done_with_room = True
            elif direction == 'south':
                next_room = 3
                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, room5_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.drop_item(player_inventory, room5_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(room5_inventory, room5_map,
                                  room5_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