Ejemplo n.º 1
0
def restart():
    choices = ['y', 'yes', 'n', 'no']
    choice_options = ['Would you like to restart the game (yes / no): ']
    restart_choice = _player_choice(choices, choice_options)

    if restart_choice in ['y', 'yes']:
        if player1.difficulty == Difficulty(1):
            player1.health = 200
        elif player1.difficulty == Difficulty(2):
            player1.health = 100
        elif player1.difficulty == Difficulty(3):
            player1.health = 50
        else:
            print('Since a saved difficulty value could not be found...')
            player1.health = 100
        print_health(player1.difficulty, f'You will begin with {player1.health} health.\n')
        player1.balance = 0
        for k,v in player1.weapon_dict.items():
            v[2] = False
        sounds.set_volume(0.05)
        print_green('Default stats have been loaded/saved and a new game will begin...\n', 1)
        checkpoint_save()
        game_intro_description()
    elif restart_choice in ['n', 'no']:
        print_s('Ending game...', 1)
        exit()
Ejemplo n.º 2
0
def game_intro_description():
    sounds.intro_sound()
    print_s('''This is a zombie survival game where you must make the best decisions possible in order to live.
As a survivor, you will encounter zombies, weapons, people, and a merchant to buy from with an
in-game currency. Every decision you make has a cause and effect while some lead you to fortune and others will 
lead you to death.\n''', 2.5)
    game()
Ejemplo n.º 3
0
def view_stats():
    """
Prints the users current in game stats based upon a load file
    """
    game_data.load_game(player1)
    print_green('Your current in game stats will now be displayed below!\n', 1)
    print(f'Your health is {player1.health}\n')
    print_s(f'Your balance is ${player1.balance}\n', 2)
Ejemplo n.º 4
0
def _player_choice(choices, choice_options: list) -> str:
    user_input = ' '
    while user_input.lower() not in choices:
        user_input = str(input('\n'.join(choice_options)))
        print_s('', 1)
        if user_input.lower() not in choices:
            error_message(choices)
        else:
            return user_input.lower()
Ejemplo n.º 5
0
def merchant():
    """
    Handles the merchant who randomly shows up in-game. This function allows the player to purchase weapons.
    """

    if player1.health <= 0:  # Basic check to make sure the game is not continuing if the player has no more health left
        print_red('You currently have no health left...\n', 1)
        bad_ending()

    if randint(1, 7) != 3:  # random chance for player to interact with merchant
        return

    sounds.good_luck()
    print_green('Whoosh! The lucky merchant has appeared in-front of you...\n', 1)
    if player1.balance <= 0:
        print_yellow('Uh-Oh! You do not have enough money to buy anything... keep playing to acquire more money!\n', 1)
        return

    choices = ['b', 'buy', 'y', 'yes', 's', 'skip', 'n', 'no']
    choice_options = ['Would you like to buy from the merchant or skip past the merchant (buy / skip): ']
    choice = _player_choice(choices, choice_options)

    if choice in ['b', 'buy', 'y', 'yes']:
        buy_item = ''
        weapon_choices = [f"({k}) {v[0]} ({v[1]} Dollars)" for k,v in player1.weapon_dict.items() if k != '0']
        while buy_item != EXIT_MERCHANT_MENU:
            print_green(f'Balance: {player1.balance}\n', 1)
            choice_options = ['--- Merchants inventory ---']
            choice_options.extend(weapon_choices)
            choice_options.extend([f'({EXIT_MERCHANT_MENU}) Exit The Merchant Shop\n',
                                   'What would you like to buy: ',
                                  ])
            buy_item = _player_choice([str(x) for x in range(1, 8)], choice_options)
            
            if user_item_buy == EXIT_MERCHANT_MENU:
                print_s('The merchant bids you a farewell and good luck!\n', 1)
                break
            elif player1.weapon_dict[buy_item][2]:
                sounds.bad_luck()
                print_yellow(f'{player1.weapon_dict[buy_item][0]} has already been purchased!\n', 1)
            elif player1.balance >= player1.weapon_dict[buy_item][1]:
                sounds.merchant_purchase_sound()
                player1.balance -= player1.weapon_dict[buy_item][1]
                player1.weapon_dict[buy_item][2] = True
                print_green(f'{player1.weapon_dict[buy_item][1]} has been purchased!\n', 1)
                if buy_item == '6':
                    print_green(
                    'As the Merchant hands you his own crafted spell, he tells you that you now wield true pain to foes whilst providing restoration to thine self.\n',
                    2.5)
    elif choice in ['s', 'skip', 'n', 'no']:
        print_s('The merchant has been skipped but can be brought back later...\n', 1)
Ejemplo n.º 6
0
def outside_area():
    checkpoint_save('1')
    print_s('You make your way to the outside area...\n', 1)
    sounds.wind_sound()
    print('You instantly notice something is not right... a dark gloomy fog covers all of the town and you do not see\n'
          'a single friendly soul insight... You start to come to a conclusion about where everybody in the small\n'
          'town of Hinesville has went but nothing is making sense...\n')
    sleep(3.5)
    choice_options = ['You have the choice to either (1) Explore the Outside Area (2) Visit the local Gas Station: ']
    user_choice = _player_choice([str(x) for x in range(1, 3)], choice_options)

    if user_choice == '1':
        print('You decide to explore the outside area and along the way, you see a woman bleeding out on the ground\n'
              'with the shape of a man figure hovering over her...\n')
        sleep(2)
        sounds.zombie_attack_outside()
        print_s('Lone behold... the figure is eating the woman alive but you are too late to rescue her!\n', 1.5)
        choice_options = ['(1) Attack the zombie (2) Avoid the zombie and run to the local Gas Station: ']
        user_choice = _player_choice([str(x) for x in range(1, 3)], choice_options)

        if user_choice == '1':
            sounds.zombie_attack_outside()
            user_attack()
            print_s(
                f'You then search the body of the zombie and decaying woman to find a total of {player1.get_money()} Dollars...\n',
                2)
            print_s('Finally, you get to make your way over to the local Gas Station...\n', 1.5)
            gas_station()
        elif user_choice == '2':
            gas_station()
    elif user_choice == '2':
        gas_station()
Ejemplo n.º 7
0
def diner_area():
    sounds.horror_sound_effects()
    print_s('You have entered the local Diner...\n', 1)
    checkpoint_save('2')
    choice_options = [
        'You have the choice to either (1) Search inside the Diner Restaurant Area (2) head towards the Parkview Area: ']
    user_choice = _player_choice([str(x) for x in range(1, 3)], choice_options)

    if user_choice == '1':
        sounds.good_luck()
        print(
            f'After finishing up your entire search of the diner, you find a total of {player1.get_money()} dollars and ',
            f'you refresh up on some food and gain a total of {player1.get_health(5, 15)} health!\n')
        sleep(3)
        print('You also manage to find a bloody photograph on the ground and upon looking at the image, you see a '
              'familiar face...')
        print('You see the face of the man you met earlier at the local Gas Station taking a group '
              'familiar face... \nYou see the face of the man you met earlier at the local Gas Station taking a group '
              'family picture!\n')
        sleep(3)
        sounds.horror_sound_effects()
        print('Since you are finished exploring and searching the diner area, you proceed on your path to the '
              'parkview area...\n')
        sleep(3.5)
        parkview_area()
    elif user_choice == '2':
        sounds.zombie_attack_outside()
        print_red(
            'Upon leaving the diner area, you come across a group of about 5 zombies heading directly towards you!\n',
            1.5)
        user_attack()

        if player1.health > 0:
            print_green(
                'You have successfully defended off the zombies outside the local Diner... You will now head over to the Parkview Area\n',
                2)
            parkview_area()

        else:
            bad_ending()
Ejemplo n.º 8
0
def basement_area():
    print_s('You have reached the basement area.\n', 1)
    sounds.horror_sound_effects()
    print_s('''After living at your home for awhile now, you've had many supplies and broken utilities stored up in your basement.
Trailing behind you leads a lurking stench of odor containing of what smells like mold and rotten flesh.\n''', 1.5)
    choice_options = ['(1) Search around the basement (2) Forget about the basement and leave: ']
    choice = _player_choice([str(x) for x in range(1, 3)], choice_options)

    if choice == '1':
        print_s(
            'Amongst searching the basement, you stumble upon some spare money you forgot you had saved up in the basement.\n',
            1.5)
        sounds.good_luck()
        print_green(f'You found a total of ${player1.get_money()} dollars!\n', 1)
    elif choice == '2':
        sounds.wind_sound()
        print_s('''Upon leaving the basement, you head out into the outside area for a breath of fresh air after consuming 
the moldy and old smells of the basement.\n''', 2)
    outside_area()
Ejemplo n.º 9
0
def parkview_area():
    sounds.horror_sound_effects()
    print_s('You have entered the parkview area...\n', 1)
    checkpoint_save('4')
    sounds.parkview_entrance()
    sleep(2.5)
    print_s('Upon arriving to the parkview area, you are still incapable of seeing very much ahead of yourself...\n',
            1.5)
    choice_options = ['You have the choice to either (1) Explore the Parkview Area (2) Explore onto the Broken Roads: ']
    user_choice = _player_choice([str(x) for x in range(1, 3)], choice_options)

    if user_choice == '1':
        print('Upon searching the Parkview Area... You come across a deranged man who is killing zombies left and '
              'right...\n')
        sleep(2)
        choice_options = ['You have the choice to either (1) Help the man (2) Kill the man: ']
        user_choice = _player_choice([str(x) for x in range(1, 3)], choice_options)

        if user_choice == '1':
            sounds.horror_sound_effects()
            print('In attempts of helping the man, he screams get the hell away from me, I will blow your head off! '
                  'You now prepare to fight him off!\n')
            sleep(2.5)
        elif user_choice == '2':
            sounds.bad_luck()
        # attack ensues - same for both options - only difference is the lead up to it
        user_attack()
        if player1.health > 0:
            print_green(
                f'You have successfully killed the man! Upon searching his body, you find a total of ${player1.get_money()}!\n',
                1)
            checkpoint_save('5')
            sounds.horror_sound_effects()
            print_s('You now decide to leave the Parkview Area...\n', 1.5)
            broken_roads_area()
        else:
            sounds.bad_luck()
            print_red('The man has killed you and zombies start to feast on your dead decaying flesh...\n', 2)
            bad_ending()
    elif user_choice == '2':
        broken_roads_area()
Ejemplo n.º 10
0
def audio_options():
    choice_options = ['What would you like to set your volume level to (0 - 100): ']
    volume_level = int(_player_choice([str(x) for x in range(101)], choice_options)) / 100
    sounds.set_volume(volume_level)
    print_s(f'Your current volume level is set at {sounds.volume_level}\n', 1)
Ejemplo n.º 11
0
def gas_station():
    sounds.horror_sound_effects()
    print_s('You have entered the local Gas Station...\n', 1)

    checkpoint_save('3')

    print('From the front counter, you see a man who points his gun at you while you walk in! The man tells you to\n'
          'freeze but then notices that you are a survivor just like him... You both discuss and try to figure out\n'
          'what the hell is going on in this city and the man tells you that there has been a bacteria that can \n'
          'contaminated all meat supply chains across the world...\n')
    sleep(6)

    choice_options = [
        'You have the choice to either (1) Keep talking to the man (2) Ask the man for any supplies along your journey: ']
    user_choice = _player_choice([str(x) for x in range(1, 3)], choice_options)

    if user_choice == '1':
        print('As you keep talking to the man, he starts to tell you about his family and how they would always\n'
              'venture out to the park with his young daughter and son...\n')
        sleep(2)
        sounds.zombie_attack_inside()
        print_s(
            'Out of nowhere, a group of 3 zombies begin to bang on the glass door from which you entered in from...\n',
            2.5)
        sounds.zombie_attack_inside()
        print('While attempting to save you, the man fights off 2 zombies with his pump shotgun and get eaten alive '
              'while saying, RUN! but more zombies come to arise on you...\n')
        sleep(2.5)
        print_s('You decide to fight off the zombies in the will of your hopes for living...\n', 1.5)
        user_attack()

        if player1.health > 0:
            print_green('You have successfully defended off the zombies inside the gas station but it was most '
                        'unfortunate the man you found could not make it...\n', 2)
            choice_options = [
                'You have the choice to either (1) Search the all the bodies of zombies and the dead man (2) Head over to the local Diner: ']
            user_choice = _player_choice([str(x) for x in range(1, 3)], choice_options)

            if user_choice == '1':
                print_s(
                    f'After search everybody in the gas station, you manage to find a total of {player1.get_money()} dollars and you then continue your way over to the local Diner...\n',
                    2)
            diner_area()
        else:
            bad_ending()

    elif user_choice == '2':
        sounds.good_luck()
        print(
            f'The man hands over some cash ({player1.get_money()} dollars) and tells you about a mysterious lurking salesman who would wonder around the town quite '
            'often... ')
        print('The man says that he has not seen him since the apocalypse has happened but keep the money on '
              'you in-case he shows...\n')
        sleep(2.5)
        sounds.wind_sound()
        print('You give thanks to the man and exit the local Gas Station and make your way down a tumbled and broken '
              'road... ')
        print('The gleaming fog and ashe outside is giving way to your vision and you see more and more '
              'unclear... Deep down inside... you know you must go on further...\n')
        sleep(3.5)
        diner_area()
Ejemplo n.º 12
0
def continue_message():
    """
This is purely only used for development and has no impact on the game
    """
    print_s('Continue here...', 3)
    exit()