Example #1
0
def start_game():
    character.start_creator()
    player = Player(character.choosen_name)
    commands.clean_up()
    commands.my_stats(player)
    print(
        "From now on if you use command 'stats' you can check your stats. They will appear as shown above."
    )
    location = start_location.starting_path(player)
    if location == "city":
        print(f"{player.name} will go to the city.")
        if player.life > 0:
            city.enter_the_city(player)
            if player.quest == 666:
                print("")
                exit_the_program()
        else:
            commands.game_over(player)
    elif location == "river":
        print(f"{player.name} will go to the river.")
        if player.life > 0:
            river.river_arrival(player)
            if player.quest == 666:
                print("")
                exit_the_program()
Example #2
0
def vendor(player):
    weapons = [40, 70, 100]
    foods = [20, 60, 100]
    healing = [10, 30, 50]
    print(gascii.vendor_art())
    print("You can see vendor.")
    print(f"He sells weapons which improve your attack stat. Right now you have {player.weapon} attack.")
    print(f"He also seels food. It will instantly replenish your life. Right now you have {player.life}/100 hit points.")
    vendor_choice = input("What do you want to do? (weapon/food/leave)? ")
    if vendor_choice == "weapon":
        print("You can get swords adding +1, +2 and +3 attack stat. The price? 40, 70, 100")
        weapon_choice = int(input(f"{player.name} how much attack do you want to add? Input 1, 2, or 3. "))
        if 3 >= weapon_choice > 0:
            if weapons[weapon_choice - 1] > player.money:
                print("You have not enough money.")
                vendor(player)
            else:
                player.money -= weapons[weapon_choice - 1]
                player.weapon += weapon_choice
                print(player)
                vendor(player)
        else:
            print("You need  to input number in range 1-3")
            vendor(player)
    elif vendor_choice == "food":
        print(gascii.food_art())
        print(f"You can eat food regenerating 10, 30 or 50 hit points. You have currently {player.life} hit points.")
        print(f"The price? 20, 60, 100. You have {player.money} gold coins.")
        food_choice = int(input(f"{player.name} how much health points do you want to heal?  Input option number: 1, 2, or 3. "))
        if 3 >= food_choice > 0:
            if foods[food_choice - 1] > player.money:
                print("You have not enough money.")
                vendor(player)
            else:
                player.money -= foods[food_choice - 1]
                player.life += healing[food_choice - 1]
                print(player)
                vendor(player)
        else:
            print("You need  to input number in range 1-3")
            vendor(player)
    elif vendor_choice == "stats":
        commands.my_stats(player)
        vendor(player)
    elif vendor_choice == "leave":
        enter_the_tavern(player)
    else:
        commands.typo()
        vendor(player)
Example #3
0
def enter_the_tavern(player): # enter_tav():
    print(gascii.tavern_view())
    print("The tavern is small. Here you can buy weapons, eat food or play a dice.")
    answer = input(f"What do you want to do {player.name}? (buy/play/leave): ").lower()
    if answer == "buy":
        vendor(player)
    elif answer == "play":
        tavern_play(player)
    elif answer == "leave":
        city_direction(player)
    elif answer == "stats":
        commands.my_stats(player)
        enter_the_tavern(player)
    else:
        commands.typo()
        enter_the_tavern(player)
Example #4
0
def city_direction(player):
    print(gascii.city_view())
    decision = input("Do you want to go the tavern to get some resources or to the order? "
                     "\nYou can also go to the adventure. (tavern/order/adventure): ").lower()
    if decision == "tavern":
        enter_the_tavern(player)
    elif decision == "order":
        enter_the_order(player)
    elif decision == "adventure":
        to_adventure = moving.where_to_go()
        if to_adventure == "stay":
            city_direction(player)
        elif to_adventure == "river":
            river.river_arrival(player)
    elif decision == "stats":
        commands.my_stats(player)
        city_direction(player)
    else:
        commands.typo()
        city_direction(player)
Example #5
0
def tavern_play(player):
    print("\nShady looking guy sits at the table.")
    if player.money >= 10:
        choice = input("Do you want to play traveler? (yes/no): ").lower()
        if choice == 'y' or choice == 'yes':
            print("Let's play then!")
            print(gascii.dice_art())
            npc_roll = dice.roll_dice()
            player_roll = dice.roll_dice()
            if player_roll > npc_roll:
                print("Shady guy: Not bad. Lucky bastard.")
                print(gascii.moneyz())
                player.money += 10
                enter_the_tavern(player)
            elif player_roll < npc_roll:
                print("Too bad!")
                print(gascii.sad_smiley())
                player.money -= 10
                enter_the_tavern(player)
            else:
                print("Shady guy: Draw? What a pity. \n  ¯\_(ツ)_/¯")
                enter_the_tavern(player)
        elif choice == 'n' or choice == "no":
            print("Shady guy makes angry face and screams 'don't bother me then' and hits you in the face")
            print(gascii.sword_art())
            player.life -= 10
            print(f"{player.name} lost 10 hit points.")
            enter_the_tavern(player)
        elif choice == "stats":
            commands.my_stats(player)
            tavern_play(player)
        else:
            commands.typo()
            tavern_play(player)
    else:
        print(f"Shady guy: You need at least 10 gold coins to play with me and you have only {player.money}. Go away!")
        enter_the_tavern(player)
    enter_the_tavern(player)
Example #6
0
def starting_path(player):
    print(gascii.start_loc_view())
    print(
        "You wake up in the forest. It isn't dense. Small sign nearby shows three routes:\n"
        "'city', 'river' and 'mines'. However under is another sign with information that mines are closed."
    )
    choose = input(
        "Where ya go? Or maybe do you wanna look around? (city/river/look): "
    ).lower()
    if choose == 'city':
        return 'city'
    elif choose == 'river':
        return 'river'
    elif choose == 'stats':
        commands.my_stats(player)
        starting_path(player)
    elif choose == 'look':
        print(
            "You look around. Notice small hut. Inside you meet weird gobling wearing medical smock. He wants to play a game."
        )
        print("""
               ,      ,
              /(.-""-.)\ 
          |\  \/      \/  /|
          | \ / =.  .= \ / |
          \( \   o\/o   / )/ 
           \_, '-/  \-' ,_/
             /   \__/   \ 
             \ \__/\__/ / 
           ___\ \|--|/ /___
         /`    \      /    `\ 
        /       '----'       \ \n       
        """)
        print(
            "Goblin: Oh interesting creature stumbled by my study. Tell you what bud! Wanna get easy money?"
        )
        print(f"{player.name}: Free money! Yaaay!")
        print(
            "Goblin: Hold ya horses pal. If you wanna this money ya have to play dice with me. If ya win ya get 50 gold coins, if ya lose I'll take ya kidney. And after wards you will go to city."
        )
        goblin_choice = input(
            f"Goblin: So will you play with me {player.name}?\nThis time you can't use 'stats' to check what ya got. (yes/no) "
        )
        if goblin_choice == "yes" or goblin_choice == "y":
            goblin_roll = dice.roll_dice()
            player_roll = dice.roll_dice()
            if goblin_roll > player_roll:
                print(
                    f"Oh you loose {player.name}. I'm taking your kidney then!"
                )
                print("""
                 ______________________________ ______________________
                |                              | (_)     (_)    (_)   \ 
                |                              |  __________________   }
                |..........................____|_(                  )_/              
                """)
                player.life = 50
                return "city"
            elif goblin_roll < player_roll:
                print(
                    f"Damn you {player.name}. You win this time, here's your money!"
                )
                print(gascii.moneyz())
                player.money = 100
                return "city"
            else:
                print(
                    "Draw. What a shame. I'll take some of your hairs and have some money"
                )
                print(gascii.moneyz())
                player.money = 60
                player.life = 90
                return "city"
        else:
            print("I see you are a coward! Scared of little, weak goblin?")
            print(
                "That hits your morale, but you proceed to the city scared of green psycho"
            )
            player.life -= 10
            return "city"
    else:
        commands.typo()
        starting_path(player)
Example #7
0
def river_direction(player):
    decision = input(
        "You are near the river bank. You can go north or east. Or travel somewhere else. (north/east/travel) "
    ).lower()
    if decision == "north":
        print("You found cave entrance. You can't see too far inside.")
        if player.quest == 1:
            river_cave_01(player)
        elif player.quest == 0:
            print(
                "You hear roar coming from dark cave. You don't feel like going inside!"
            )
            river_direction(player)
        elif player.quest == 2:
            print(
                "You have already dealt with troll living in this cave. No need to go there again."
            )
            river_direction(player)
    elif decision == "east":
        print(
            "On the small green grassland. You see small birds called Scavengers running around."
        )
        print(gascii.scav_view())
        encounter_choice = input(
            f"{player.name} do you want to attack scavenger? Remember you have {player.life} hit points, "
            f"{player.weapon} attack points. (attack/back) ")
        if encounter_choice == "attack":
            print("You jump on the one of the scavengers.")
            opponent_life = 3
            while player.life > 0 and opponent_life > 0:
                if moving.encounter(player) == "Player win":
                    opponent_life -= player.weapon
                    print(
                        f"{player.name} hits Scavenger for {player.weapon} points! Scavenger has {opponent_life} hit points left."
                    )
                elif moving.encounter(player) == "Opponent win":
                    player.life -= 10
                    print(
                        f"{player.name} takes hit for 10 points. You have {player.life} hit points left."
                    )
                else:
                    print(moving.encounter(player))
            if player.life == 0:
                print(gascii.you_died())
            elif opponent_life <= 0:
                prize = dice.roll_dice() * 10
                player.money += prize
                print(
                    f"{player.name} has killed Scavenger and found {prize} gold coins. "
                    f"Now {player.name} has {player.money} gold coins and {player.life}/100 hit points left."
                )
                print(
                    f"{player.name} feeling strong walks back towards river bank."
                )
                river_direction(player)
        elif encounter_choice == "back":
            print("You quiletly move back.")
            river_direction(player)
        else:
            print("Please input text according to the bracketed words.")
            river_direction(player)
    elif decision == "stats":
        commands.my_stats(player)
        river_direction(player)
    elif decision == "travel":
        to_travel = moving.where_to_go_river()
        if to_travel == "city":
            city.city_direction(player)
        elif to_travel == "stay":
            river_direction(player)
    else:
        commands.typo()
        river_direction(player)