Esempio n. 1
0
def run_room(player_inventory, player_health):
    description = '''
   This room appears to be the visitors room. . . 
    There are phones on either side of glass panes, one of the panes is broken. . .
    There is a door to the NORTH and also to the EAST. . . 
    You see a GLASS SHARD that would make a decent weapon. . . '''
    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)
        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 == 'east':
                print('. . . ')
                time.sleep(.75)
                next_room = 8
                done_with_room = True
            elif direction == 'north':
                print('. . . ')
                time.sleep(.75)
                next_room = 11
                done_with_room = True
            else:
                print('You cannot go that way')
                # 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].title()
            utils.take_item(player_inventory, room10_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1]
            utils.scrub_response(drop_what)
            if drop_what in player_inventory.keys():
                del player_inventory[drop_what]
                print("You no longer possess,", drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory, player_health)
            utils.room_status(room10_inventory)
        else:
            print('unkown command:', the_command)

    # end of while loop
    return next_room
Esempio n. 2
0
def run_room(player_inventory, player_health):
    description = '''
    . . . Main Room . . .
    You open your eyes. The padded room you see is unfamiliar. Red light coming from flashes on and off, you hear alarms blaring and shouting in the distance.
    You see the heavy metal door in your room has been opened to the outside. You see a brightly lit doorway to the SOUTH. 

    '''
    print(Fore.BLUE + Style.BRIGHT + description + Style.RESET_ALL)

    # valid commands for this room
    commands = [
        "go", "take", "drop", "use", "examine", "status", "help", "die"
    ]
    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 == 'south':
                print('. . . ')
                time.sleep(.75)
                next_room = 2
                done_with_room = True

            else:
                print('You cannot go that way')
                # 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]
            utils.scrub_response(drop_what)
            if drop_what in player_inventory.keys():
                del player_inventory[drop_what]
                print("You no longer possess,", drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory, player_health)
            utils.room_status(room1_inventory)
        else:
            print('unkown command:', the_command)

    # end of while loop
    return next_room
Esempio n. 3
0
def run_room(player_inventory, player_health):
    # Let the user know what the room looks like

    if room3_inventory['Crowbar'] == 0:
        room3_description = '''
    . . .  3rd room ... 
    You are in a storage room that feels very familiar. There is nothing else of interest in this room.'''
        print(room3_description)
    else:
        room3_description = '''
        . . .  3rd room ... 
        You are in a storage room that feels very familiar. There is a CROWBAR laying on the ground near the door. . . 
        There is nothing else of interest in this room'''
        print(room3_description)
    # valid commands for this room
    commands = ["go", "take", "drop", "use", "status", "help"]
    no_args = ["examine", "status", "help"]

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

    done_with_room = False
    while not done_with_room:
        # Examine the response and decide what to do
        response = utils.ask_command("What do you want to do?", commands, no_args)
        response = utils.scrub_response(response)
        the_command = response[0]
        # now deal with the command
        if the_command == 'go':
            direction = response[1].lower()
            if direction == 'west':
                next_room = 2
                done_with_room = True

            else:
                print('. . . ')
        elif the_command == 'take':
            take_what = response[1].title()
            utils.take_item( player_inventory, room3_inventory,
                             take_what)
        elif the_command == 'drop':
            drop_what = response[1].title()
            utils.drop_item( player_inventory, room3_inventory,
                         drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory,player_health)
            utils.room_status(room3_inventory)
        else:
            print('The command', the_command, 'is invalid in ROOM3')

    return next_room
Esempio n. 4
0
def run_room(player_inventory, player_health):
    description = '''
    . . . 
    In the gloom, you can just make out the outline of rows of lockers lining the room, and one row in the middle. 
    Light reflects off a shiny handle of a FLASHLIGHT and some BATTERIES next to it.
    Behind the row of lockers, there is an open door leading to complete darkness'''

    print(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 = 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)
        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':
                if r5.is_open == False:
                    print('That room is locked now, you cant get in. . . ')
                else:
                    next_room = 5
                    done_with_room = True
            elif direction == 'east':
                next_room = 2
                done_with_room = True
            else:
                # In this room, there is nowhere else to go.
                print('. . . ')
        elif the_command == 'take':
            take_what = response[1].title()
            utils.take_item( player_inventory, room4_inventory,
                             take_what)
        elif the_command == 'drop':
            drop_what = response[1].lower()
            utils.drop_item( player_inventory, room4_inventory,
                         drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory, player_health)
            utils.room_status(room4_inventory)
        else:
            print("Command not implemented in ROOM 2,", the_command)

    # end of main while loop
    return next_room
Esempio n. 5
0
def run_room(player_inventory, player_health):
    blind = True
    can_use_shower = False
    description = '''It's pitch black in here, you can't even tell what type of room this is.
    Using a FLASHLIGHT would be pretty useful right about now . . . 
    If you don't have a flashlight, you could always EXAMINE the room . . .'''

    print(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 == 'east':
                next_room = 4
                done_with_room = True
                is_open = False
            else:
                # In this room, there is nowhere else to go.
                print('. . . ')
        elif the_command == 'use':
            use_what = response[1].title()
            if use_what == "Flashlight":
                if 'Flashlight' in player_inventory:
                    blind = False
                    can_use_shower = True
                    print(
                        '''You use your FLASHLIGHT. Upon shining it around the room, you quickly discern this room is a bathroom.
                    There are stalls and urinals on one side . . .
                     You shine your light to the other side of the room . . .
                     . . . The other side has a few showers. Using the SHOWER to get some water doesn't seem like such a bad idea . . .'''
                    )
                else:
                    print('You cannot use that here')
            if use_what == 'Shower' and can_use_shower:
                player_health = player_health + 20
                print(
                    'The water quenches your thirst and gives you extra strength. You now have',
                    player_health,
                    'health. However, now the shower is out of water.')
                can_use_shower = False
            else:
                print('You cant use that here. . . ')
        elif the_command == 'take':
            take_what = response[1].title()
            utils.take_item(player_inventory, room5_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1].title()
            utils.drop_item(player_inventory, room5_inventory, drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory, player_health)
            utils.room_status(room5_inventory)
        elif the_command == 'examine':
            injury_chance = random.randint(0, 4)
            if injury_chance == 1 or 2:
                print(
                    '''You slam your head into a nearby wall. You storm out of the room, slamming the door shut as you go.
                You quickly realize the door locked behind you.''')
                player_health = player_health - 5
                next_room = 4
                done_with_room = True
                is_open = False
            else:
                print(
                    '''You use your hands to guide you along the edge of the bathroom. You reach a corner and you feel a handle.
                Upon turning it you realize it is a SHOWER. You can now use the SHOWER.'''
                )
                can_use_shower = True
    else:
        print('You cannot do that in this room')

    # end of main while loop
    return next_room
Esempio n. 6
0
def run_room(player_inventory, player_health):
    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

    description = '''. . . 
Moonlight penetrates the large glass panes on the ceiling to reveal the room is much larger than you anticipated. . . 
It seems to be a large dining hall. . . 
It seems there was a conflict here not long ago, there is flecks of blood on the floor, and most of the tables have been overturned. . . 
There are doors each leading NORTH, SOUTH, and EAST, and you notice a lock holding the EASTERN door shut. . . 
The only thing that you see that could be actually useful to you is a BUTTER KNIFE laying close by. . .'''
    print(description)

    if 'Flashlight' in player_inventory:
        print(
            'As always, you could always use your FLASHLIGHT to maybe reveal things that would otherwise be hidden. . . '
        )

    if 'Crowbar' or 'Bump Key' in player_inventory:
        print('You have some tools that could deal with that lock. . .')

    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 room_state['in_combat'] == True:
            if room_state['enemy_health'] == 30:
                room_state['surprise'] = False
                print(
                    'A strained scream pierces through the darkness as a shape rushes towards you knocking you backwards. . . '
                    'It slashes a cut in your arm dealing 10 damage'
                    'You realize as you get up that it is a mental patient just like you, only this one has lost its mind. . .'
                    'You are going to have to take care of it before you do anything else. . . .'
                )

                player_health = player_health - 10

            if the_command == 'use':
                use_what = response[1].title()
                if use_what in player_inventory:
                    if player_inventory[use_what] > 0:
                        if use_what == 'Flashlight':
                            print(
                                'You blind the patient with your flashlight and hit him with the end of the flashlight dealing 15 damage'
                            )
                            room_state['enemy_health'] = room_state[
                                'enemy_health'] - 15
                        elif use_what == 'Butter Knife':
                            print(
                                'You actually manage to draw blood with the dull knife by hacking furiously, dealing 5 damage'
                            )
                            room_state['enemy_health'] = room_state[
                                'enemy_health'] - 5
                        elif use_what == "Sub Machine Gun":
                            print(
                                'You shoot him in the chest and he stumbles backward  dealing 30 damage'
                            )
                            room_state['enemy_health'] = room_state[
                                'enemy_health'] - 30
                        elif use_what == 'Glass Shard':
                            print(
                                'The glass shard rips trough his gown and opens a gash along his arm dealing 10 damage'
                            )
                            room_state['enemy_health'] = room_state[
                                'enemy_health'] - 10
            elif the_command == 'status':
                utils.player_status(player_inventory, player_health)
                utils.room_status(room6_inventory)
            else:
                print('While in combat you cannot use that command')

            if room_state['enemy_health'] <= 0:
                print('The crazed patient falls to the ground dead')
                room_state['in_combat'] = False
                room_state['surprise'] = False

        if room_state['in_combat'] == False:
            room_state['surprise'] = False
            if the_command == 'go':
                direction = response[1]
                if direction == 'north':
                    next_room = 2
                    done_with_room = True
                elif direction == 'east':

                    if room_state['door_locked'] == False:
                        next_room = 7
                        done_with_room = True
                    else:
                        print('The door is locked . . .')
                elif direction == 'south':
                    next_room = 8
                    done_with_room = True
                else:
                    print('You cannot go', direction, 'in this room. . . ')

            elif the_command == 'take':
                take_what = response[1].title()
                if take_what in room6_inventory:
                    utils.take_item(player_inventory, room6_inventory,
                                    take_what)
                    if take_what == 'Sub Machine Gun' or 'Butter Knife':
                        room_state['surprise'] = True
                        room_state['in_combat'] = True
                else:
                    print('There is nothing like that in this room')
            elif the_command == 'drop':
                drop_what = response[1].title()
                utils.drop_item(player_inventory, room6_inventory, drop_what)
            elif the_command == 'status':
                utils.player_status(player_inventory, player_health)
                print('In this room you can see. . .' 'a Butter Knife ')

            elif the_command == 'use' and room_state['in_combat'] == False:
                use_what = response[1].title()
                if use_what in player_inventory:
                    if player_inventory[use_what] > 0:
                        if use_what == 'Flashlight':
                            print('. . .')
                            time.sleep(1.0)
                            print(
                                '''. . . You flip the switch on the flashlight and shine it around the room. . . 
                    In the farthest SOUTHERN corner, you see some thing reflect the flashlight beam back to you. . . 
                    After making your way towards the source, you realize it's a SUB MACHINE GUN and there is a GUARD I.D. next to it'''
                            )

                        elif use_what == 'Crowbar' or use_what == 'Bump Key':
                            if room_state['continue_trying'] == True:
                                open_chance = random.randint(0, 4)

                                if open_chance == 1:

                                    if use_what == 'Crowbar':

                                        print(
                                            'The crowbar snaps in half. . . ')
                                        room_state['door_locked'] = True
                                        room_state['continue_trying'] = False
                                        del player_inventory['Crowbar']

                                    elif use_what == 'Bump Key':
                                        print(
                                            'It seems like you cant get any of the keys to work and the door stays locked. One of the keys is now pretty bent. . . '
                                            'You stop trying out of fear of breaking your tools. . . It does look like your BUMP KEYS are still usable though. . . .'
                                        )
                                        room_state['door_locked'] = True
                                        room_state['continue_trying'] = False

                                elif open_chance == 2 or 3 or 4 or 5:
                                    room_state['door_locked'] = False
                                    print(
                                        '. . . It worked! The door is now unlocked. . .'
                                    )

                            else:
                                print(
                                    'It isnt worth broken tools. . . you move on . . . '
                                )
                else:
                    print('''You don't have a''', use_what)

    return next_room
Esempio n. 7
0
def run_room(player_inventory, player_health):
    description = '''
   As you step inside, you realize the door used to be locked, but is now open with one hinge loose
   .... It looks like an armory. . . but there is nothing in it. . . . You can make out a door to the WEST
    . . . You have a feeling there is something more to the EAST than meets the eye. . . 
    '''
    print(Fore.BLUE + Style.BRIGHT + description + Style.RESET_ALL)
    if 'Flashlight' in player_inventory:
        print(
            'As always, you could always use your FLASHLIGHT to maybe reveal things that would otherwise be hidden. . . '
        )

    # 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':
                print('. . . ')
                time.sleep(.75)
                next_room = 6
                done_with_room = True
            elif direction == 'east':
                if player_inventory['Flashlight'] > 0:
                    print(' . . . ')
                    time.sleep(.75)
                    next_room = 9
                    done_with_room = True
                else:
                    print(
                        'You stumble around the room and roll your ankle and you lose 5 health. . .'
                        'On the west end you feel the outline of a door and you head inside'
                    )
            elif direction == 'west':
                done_with_room = True
                next_room = 10
            else:
                print('You cannot go that way')
                # 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]
            utils.scrub_response(drop_what)
            if drop_what in player_inventory.keys():
                del player_inventory[drop_what]
                print("You no longer possess,", drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory, player_health)
            utils.room_status(room8_inventory)
        elif the_command == 'use':
            use_what = response[1].title()
            if use_what in player_inventory:
                if player_inventory[use_what] > 0:
                    if use_what == 'Flashlight':
                        print(
                            '. . . '
                            'You switch the flashlight on and shine it around the room and realize there is a door to the EAST that says WARDEN on it. . . '
                            'You have a feeling what you need is in there. . . '
                        )
        else:
            print('unkown command:', the_command)

    # end of while loop
    return next_room
Esempio n. 8
0
def run_room(player_inventory, player_health):
    description = '''
 This must be teh room where they pat down the visitors before going into the visitors room. . .
 There is a door to the SOUTH and the WEST. . .
    '''
    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)
        response = utils.scrub_response(response)
        the_command = response[0]
        if room_state['in_combat'] == True:
            if room_state['surprise'] == True:
                print(
                    'A security guard pistol whips you in the head dealing 15 damage. . . '
                    'He moves to block the door where you came. . . '
                    'You are going to have to take care of him before you can do anything else. . . '
                )
                room_state['surprise'] = False

            if the_command == 'use':
                use_what = response[1].title()
                if use_what in player_inventory:
                    if player_inventory[use_what] > 0:
                        if use_what == 'Flashlight':
                            print(
                                'You blind the guard with your flashlight and hit him with the end of the flashlight dealing 15 damage'
                            )
                            room_state['enemy_health'] = room_state[
                                'enemy_health'] - 15
                        elif use_what == 'Butter Knife':
                            print(
                                'You actually manage to draw blood with the dull knife by hacking furiously dealing 5 damage'
                            )
                            room_state['enemy_health'] = room_state[
                                'enemy_health'] - 5
                        elif use_what == "Sub Machine Gun":
                            print(
                                'You shoot him in the chest and he stumbles backward  dealing 30 damage'
                            )
                            room_state['enemy_health'] = room_state[
                                'enemy_health'] - 30
                        elif use_what == 'Glass Shard':
                            print(
                                'The glass shard rips trough his uniform and opens a gash along his arm dealing 10 damage'
                            )
                            room_state['enemy_health'] = room_state[
                                'enemy_health'] - 10
            elif the_command == 'status':
                utils.player_status(player_inventory, player_health)
                utils.room_status(room11_inventory)

            else:
                print('While in combat you cannot use that command')
            if room_state['enemy_health'] < 0:
                print('The guard falls to the ground dead')
                room_state['in_combat'] = False
        else:
            if the_command == 'go':
                direction = response[1]
                # Use your hand drawn map to help you think about what is valid
                if direction == 'west':
                    print('. . . ')
                    time.sleep(.75)
                    next_room = 12
                    done_with_room = True

                else:
                    print('You cannot go that way')
                    # 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]
                utils.scrub_response(drop_what)
                if drop_what in player_inventory.keys():
                    del player_inventory[drop_what]
                    print("You no longer possess,", drop_what)
            elif the_command == 'status':
                utils.player_status(player_inventory, player_health)
                utils.room_status(room11_inventory)
            else:
                print('unkown command:', the_command)

    # end of while loop
    return next_room
Esempio n. 9
0
def run_room(player_inventory, player_health):
    description = '''
    You made it. . . This is the receptionist area to this damned place. . . 
    Straight ahead you see rain pounding on the glass doors leading outside. . . 
    The room is lit up in a flash of lightning before it goes dark again
    You try the door but it is locked. . . You realize you need the WARDEN KEY to open the door. 

    '''
    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)
        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':
                print('. . . ')
                time.sleep(.75)
                next_room = 11
                done_with_room = True

            else:
                print('You cannot go that way')
                # 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]
            utils.scrub_response(drop_what)
            if drop_what in player_inventory.keys():
                del player_inventory[drop_what]
                print("You no longer possess,", drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory, player_health)
            utils.room_status(room12_inventory)
        elif the_command == 'use':
            use_what = response[1].title()
            if use_what == 'Warden Key':
                print(' . . . ')
                print(
                    'The key opens the door to the outside. . . you are free. . . '
                )
                next_room = -5
                done_with_room = True
        else:
            print('unkown command:', the_command)

    # end of while loop
    return next_room
Esempio n. 10
0
def run_room(player_inventory, player_health):
    description = '''
    . . . 
    You are in a brightly lit hallway with rooms identical to yours lining the walls and alarms blaring overhead. 
    Just as you walk in, all the doors begin to close automatically.
    All of a sudden, the lights cut out, as well as the alarms. 
    A few moments later, the lights come back on, but much dimmer, the alarms come back to life, more deafening than ever. At the end of the hall on the SOUTH side, one door is still open.
    To the WEST there is an open door 
    You see a GREEN BACKPACK in the far left corner and a BUMP KEY next to it.
    . . . 
    '''

    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)
        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 = 6
                done_with_room = True
            elif direction == 'east':
                next_room = 3
                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('. . . ')
        elif the_command == 'take':
            take_what = response[1].title()
            utils.take_item(player_inventory, room2_inventory, take_what)
        elif the_command == 'drop':
            drop_what = response[1].title()
            utils.drop_item(player_inventory, room2_inventory, drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory, player_health)
            utils.room_status(room2_inventory)
    else:
        print('You cannot', the_command, 'in this room')

    # end of main while loop
    return next_room
Esempio n. 11
0
def run_room(player_inventory, player_health):
    description = '''
    You step inside the Warden's office filled with apprehension and fear. . .
    You only get a brief glimpse of the moonlit room before something shoves you towards the center of the room. . . 
    . . . You hear the door slam and hear a voice . . . 
    "So you think you're gonna escape this asylum?! Well lemme tell you right, I'm going to kill you just like the others!"
    The source of the voice reveals itself as the WARDEN as he steps into the moonlight eminating from the window behind the desk. . . 
    He is fat and bald but is fully covered head to toe in riot armor. . .
    . . . He pulls out a .44 revolver. . . 
    This is going to be a hard fight. . . '''
    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)
        response = utils.scrub_response(response)
        the_command = response[0]
        warden_health = 100
        if room_state['enemy_health'] <= 0:
            print('The warden is dead. . . You grab his WARDEN KEY and his FLASHLIGHT and get out of that room. . . ')
            take_what = 'Warden Key'
            utils.take_item(player_inventory, room9_inventory,
                                take_what)
            time.sleep(1.5)
            done_with_room = True
            next_room = 8



        if the_command == 'go':
            direction = response[1]
            print('The WARDEN has locked the door and there is no getting around him')
                # In this room, there is nowhere else to go.
        elif the_command == 'take':
            print("There is nothing to take here.")
        elif the_command == 'drop':
            drop_what = response[1]
            utils.scrub_response(drop_what)
            if drop_what in player_inventory.keys():
                del player_inventory[drop_what]
                print("You no longer possess,", drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory, player_health)
            utils.room_status(room9_inventory)
        elif the_command == 'use':
            use_what = response[1].title()
            warden_attack = random.randint(0, 4)
            if warden_attack == 1:
                print('The warden swings his baton but misses dealing no damage. . .')
            elif warden_attack == 2:
                print('The warden swings his baton and knocks you in the side of the head, dealing 20 damage')
                player_health = player_health - 15
            elif warden_attack == 3:
                print('The warden fires a shot from his revolver, hitting you in the arm dealing 15 damage')
                player_health = player_health - 15
            elif warden_attack == 4:
                print('He bodyslams you into the wall, but it does not hurt too bad. . . It deals 10 damage')
                player_health = player_health - 10
            else:
                print('...')
            if use_what in player_inventory:
                if player_inventory[use_what] > 0:
                    if use_what == 'Butter Knife:':
                        print("You swing the butter knife at the warden. . . It bounces off his armor, and he laughs as it falls to the floor")
                        del player_inventory['Butter Knife']
                    elif use_what == 'Flashlight':
                        print('You blind the warden with the beam of the flashlight and then hit him in the head twice dealing 25 damage before he pushes you into a wall, hurting your back')
                        player_health = player_health - 10
                        room_state['enemy_health'] = room_state['enemy_health'] - 25
                    elif use_what == 'Sub Machine Gun':
                        print('You manage to fire off quite a few shots into his armor dealing 30 damage before he knocks the gun away')
                        room_state['enemy_health'] = room_state['enemy_health'] - 30
                    elif use_what == 'Crowbar':
                        print('The Crowbar digs deep into his left arm as you bring it down, dealing 15 damage')
                        room_state['enemy_health'] = room_state['enemy_health'] - 15
                    elif use_what == 'Mop':
                        print('You swing the wet mop and it strikes the side of his neck between his helmet and his armor dealing 15 damage')
                        room_state['enemy_health'] = room_state['enemy_health'] - 15
                    else:
                        print('you cant use that')

        else:
            print('unkown command:', the_command)

    # end of while loop
    return next_room
Esempio n. 12
0
def run_room(player_inventory, player_health):
    description = '''
   . . . The room is less like a room and more like a utility closet. . . 
   There is a MOP and a JANITOR I.D. on a hook. . . 
   It looks like there is nothing else of intrest . . . But there is no harm is using your FLASHLIGHT if you have one, right?
   

    '''
    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)
        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 == 'west':
                print('. . . ')
                time.sleep(.75)
                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':
            take_what = response[1].title()
            if take_what in room7_inventory:
                utils.take_item(player_inventory, room7_inventory, take_what)
            else:
                print('There is nothing like that in this room')
        elif the_command == 'use':
            use_what = response[1].title()
            if use_what in player_inventory:
                if player_inventory[use_what] > 0:

                    if use_what == 'Flashlight':
                        print('. . .')
                        time.sleep(1.0)
                        print(
                            '''The flashlight lights up the room for a few moments, then begins to get very hot. . . 
                    You drop it. . . The FLASHLIGHT singes your hand. . . 
                    Upon impact it explodes. . . 
                    There are pieces of shrapnel in your legs . . . ''')
                        player_health = player_health - 25
                        del player_inventory['Flashlight']
                    else:
                        print('That cant be used here')
                else:
                    print('You dont have that . . . ')
            else:
                print('You dont got that')
        elif the_command == 'drop':
            drop_what = response[1]
            utils.scrub_response(drop_what)
            if drop_what in player_inventory.keys():
                del player_inventory[drop_what]
                print("You no longer possess,", drop_what)
        elif the_command == 'status':
            utils.player_status(player_inventory, player_health)
            utils.room_status(room7_inventory)
        else:
            print('unkown command:', the_command)

    # end of while loop
    return next_room