コード例 #1
0
def exit_the_program():
    print(gascii.exit())
    decide = input("Yes or no? ").lower()
    if decide == "yes" or decide == "y":
        print('*' * 5, '\nThanks for playing, come again soon!')
    elif decide == "no" or decide == "n":
        print("Oh I'm glad you are staying after all!")
        main()
    else:
        commands.typo()
        exit_the_program()
コード例 #2
0
def select_character(select):
    if select == '1':
        gender = "1"
        select = race_choice()
        name_choice(gender, select)
    elif select == '2':
        gender = "0"
        select = race_choice()
        name_choice(gender, select)
    else:
        commands.typo()
        character_creator()
コード例 #3
0
def main():
    print(main_menu())
    go_to = input('Insert menu number positon (1-3): ')
    if go_to == '1':
        start_game()
    elif go_to == '2':
        print("This feature will be added in paid DLC.")
        main()
    elif go_to == '3':
        exit_the_program()
    else:
        commands.typo()
        main()
コード例 #4
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)
コード例 #5
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)
コード例 #6
0
def race_choice():
    print("What is your race please select from option")
    print(" 1 - If you are an Orc")
    print(" 2 - If you are an Human")
    print(" 3 - If you are an Elf")
    select = input('')
    if select == "1":
        race = "Orc"
        return race
    elif select == "2":
        race = "Human"
        return race
    elif select == "3":
        race = "Elf"
        return race
    else:
        commands.typo()
        race_choice()
コード例 #7
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)
コード例 #8
0
def name_choice(user_choice_gender, race):
    usa_choi = input(
        "Do you want to auto generate name (lazy option!)? (y/n): ").lower()
    global choosen_name
    if usa_choi == "y" or usa_choi == "yes":
        if user_choice_gender == "1":
            if race == "Human":
                choosen_name = random.choice(name_pool[3])
                return choosen_name
            elif race == "Orc":
                choosen_name = random.choice(name_pool[4])
                return choosen_name
            else:
                choosen_name = random.choice(name_pool[5])
                return choosen_name
        if user_choice_gender == "0":
            if race == "Human":
                choosen_name = random.choice(name_pool[0])
                return choosen_name
            elif race == "Orc":
                choosen_name = random.choice(name_pool[1])
                return choosen_name
            else:
                choosen_name = random.choice(name_pool[2])
                return choosen_name
    elif usa_choi == "n" or usa_choi == "no":
        choosen_name = input(
            "So please enter your name. Be aware that we do not care if you:"
            "\n - write some nonsense like '5w33t ki113r'"
            "\n - about you willing to change your mind after entering the name"
            "\n - because if you are not lazy you can do it properly!"
            "\n - we only allow names with maximum length of 50 symbols!"
            "\n - if it is longer than 50 symbols we will punish you by giving you mean name!"
            "\n So yeah. Please inter your name: ").capitalize()
        if len(choosen_name) > 50:
            choosen_name = "Dummy"
            return choosen_name
        return choosen_name
    else:
        commands.typo()
        name_choice(user_choice_gender, race)
コード例 #9
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)
コード例 #10
0
ファイル: start_location.py プロジェクト: z0nky/dnd_wannabe
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)
コード例 #11
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)