-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
1185 lines (1135 loc) · 42.8 KB
/
main.py
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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# author: Grant Hawerlander
# CSC119 Spring 2021
#note: yes i know this isnt efficent. yes i know it's 1000+ lines long. i made this at 2 am and the only thing saving me is my documentation
import time # used to add wait time during printing
import sys # used to exit the program
import os # used to clear the console
from termcolor import colored, cprint # print in different colors
import random # randomizer
#defining flags that nitpick and ensure there are no "continuity" glitches. These are events that can only happen once.
#LOOK AROUND COINS- GH
lachflag = 0
#CANDLE BOUGHT
canflag = 0
#LAVA CASTLE COMPLETED
lcflag = 0
#TRAINING GROUNDS COMPLETED
trflag = 0
#BAD SWORD BOUGHT
bsflag = 0
#STRENGTH POT BOUGHT
spflag = 0
#STEEL SWORD BOUGHT
ssflag = 0
#BEAT IN OLENGUARD REGION
oBeat = False
#BEAT IN LESTO REGION
lBeat = False
#LIGHT ARMOR BOUGHT
laflag = 0
#GRAVEYARD COMPLETED
gyflag = 0
#SHOVEL BOUGHT
sflag = 0
#HEAVY ARMOR BOUGHT
haflag = 0
#DELIVERY FINISHED
delivfin = False
#CAN QUEST FINISHED
canq = False
#DELIVERY PACKAGE GIVEN
deliv = False
#BEAT IN TRENSTINIA
tBeat = False
#---/\/\/\BACK END/\/\/\---
#---\/\/\/FRONT END\/\/\/---
#INVENTORY
inven = []
#GOLD
gold = 5
#MODIFIERS
atkmod = 0
defmod = 0
#QUESTS
quests = ["GRAB ALL 3 KEYS AND OPEN THE VAULT"]
#HEALTH
health = 10
# clears the console when called
def clear():
os.system("clr" if os.name == "nt" else "clear")
#shows "ui" (just basic info)
cprint("QUESTS: "+ str(quests),"blue","on_grey")
cprint("Inventory: " + str(inven),"magenta","on_grey")
cprint("Health: "+ str(health), "green","on_grey")
cprint("Gold: " + str(gold), "yellow","on_grey")
cprint("ATK: " + str(atkmod), "yellow","on_grey")
cprint("DEF: " + str(defmod), "yellow","on_grey")
#makes a line to show "game screen"
cprint(" "*40,"red",attrs=["underline"])
#sets up game and instructions
def intro():
print("Welcome, Traveler. This is a game that will test your strategy, skill and intelligence.")
time.sleep(1)
print("Instead of a normal dungeon crawler, this game is set up to be more of a DND game. Instead of different rooms, there will be towns and shops for you to explore.")
time.sleep(4)
print("Your goal is to escape via the vault. But first you must find the vault and grab the keys required to open it.")
time.sleep(5)
print("You will navigate towns via the Carriage Hub. Passage is free, but you may have to determine which town is which direction first.")
time.sleep(5)
print("You have 5 gold to spend as you wish in the towns and shops you discover. Having armor or a weapon before going into battle is STRONGLY RECOMMENDED. These items will provide you with a modifer, which will add to your attack rolls or take away from enemy's hits to do less damage.")
time.sleep(6)
input("Press enter to begin the game...")
clear()
def trestinia():
clear()
print("You see a medieval lava town filled with a castle and a few shops. Everything is suspended above a lava lake. You see 4 locations...")
cprint("where do you go? \n>General Store\n>Lava Castle\n>Talk to the girl\n>The Cave\n>Look Around\n>Return","cyan")
flag = 0
while flag == 0:
#DIRECTORY FUNCTIONS TO SEND PLAYER TO ROOMS
flag = 1
wt = input('>')
if wt.lower() in ["general store","gen","store","general","gs"]:
generalstore()
elif wt.lower() in ["castle","lava","lc","lava castle"]:
lavacastle()
elif wt.lower() in ["girl","talk to the girl","talk","tg"]:
kaydelivery()
elif wt.lower() in ["cave","the cave","c","tc"]:
cave()
elif wt.lower() in ["return","go back","carriage hub","r","gb"]:
grandhub()
elif wt.lower() in ["l","look","look around"]:
#ensures prgm doesnt stop
flag = 0
print("You are in a lava town, where almost everyone is descendants of the Magma Family. Nearly everyone is superhuman and made of stones and lava.")
input("Press enter to continue.\n")
trestinia()
else:
flag = 0
#checks if you messed up
cprint("incorrect answer, please input a new answer.","red")
print("Where next?")
def generalstore():
#globals to ensure uniformity
global gold
global canflag
global sflag
print("The general store is very run down, and only offers two sole items, a shovel and a candle.")
cprint("You see two items for sale:\n>Shovel (2G)\n[Purpose: ???.]\n>Candle (2G)\n[Purpose: ???.]\nWhat do you buy? (Press enter to leave)","cyan")
ans = input(">")
#detects if u want a shovel
if ans.lower() in ["shovel","s"]:
if sflag == 0:
if gold >= 2:
#ensures you cant get a buttload of shovels
sflag = 1
#aestetic pieces
print("You buy a shovel!")
cprint("-2 Gold", "red")
cprint("+1 Shovel", "green")
#adds to inventory
inven.append("Shovel")
cprint("Current inventory: " + str(inven),"magenta")
gold = gold -2
cprint("Current Gold: " + str(gold),"yellow")
input("Press enter to continue.\n")
#sends back to store
generalstore()
else:
#haha poor check
cprint("You don't have enough money to buy the shovel.","red")
cprint("Current Gold: " + str(gold),"yellow")
input("Press enter to continue.")
#sends back to store
generalstore()
else:
#yeah you aren't getting more than one shovel buckaroo
cprint("You already bought the shovel.","red")
input("Press enter to continue.")
generalstore()
#checks for candle
if ans.lower() in ["candle","c"]:
#makes sure you havnt bought a candle
if canflag == 0:
#makes sure you have gold
if gold >= 2:
canflag = 1
#aestetic
print("You buy a candle!")
cprint("-2 Gold", "red")
cprint("+1 Candle", "green")
#adds to inventory
inven.append("Candle")
cprint("Current inventory: " + str(inven),"magenta")
#removes gold
gold = gold -2
cprint("Current Gold: " + str(gold),"yellow")
input("Press enter to continue.\n")
generalstore()
else:
#if poor:
cprint("You don't have enough money to buy the candle.","red")
cprint("Current Gold: " + str(gold),"yellow")
input("Press enter to continue.")
#back to shop
generalstore()
else:
#if you already bought it
cprint("You already bought the candle.","red")
input("Press enter to continue.")
generalstore()
else:
cprint("You leave the store.","red")
input("Press enter to continue. ")
trestinia()
def lavacastle():
global gold
global lcflag
#sets correct to false
correct = False
if lcflag == 0:
print("You are approached by a lava jester. He has a puzzle for you!!")
print("Fill in the blanks, all together they will make a sentence. You may enter the answer with spaces or not.")
print("AHOx Hint: Pirate\nTxOL Hint: Hammer\nxNDO Hint: Go Back\nDOx Hint: Pet\nENTxR Hint: Go in\nxALK Hint: Speak\n5,6,7,8,9,x,11,12 Hint: Counting\nxAME Hint: Playing one right now\nxLD Hint: My Grandma and Grandpa\nGOAx Hint: Yours is to win the game\nFRIENx Hint: You have some of these! (hopefully)")
while correct == False:
scribe= input("Answer:\n")
#checks for answer (i put debug in bc im lazy)
if scribe.lower() in ["youget10gold", "you get 10 gold","debug"]:
#quit looking at the answer!
correct = True
lcflag = 1
print("Congragulations! You get 10 gold!!")
cprint("+10 Gold","green")
#updates gold
gold = gold+10
cprint("Current Gold: " + str(gold), "yellow")
input("Press enter to continue.")
trestinia()
else:
#wrong
cprint("Incorrect. Remember, the 'x' tells you what you need to fill in.","red")
else:
#cant do it twice
print("you completed this puzzle. you return to town square.")
input("Press enter to continue.")
trestinia()
def kaydelivery():
global deliv
global quests
#checks if deliv has been made
if deliv == False:
deliv = True
print("You walk up to the girl. She says to you: 'Can you please deliver this to my friend Dakota in Etzor? I'm too busy right now to get it. She's a shopkeeper there and she needs this package. Thank you! I'll make it worth your while.'")
cprint("+ Package", "green")
#you get the package
inven.append("Package")
cprint("Current Inventory: " + str(inven) , "magenta")
#sees if it's a repeat
if "DELIVER PACKAGE TO DAKOTA IN ETZOR" not in quests:
quests.append("DELIVER PACKAGE TO DAKOTA IN ETZOR")
cprint("NEW QUEST: DELIVER PACKAGE TO DAKOTA IN ETZOR", "blue")
else:
#if you know dakota you alr have the quest, this is just a hint
cprint("Hmm, maybe this package goes with somebody you've already met...","green")
input("Press enter to continue.")
trestinia()
else:
#if you already got the package then she wont give you another
cprint("You already recieved this package.", "red")
input("Press enter to continue. ")
trestinia()
def cave():
#globals to ensure uniformity
global health
global tBeat
global inven
#checks if monster is alive
if tBeat == False:
print("You approach the cave. Inside you hear a deep growling sound.")
#one last chance to save yourself
cprint("Do you go in?", "red", attrs=["bold","underline"])
if input(">").lower() in ["y","yes",'yep','ye']:
#oh girl good luck
clear()
cprint("You find a lava monster!!! Entering combat....", "grey")
input("Press enter to continue.")
#health setup
mHealth = 20
alive = True
quests.append("KILL THE LAVA MONSTER")
while alive == True:
#COMBAT CYCLE BEGINS--------------------------
clear()
#clearing dodge mod
dMod = 0
cprint("What do you do?\n>Hit (highest weapon tier will be auto-added)\n>Dodge (Negate Next Hit's Damage)\n>Recover (Recover Health)", "cyan")
#checking for heal pot (you're gonna need it)
if "Heal Potion" in inven:
cprint(">Use Healing Potion","cyan")
act = input(">")
#IF HIT ACTION
if act.lower() in ["sword","hit","punch","attack","h"]:
#determining hit+ atkmod added by weapons
hit = (random.randint(1,5) + atkmod)
#monster takin the hit
mHealth = mHealth - hit
cprint("You hit it! You did " + str(hit) + " damage (" + str(atkmod)+" added through modifiers).", "green")
#check if you #slayed
if mHealth <= 0:
tBeat = True
cprint("You killed the monster!!","green")
cprint("You find the LAVA KEY and return to town.", "green", attrs = ["bold"])
#woo u got the key
inven.append("LAVA KEY")
cprint("Current Inventory: " + str(inven),"magenta")
input("Press enter to continue.")
quests.remove("KILL THE LAVA MONSTER")
#returns to town
trestinia()
#IF DODGE ACTION
elif act.lower() in ["dodge","d"]:
#determining dodge mod
dMod = random.randint(1,5)
cprint("You dodge the next attack. You negate " + str(dMod) +" off the next hit!","green")
#IF RECO ACTION
elif act.lower() in ["reco", "recover", "r"]:
#determining reco
heal = random.randint(1,4)
health = health+heal
cprint("You recover for "+ str(heal)+" health!","green")
cprint("Current Health: "+ str(health),"grey")
#IF HEAL (must have one in inventory)
elif act.lower() in ["use healing potion", "heal","use potion","hp"] and "Heal Potion" in inven:
cprint("You use a healing potion and heal 8 health!", "green")
cprint("-1 Healing Potion","red")
health =+8
inven.remove("Heal Potion")
cprint("Current Inventory: " + str(inven),"magenta")
else:
#if you mess up even though i give you so many chances you can die idc
cprint("action not recognized. skipping turn!!", "red")
cprint("The monster swings at you...","red")
dam = random.randint(1,defmod+7)
#determining damage-modifiers
dam = dam - (dMod+defmod)
cprint("You negated " + str((dMod+defmod)) +" damage!", "green")
if dam <= 0:
cprint("The monster misses you! (0 or less damage)", "green")
else:
cprint("You get hit for "+ str(dam)+" damage!","red")
#you aint gettin more health buckaroo
if dam >0:
health = health-dam
print("Monster Health: "+str(mHealth))
#dead check!
if health <= 0:
cprint("YOU HAVE DIED.","red")
#this is so true
print("Tip! ALWAYS GO INTO COMBAT WITH A GOOD SWORD OR ARMOR OR A POTION. YOU CAN'T DO IT ALONE.")
quit()
cprint("Current Health: "+ str(health), "grey")
input("Press enter to continue.")
else:
print("You return to town square.")
input("Press enter to continue.")
trestinia()
else:
cprint("You already defeated this monster. You return to town square.","red")
input("Press enter to continue.")
trestinia()
#END TRESTINIA FUNCTIONS________________________________________________
#START LESTO FUNCTIONS____________________________________________________
def lesto():
clear()
print("As you get off the carriage you are greeted with the fresh town of lesto. Lesto is a forest city, with everything being in treetops and made out of wood. Here, you see 4 locations...")
cprint("where do you go? \n>Training Grounds\n>Apothecary\n>Pet Shop\n>The Forest\n>Look Around\n>Return","cyan")
flag = 0
while flag == 0:
flag = 1
wt = input('>')
#sends player to rooms
if wt.lower() in ["training grounds","tg","t","training","train"]:
trainingGrounds()
elif wt.lower() in ["apothecary","a","apo"]:
apothecary()
elif wt.lower() in ["pet shop","p","ps","pets"]:
petshop()
elif wt.lower() in ["forest","the forest","f","tf"]:
forest()
elif wt.lower() in ["return","go back","carriage hub","r","gb"]:
grandhub()
elif wt.lower() in ["l","look","look around"]:
flag = 0
print("You are in a forest town, where many of the people idolize nature and treat it as another human. You don't see much else.")
input("Press enter to continue.\n")
lesto()
else:
flag = 0
cprint("incorrect answer, please input a new answer.","red")
print("Where next?")
def trainingGrounds():
#sets up quiz variable
correct = False
global atkmod
global defmod
global trflag
flag = 0
#makes sure you aren't just grinding training
if trflag == 0:
print("You are greeted with a training area with two dummies, one that sets up attacks against you and one that can take hits against it.")
cprint("What do you level up?\n>Defense\n>Attack","cyan")
while flag == 0:
ans = input('>')
#checks which one you wanna level up
if ans.lower() in ["defense","def","d"]:
print("In order to level up defense, solve this math equation.")
print("(4*8-2)^2")
while correct == False:
answer= input("Answer:\n")
#i see you looking for the answer...
if answer == "900":
#changes states
correct = True
trflag = 1
print("Congragulations! You permanently leveled up your defense modifier by 1!!")
cprint("+1 DEF","green")
#ups modifier
defmod = defmod + 1
cprint("Current Def: " + str(defmod), "yellow")
input("Press enter to continue.")
#back to town
lesto()
else:
#incorrect
cprint("Incorrect. Remember, pemdas!","red")
#checks if you want attack
elif ans.lower() in ["attack", "atk", "a"]:
print("In order to level up attack, solve this math equation.")
print("(4*8-2)^2")
while correct == False:
answer= input("Answer:\n")
if answer == "900":
correct = True
#flag to make sure you dont cheat
trflag = 1
print("Congragulations! You permanently leveled up your attack modifier by 1!!")
cprint("+1 ATK","green")
atkmod = atkmod+1
cprint("Current Atk: " + str(atkmod), "yellow")
input("Press enter to continue.")
lesto()
else:
cprint("Incorrect. Remember, pemdas!","red")
else:
#try again, idk what you said
cprint("Entry not recognized.","red")
cprint("What do you level up?","cyan")
else:
#only once
cprint("You already leveled something up here.","red")
print("You return to town square.")
input("Press enter to continue. ")
lesto()
def apothecary():
global gold
global atkmod
global spflag
print("You walk into the apothecary. They only have one sole item, sitting on a desk. It's a red potion.")
#makes sure you don't get 2
if spflag == 0:
print("You see one item for sale:\n>Strength Potion (5G)\n[Purpose: Permanently Adds +2 to ATK modifier upon purchase. Used immediately.]\nBuy it? (Any input not similar to 'yes' will qualify as a no.)")
#checks if you want it
if input(">").lower() in ["yes","y",'ye','yep']:
if gold >= 5:
spflag = 1
print("You buy it!")
cprint("-5 Gold", "red")
cprint("+1 ATK", "green")
#updates gold
gold = gold -5
atkmod = atkmod+1
cprint("current gold: " + str(gold),"yellow")
input("Press enter to continue.\n")
lesto()
else:
#if poor:
cprint("You don't have enough money to buy the potion.","red")
print("You return to town square")
input("Press enter to continue.")
lesto()
else:
#if no:
print("you decide not to buy it and return to town square.")
input("Press enter to continue.\n")
lesto()
else:
#if bought:
print("The store is sold out. You return to town square.")
input("Press enter to continue.\n")
lesto()
def petshop():
global gold
global inven
global defmod
global atkmod
print("The pet shop offers many dogs and cats, enough to build an army.")
cprint("You see two items for sale:\n>Dog (6G)\n[Purpose: Defends you for 1 damage.]\n>Cat (5G)\n[Purpose: Attacks with you for 1 damage.]\nWhat do you buy? (Press enter to leave)","cyan")
ans = input(">")
#if dog
if ans.lower() in ["dog","d"]:
if gold >= 6:
print("You buy a dog!")
cprint("-5 Gold", "red")
cprint("+1 Dog", "green")
#+ Dog in inventory
inven.append("Dog")
cprint("Current inventory: " + str(inven),"magenta")
#- gold
gold = gold -6
#+ def
defmod= defmod+1
cprint("current Gold: " + str(gold),"yellow")
cprint("Current Def: " + str(defmod),"yellow")
input("Press enter to continue.\n")
petshop()
else:
#if poor:
cprint("You don't have enough money to buy the dog.","red")
cprint("current Gold: " + str(gold),"yellow")
input("Press enter to continue.")
petshop()
if ans.lower() in ["cat","c"]:
if gold >= 5:
print("You buy a cat!")
cprint("-3 Gold", "red")
cprint("+1 Cat", "green")
#+ cat
inven.append("Cat")
cprint("Current inventory: " + str(inven),"magenta")
#updating gold
gold = gold -5
atkmod= atkmod+2
cprint("current Gold: " + str(gold),"yellow")
cprint("current Atk: " + str(atkmod),"yellow")
input("Press enter to continue.\n")
petshop()
else:
cprint("You don't have enough money to buy the cat.","red")
cprint("current Gold: " + str(gold),"yellow")
input("Press enter to continue.")
petshop()
else:
cprint("You leave the store.","red")
input("Press enter to continue. ")
lesto()
def forest():
#globals to ensure uniformity
global health
global lBeat
global inven
#checks if monster is alive
if lBeat == False:
print("You approach the forest. Inside you hear a guttoral shriek.")
#one last chance to save yourself
cprint("Do you go in?", "red", attrs=["bold","underline"])
if input(">").lower() in ["y","yes",'yep','ye']:
#oh girl good luck
clear()
cprint("You find a large forest monster!!! Entering combat....", "grey")
input("Press enter to continue.")
#health setup
mHealth = 20
alive = True
quests.append("KILL THE LAVA MONSTER")
while alive == True:
#COMBAT CYCLE BEGINS--------------------------
clear()
#clearing dodge mod
dMod = 0
cprint("What do you do?\n>Hit (highest weapon tier will be auto-added)\n>Dodge (Negate Next Hit's Damage)\n>Recover (Recover Health)", "cyan")
#checking for heal pot (you're gonna need it)
if "Heal Potion" in inven:
cprint(">Use Healing Potion","cyan")
act = input(">")
#IF HIT ACTION
if act.lower() in ["sword","hit","punch","attack","h"]:
#determining hit+ atkmod added by weapons
hit = (random.randint(1,5) + atkmod)
#monster takin the hit
mHealth = mHealth - hit
cprint("You hit it! You did " + str(hit) + " damage (" + str(atkmod)+" added through modifiers).", "green")
#check if you #slayed
if mHealth <= 0:
lBeat = True
cprint("You killed the monster!!","green")
cprint("You find the FOREST KEY and return to town.", "green", attrs = ["bold"])
#woo u got the key
inven.append("FOREST KEY")
quests.remove("KILL THE FOREST MONSTER")
cprint("Current Inventory: " + str(inven),"magenta")
input("Press enter to continue.")
#returns to town
lesto()
#IF DODGE ACTION
elif act.lower() in ["dodge","d"]:
#determining dodge mod
dMod = random.randint(1,5)
cprint("You dodge the next attack. You negate " + str(dMod) +" off the next hit!","green")
#IF RECO ACTION
elif act.lower() in ["reco", "recover", "r"]:
#determining reco
heal = random.randint(1,4)
health = health+heal
cprint("You recover for "+ str(heal)+" health!","green")
cprint("Current Health: "+ str(health),"grey")
#IF HEAL (must have one in inventory)
elif act.lower() in ["use healing potion", "heal","use potion","hp"] and "Heal Potion" in inven:
cprint("You use a healing potion and heal 8 health!", "green")
cprint("-1 Healing Potion","red")
health =+8
inven.remove("Heal Potion")
cprint("Current Inventory: " + str(inven),"magenta")
else:
#if you mess up even though i give you so many chances you can die idc
cprint("action not recognized. skipping turn!!", "red")
cprint("The monster swings at you...","red")
dam = random.randint(1,defmod+7)
#determining damage-modifiers
dam = dam - (dMod+defmod)
cprint("You negated " + str((dMod+defmod)) +" damage!", "green")
if dam <= 0:
cprint("The monster misses you! (0 or less damage)", "green")
else:
cprint("You get hit for "+ str(dam)+" damage!","red")
#you aint gettin more health buckaroo
if dam >0:
health = health-dam
print("Monster Health: "+str(mHealth))
#dead check!
if health <= 0:
cprint("YOU HAVE DIED.","red")
print("Tip! ALWAYS GO INTO COMBAT WITH A GOOD SWORD OR ARMOR OR A POTION. YOU CAN'T DO IT ALONE.")
quit()
cprint("Current Health: "+ str(health), "grey")
input("Press enter to continue.")
else:
print("You return to town square.")
input("Press enter to continue.")
lesto()
else:
cprint("You already defeated this monster. You return to town square.","red")
input("Press enter to continue.")
lesto()
#END LESTO FUNCTIONS________________________________________________
#START OLENGUARD FUNCTIONS____________________________________________________
def olenguard():
clear()
print("You arrive at Olenguard. Olenguard is an industrial city, where factories and buildings are everywhere. There is only one boy to be seen. You see four locations...")
cprint("where do you go? \n>Blacksmith\n>Witch Doctor\n>Talk to the boy\n>The Complex\n>Look Around\n>Return","cyan")
flag = 0
while flag == 0:
flag = 1
wt = input('>')
#directs the player
if wt.lower() in ["blacksmith","bs","s","smith"]:
blacksmith()
elif wt.lower() in ["witch doctor","doc","wd","d"]:
witchdoc()
elif wt.lower() in ["boy","b","talk to the boy","talk"]:
brandongrab()
elif wt.lower() in ["complex","the complex","c","tc"]:
complex()
elif wt.lower() in ["return","go back","carriage hub","r","gb"]:
grandhub()
elif wt.lower() in ["l","look","look around"]:
flag = 0
print("You are in an industrial town, where almost everyone seems to be working.")
input("Press enter to continue.\n")
olenguard()
else:
flag = 0
cprint("incorrect answer, please input a new answer.","red")
print("Where next?")
def blacksmith():
global gold
global inven
global atkmod
global bsflag
global ssflag
print("The blacksmith offers two swords to help you in your fights.")
cprint("You see two items for sale:\n>Bad Sword (4G)\n[Purpose: Boosts ATK by 1.]\n>Steel Sword (10G)\n[Purpose: Boosts ATK by 3.]\nWhat do you buy? (Press enter to leave)","cyan")
ans = input(">")
#if bad sword:
if ans.lower() in ["bad","b", "bad sword","bs"]:
if bsflag == 0:
#poor check
if gold >= 4:
print("You buy a bad sword!")
#updates flag
bsflag = 1
cprint("-4 Gold", "red")
cprint("+1 Bad Sword", "green")
#adds to inventory
inven.append("Bad Sword")
cprint("Current inventory: " + str(inven),"magenta")
#removes gold + adds attack
gold = gold -4
atkmod = atkmod + 1
cprint("Current Gold: " + str(gold),"yellow")
cprint("Current ATK: " + str(atkmod),"yellow")
input("Press enter to continue.\n")
blacksmith()
else:
#if poor:
cprint("You don't have enough money to buy the sword.","red")
cprint("current Gold: " + str(gold),"yellow")
input("Press enter to continue.")
blacksmith()
else:
#if bought:
cprint("You already bought the bad sword!","red")
input("Press enter to continue.")
blacksmith()
if ans.lower() in ["steel","s", "steel sword","ss"]:
if ssflag == 0:
if gold >= 10:
print("You buy a Steel Sword!")
#updates flag
ssflag = 1
cprint("-10 Gold", "red")
cprint("+1 Steel Sword", "green")
#adds to inven
inven.append("Steel Sword")
cprint("Current inventory: " + str(inven),"magenta")
#updates stats
gold = gold -10
atkmod = atkmod + 3
cprint("Current Gold: " + str(gold),"yellow")
cprint("Current ATK: " + str(atkmod),"yellow")
input("Press enter to continue.\n")
blacksmith()
else:
#if poor:
cprint("You don't have enough money to buy the sword.","red")
cprint("current Gold: " + str(gold),"yellow")
input("Press enter to continue.")
blacksmith()
else:
#if bought:
cprint("You already bought the steel sword!","red")
input("Press enter to continue.")
blacksmith()
else:
#if not recognized or not entered
cprint("You leave the store.","red")
input("Press enter to continue. ")
olenguard()
def witchdoc():
global gold
print("You walk into the witch doc and you see health potions galore. Almost an endless supply.")
print("You see one item for sale:\n>Health Potion (5G)\n[Purpose: Heals you for +8 hp. Used in combat.]\nBuy it? (Press enter to leave.)")
if input(">").lower() in ["yes","y",'ye','yep']:
if gold >= 5:
print("You buy it!")
cprint("-5 Gold", "red")
cprint("+1 Health Potion!", "green")
#updates gold
gold = gold -5
inven.append("Health Potion")
cprint("Current inventory: " + str(inven),"magenta")
cprint("current gold: " + str(gold),"yellow")
input("Press enter to continue.\n")
witchdoc()
else:
#if poor:
cprint("You don't have enough money to buy the potion.","red")
cprint("current gold: " + str(gold),"yellow")
input("Press enter to continue.")
witchdoc()
else:
#non-response
cprint("you exit the store.","red")
input("Press enter to continue.\n")
olenguard()
def brandongrab():
global gold
global inven
global canq
#if not completed
if canq == False:
print("You go up to the boy. He says: 'I need a candle for my next caving trip!'")
if "Candle" in inven:
print('"Thank you for getting me a candle!! Please take this as my gratitude!" He takes the candle from your hands and puts a pack of gold in its place.')
#marks as done
canq = True
cprint("-1 Candle", "red")
cprint("+10 Gold", "green")
#adds gold
gold = gold +10
#removes stuff
inven.remove("Candle")
if "GET THE BOY A CANDLE" in quests:
quests.remove("GET THE BOY A CANDLE")
cprint("Current inventory: " + str(inven),"magenta")
cprint("Current Gold: " + str(gold),"yellow")
input("Press enter to continue.\n")
olenguard()
else:
print("Can you please get me a candle? I'll make it worth your while!!")
cprint("NEW QUEST: GET THE BOY A CANDLE", "blue")
#adds to quests
quests.append("GET THE BOY A CANDLE")
input("Press enter to continue.\n")
olenguard()
else:
#if already completed
print(' The boy says: "Thank you for getting me a candle!!"')
input("Press enter to continue.\n")
olenguard()
def complex():
#globals to ensure uniformity
global health
global oBeat
global inven
#checks if monster is alive
if oBeat == False:
print("You approach the industrial complex. Inside, you hear a piercing whistle sound.")
#one last chance to save yourself
cprint("Do you go in?", "red", attrs=["bold","underline"])
if input(">").lower() in ["y","yes",'yep','ye']:
#oh girl good luck
clear()
cprint("You find a steam monster!!! Entering combat....", "grey")
input("Press enter to continue.")
#health setup
mHealth = 20
alive = True
quests.append("KILL THE STEEL MONSTER")
while alive == True:
#COMBAT CYCLE BEGINS--------------------------
clear()
#clearing dodge mod
dMod = 0
cprint("What do you do?\n>Hit (highest weapon tier will be auto-added)\n>Dodge (Negate Next Hit's Damage)\n>Recover (Recover Health)", "cyan")
#checking for heal pot (you're gonna need it)
if "Heal Potion" in inven:
cprint(">Use Healing Potion","cyan")
act = input(">")
#IF HIT ACTION
if act.lower() in ["sword","hit","punch","attack","h"]:
#determining hit+ atkmod added by weapons
hit = (random.randint(1,5) + atkmod)
#monster takin the hit
mHealth = mHealth - hit
cprint("You hit it! You did " + str(hit) + " damage (" + str(atkmod)+" added through modifiers).", "green")
#check if you #slayed
if mHealth <= 0:
oBeat = True
cprint("You killed the monster!!","green")
cprint("You find the STEEL KEY and return to town.", "green", attrs = ["bold"])
#woo u got the key
inven.append("STEEL KEY")
quests.remove("KILL THE STEEL MONSTER")
cprint("Current Inventory: " + str(inven),"magenta")
input("Press enter to continue.")
#returns to town
olenguard()
#IF DODGE ACTION
elif act.lower() in ["dodge","d"]:
#determining dodge mod
dMod = random.randint(1,5)
cprint("You dodge the next attack. You negate " + str(dMod) +" off the next hit!","green")
#IF RECO ACTION
elif act.lower() in ["reco", "recover", "r"]:
#determining reco
heal = random.randint(1,4)
health = health+heal
cprint("You recover for "+ str(heal)+" health!","green")
cprint("Current Health: "+ str(health),"grey")
#IF HEAL (must have one in inventory)
elif act.lower() in ["use healing potion", "heal","use potion","hp"] and "Heal Potion" in inven:
cprint("You use a healing potion and heal 8 health!", "green")
cprint("-1 Healing Potion","red")
health =+8
inven.remove("Heal Potion")
cprint("Current Inventory: " + str(inven),"magenta")
else:
#if you mess up even though i give you so many chances you can die idc
cprint("action not recognized. skipping turn!!", "red")
cprint("The monster swings at you...","red")
dam = random.randint(1,defmod+7)
#determining damage-modifiers
dam = dam - (dMod+defmod)
cprint("You negated " + str((dMod+defmod)) +" damage!", "green")
if dam <= 0:
cprint("The monster misses you! (0 or less damage)", "green")
else:
cprint("You get hit for "+ str(dam)+" damage!","red")
#you aint gettin more health buckaroo
if dam >0:
health = health-dam
print("Monster Health: "+str(mHealth))
#dead check!
if health <= 0:
cprint("YOU HAVE DIED.","red")
print("Tip! ALWAYS GO INTO COMBAT WITH A GOOD SWORD OR ARMOR OR A POTION. YOU CAN'T DO IT ALONE.")
quit()
cprint("Current Health: "+ str(health), "grey")
input("Press enter to continue.")
else:
print("You return to town square.")
input("Press enter to continue.")
olenguard()
else:
#you aint gettin 2 keys
cprint("You already defeated this monster. You return to town square.","red")
input("Press enter to continue.")
olenguard()
def etzor():
clear()
#starts etzor paths
print("You arrive at Etzor. You step off your carriage to find a cold and snowy region. You also see 4 locations...")
cprint("where do you go? \n>Leather Worker\n>Talk to the shopwoman\n>Graveyard\n>The Vault\n>Look Around\n>Return","cyan")
flag = 0
while flag == 0:
flag = 1
wt = input('>')
#sends player to locations
if wt.lower() in ["leather worker","lw","l","worker","w"]:
leatherworker()
elif wt.lower() in ["talk to the shopwoman","shopwoman","sw","s","ts"]:
dakotadelivery()
elif wt.lower() in ["graveyard","g","grave","gy"]:
graveyard()
elif wt.lower() in ["vault","the vault","v","tv"]:
vault()
elif wt.lower() in ["return","go back","carriage hub","r","gb"]:
grandhub()
elif wt.lower() in ["l","look","look around"]:
flag = 0
print("You are in a winter based town, where many of the people are bundled up in jackets ready for snow.")
input("Press enter to continue.\n")
lesto()
else:
flag = 0
#lets player enter again
cprint("incorrect answer, please input a new answer.","red")
print("Where next?")
def leatherworker():
#globals for uniformity
global gold
global inven
global defmod
global laflag
global haflag
print("The blacksmith offers two swords to help you in your fights.")
cprint("You see two items for sale:\n>Light Armor (4G)\n[Purpose: Boosts DEF by 1.]\n> Heavy Armor (10G)\n[Purpose: Boosts DEF by 3.]\nWhat do you buy? (Press enter to leave)","cyan")
ans = input(">")
#checks for light armor
if ans.lower() in ["light","l", "light armor","la"]:
if laflag == 0:
#checks to see you're not poor
if gold >= 4:
print("You buy Light Armor!")
laflag = 1
#aestetic
cprint("-4 Gold", "red")
cprint("+1 Light Armor", "green")
#adds to iventory
inven.append("Light Armor")
cprint("Current inventory: " + str(inven),"magenta")
#updates gold
gold = gold -4
defmod = defmod + 1
#aestetic 2: electric boogaloo
cprint("Current Gold: " + str(gold),"yellow")
cprint("Current DEF: " + str(defmod),"yellow")
input("Press enter to continue.\n")
#back to shop
leatherworker()
else:
#poor
cprint("You don't have enough money to buy the armor.","red")
#shows u gold
cprint("Current Gold: " + str(gold),"yellow")
input("Press enter to continue.")
#back to shop
leatherworker()
else:
#if bought:
cprint("You already bought the light armor!","red")
input("Press enter to continue.")
leatherworker()