summary refs log tree commit diff
path: root/rpg.py
blob: d8cbb47aacdd3710e764c5e8306cc56f404a3c24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411

# print game name


print("====================================")
print()
print("          The Organ Braille         ")
print()
print("====================================")

inventory = []

hpup1 = False

# ask for player username

name = input("What is your name, Traveler? ")

# welcome them


print(f"Welcome to the game, {name}, I wish you the best of luck!")


answer = input("Do you wish to proceed further? ")


if answer.lower() == "no":
	print("Well then, off you go!")
	exit()


print("Choose your class!")
print("1. Knight")
print("2. Rogue")
print("3. Mage")


valid_class = False


while valid_class == False:
	player_class_input = input("> ")

	if player_class_input == "1":
		print("A mighty knight you are! Move forward with pride!")
		valid_class = True
		player_class = 1
	elif player_class_input == "2":
		print("A stealthy rogue, sneak between shadows and cut from behind!")
		valid_class = True
		player_class = 2
	elif player_class_input == "3":
		print("A powerful mage, cast spells of fire and ice to batter your opponent!")
		valid_class = True
		player_class = 3
	else:
		print("That isn't a class!")

if player_class == 1:
	print("health - 150")
	player_health = 150
	max_player_health = 150
	print("damage - 80")
	player_damage = 80
elif player_class == 2:
    print("health - 80")
    player_health = 80
    max_player_health = 80
    print("damage - 120")
    player_damage = 120
elif player_class == 3:
    print("health - 130")
    player_health = 130
    max_player_health = 130
    print("damage - 90")
    player_damage = 90

alchemist_shop = False        


print("You procede along a small path towards a giant cave far in the distance.")

print("The cave was home to an evil dragon, the end goal of your quest is to slay him and save the kingdom!")

print("Will you procede forward to fight a Goblin or detour at the Alchemy shop?")

while alchemist_shop == False:
    potioninq = input("Goblin or Alchemist? ")


    if potioninq.lower() == "alchemist":
        print("You say hello to the Alchemist and he gives you a potion and a small piece of bread for the road.")
        inventory.append("Potion")
        inventory.append("Bread")
        alchemist_shop = True
    elif potioninq.lower() == "goblin":
        print("You procede forward to battle the goblin")
        alchemist_shop = True
    else:
        print("That isn't an option!")

def battle(enemy_name, enemy_health, enemy_damage):
    global player_health
    global inventory
    global max_player_health
    global player_damage
    global hpup1
    import random
    print(f"You enter a battle with a {enemy_name}!")

    while player_health > 0 and enemy_health > 0:
        itemselected = False
        print("Select the number of the action you would like to do!")
        print("1. Fight")
        print("2. Item")
        print("3. Run")
        battle_selection = (input("> "))
        
    
        if battle_selection.lower() in ["1", "fight"]:
            damage = random.randint(
                player_damage - 25,
                player_damage + 15
            )
            enemy_health = enemy_health - damage
            print(f"You dealt {damage} to {enemy_name}")
            print(f"{enemy_name} has {enemy_health} HP remaining!")


        elif battle_selection.lower() in ["2", "item"]:
            if not inventory:
                print("Your inventory is empty!")
                continue
            else:    
                while itemselected == False:
                    print("Inventory")
                    for item in inventory:
                        print(f"- {item}")


                    itemselected = input("Use which item? Type exit to not use an item. ")
                    if itemselected.lower() == "potion":
                            if "Potion" in inventory:
                                inventory.remove("Potion")
                                if hpup1 == False:
                                    player_health = player_health + 80
                                    print("You drank the potion. You regained 80 Health.")
                                elif hpup1 == True:
                                    player_health = player_health + 130
                                    print("You drank the potion. You regained 130 Health.")
                                print(player_health)
                                item_selected = True
                                if player_health > max_player_health:
                                        player_health = max_player_health
                                print(player_health)
                            else:
                                print("You do not have that!")          
                    elif itemselected.lower() == "bread":
                        if "Bread" in inventory:
                            inventory.remove("Bread")
                            if hpup1 == False:
                                player_health = player_health + 50
                                print("You ate the bread. You regained 50 Health.")
                            elif hpup1 == True:
                                player_health = player_health + 90
                                print("You ate the bread. You regained 90 Health.")
                            item_selected = True
                            if player_health > max_player_health:
                                    player_health = max_player_health
                            print(player_health)
                    elif itemselected.lower() == "witch's brew":
                        if "Witch's Brew" in inventory:
                            inventory.remove("Witch's Brew")
                            brewkill = random.randint(1, 10000)
                            if brewkill >= 2:
                                player_health = max_player_health
                                print("You are healed fully by the Witch's Brew")
                                itemselected = True
                            elif brewkill <= 1:
                                print("The Witch's Brew eat and burns through your throat.")
                                print("You collapse slowly to the ground.")
                                print("Game over.")
                                exit()
                    elif itemselected.lower() == "exit":
                        itemselected = True
                        break
                continue
        elif battle_selection.lower() in ["3", "run"]:
            print("You can't run, idiot.")
            player_health = player_health - 15
            print("You tripped and took 15 damage.")
        else:
            print("Not an option!")
            continue


        if enemy_health > 0: 
     
            
     
            enemy_attack = random.randint(
                enemy_damage - 5,
                enemy_damage + 5
            )
                                                

            player_health = player_health - enemy_attack


        if player_health <= 0:
            print("You died!")
            exit()    
     
     
            print(f"{enemy_name} attacks!")
            print(f"You take {enemy_damage} damage")


        print(f"You have {player_health} HP Remaining!")


battle("Goblin", 125, 15)    


import random


player_gold = random.randint(150, 250)


print("You won! The goblin falls to the ground defeated.")
print()
print()
print("He points you down the path. Ahead was a small shop.")               
print(f"The goblin gives you {player_gold} gold.")
print()
print()
print()
print("Down the path was a little shop. You stop inside.")
print("Spend your gold here!")
print("What would you like to buy?")

def shop():
    global player_gold
    road_shop = False


    while road_shop == False:
        print(f"You have {player_gold} to spend!")
        item_bought = input("Potion 35 Gold, Bread 20 Gold, Witch's Brew 80 Gold. Type exit to leave without buying anything. ")


        if item_bought.lower() == "potion":
            if player_gold >= 35:
                print("You bought a Potion!")
                inventory.append("Potion")
                player_gold = player_gold - 35
                print(f"You have {player_gold} gold left!")    
            elif player_gold < 35:
                print("You don't have enough gold...")

        elif item_bought.lower() == "bread":
            if player_gold >= 20:
                print("You bought bread!")
                inventory.append("Bread")
                player_gold = player_gold - 20
                print(f"You have {player_gold} gold left!")
            elif player_gold < 20:
                print("You don't have enough gold...")

        elif item_bought.lower() == "witch's brew":
            if player_gold >= 80:
                print("You bought a bubbling Witch's brew!")
                inventory.append("Witch's Brew")
                player_gold = player_gold - 80
                print(f"You have {player_gold} gold left!")
            elif player_gold < 80:
                print("You don't have enough gold...")

        elif item_bought.lower() == "exit":
            print("You leave the shop after taking a look around.")
            road_shop = True

        else:
            print("Not an option!")


shop()


print("You stumble across a man along the path after you leave the shop.")
print("He asks if you want to know about the path ahead of you.")


manquestion = input("yes or no? ")


if manquestion.lower() == "yes":
    print("The man tells you about a powerful Ogre down the path a little while.")
    print("You feel as if you will cross paths with that monster.")


else:
    print("You feel an impending sense of doom of the path ahead of you.")
    print("You don't know how to feel about it.")


print("You come across a bridge. There's a seemingly evil presence under it. Will you investigate or not.")


bridgelook = input("yes or no ")

if bridgelook.lower() == "yes":
    print("You find a horrifying looking monster. He tells you to not worry.")
    print()
    print("He tells you that he wasn't anything to worry about.")
    print("The creature asks if you wanted to be friends, and introduces himself as Golem.")
    print()
    print("You tell him you will be his friend, and he gives you 200 Gold.")
    player_gold = player_gold + 200


else:
    print("You cross the bridge carefully. Nothing happens as you cross, and you continue down the path.")


print("You felt a sense of unease rise onto your back. You turn and a goblin ambushes you!")


battle("Strong Goblin", 300, 40)


print("The strong goblin falls beneath your strength. He gives you a permanent health upgrade.")


if player_class == 1:
    print("Your max HP increased to 350")
    max_player_health = 350
    player_health = max_player_health
    print("Your HP was also fully restored!")
elif player_class == 2:
    print("Your max HP increased to 180")
    max_player_health = 180
    player_health = max_player_health
    print("Your HP was also fully restored!")
elif player_class == 3:
    print("Your max HP increased to 230")
    max_player_health = 230
    player_health = max_player_health
    print("Your HP was also fully restored!")


hpup1 = True


print("You press on going forawrd.")
print()
print()
print()
print("You enter a forest. You heard a twig break behind you and you look to see a young girl.")


print("Be a monster?")
print("1. Yes.")
print("2. No.")


brutality = input("> ")


if brutality.lower() == "yes":
    print("You feel stronger. You leave the splatter of blood on the ground.")
    print("Your fate is sealed.")
    print()
    print()
    print()
    print("You encounter the dreadful Ogre. Be prepared.")
    print("He judges you a distasteful stain of this world. Good luck.")
    battle("Ogre", 1500, 60)


elif brutality.lower() == "no":
    print("You give the girl a little flower.")
    print("She runs off into the wilderness.")


    if manquestion.lower() == "yes":
        print("You come across the Ogre that the strange man told you about.")
        print("He thanks you for gifting his friend a flower.")
        print()
    elif manquestion.lower() == "no":
        print("You come across an Ogre")
        print("He thanks you for gifting his friend a flower.")

    print("Attack the Ogre in fear?")
    print("Yes.")
    print("No.")
    ogrefight = input("> ")


    if ogrefight.lower() in ["1", "yes"]:
        print("You swing at the Ogre. He initates a fight.")
        battle("Ogre", 850, 60)
        player_gold = player_gold + random.randint(500, 700)
    elif ogrefight.lower() in ["2", "no"]:
        print("You carry on down the path.")
        print("Good choice.")


shop()