-
Notifications
You must be signed in to change notification settings - Fork 0
/
adventureGame.py
1340 lines (1289 loc) · 67.5 KB
/
adventureGame.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
import traceback
# from typing import Any
from termcolor import *
from AsciiAnimations import *
# from json import load
# import turtle; from tkinter import *;
from Data import *; from itemsList import *; from storyAdventure import *; from monsterList import *
import random; import os; import time; import copy;
from gameNounsandWords import *; import string; from animationDepartment import *;
from breakableItems import *
#import keyboard is deprecated so i use pynupt in order to make it cross platform
import sys; from colorama import init; from colorama import Fore, Back, Style
def mapErase(i=1):
print("\033[?25l", end="", flush=True)
print("\033[F"*40,flush=True)
print("\n"*6,flush=True)#Amount of lines i could have max
print("\033[?25h", end="", flush=True)
def erases(i):
for x in range(0, i):
#sys.stdout.write("\033[A")
print("\033[?25l", end="", flush=True)
sys.stdout.write("\033[A\033[K")
sys.stdout.flush()
print("\033[?25h", end="", flush=True)
sys.stdout.flush()
#print("\033[A",' '*115,"\033[A") #Need to change randomy deending on size of screen
def objectOfCurrentBiome(): #doesnt work yet
for bObject in buildList:
if User["Current Biome"] == bObject.getName():
return bObject
def loadMap(biome = False):
if biome == False: biome = Call.biMap
# multiply = 2.8
# if User["Health"] >= 100: multiply = 1.7 #size of line on top
# elif User["Health"] >= 10: multiply = 1.8
# else: multiply = 2.0
# if itemBuffs[1][User['Wearing']][0] < 10: multiply -= 0.4
# elif itemBuffs[1][User['Wearing']][0] < 100: multiply -= 0.65
# else: multiply -= 0.8
# if int(itemBuffs[2][User['Main Hand']][0]) < 10: multiply -= 0.2
# elif int(itemBuffs[2][User['Main Hand']][0]) < 100: multiply -= 0.3
# else: multiply -= 0.5
print("\033[?25l", end="", flush=True)
lengthC = 0;counterM = 0; rowCount = 0
ends = "\033[0m"; starts = " "*65; lineMark = "\033[94m|\033[K\033[0m" #2.8 is distance without health display(f"\033[31m{User['Health']}|{User['Max Health']}\033[94m__\033[90mP:{monsterAttacks.armor}|{itemBuffs[1][User['Wearing']][0]}\033[94m__\033[35mD:{takeItem.mainhand}"
print(" "*63,"\033[94m","_"*(int(biome.getWidth()*1.2)) + "\33[0m", "\033[K", flush= True)
color = biome.getFloorColor()
for row in biome.getMap():
if lengthC > biome.getLength(): break
row_str = starts
for col in row:
counterM += 1
if counterM > biome.getWidth() - 1:
if rowCount == 0: ends += f"\033[94m|\033[0m \033[31mHealth:"
elif rowCount == 1: ends += f"\033[94m|\033[0m \033[31m({User['Health']}|{User['Max Health']})"
elif rowCount == 2: ends += f"\033[94m|\033[0m \033[90mArmor:"
elif rowCount == 3: ends += f"\033[94m|\033[0m \033[90m{monsterAttacks.armor}|{itemBuffs[1][User['Wearing']][0]}"
elif rowCount == 4: ends += f"\033[94m|\033[0m \033[35mDamage:"
elif rowCount == 5: ends += f"\033[94m|\033[0m \033[35m{takeItem.mainhand}"
elif rowCount == 6: ends += f"\033[94m|\033[0m \033[92m{User['Main Hand']}"
elif rowCount == 7: ends += f"\033[94m|\033[0m \033[92m{User['Wearing']}"
elif rowCount == 8: ends += f"\033[94m|\033[0m \033[033mLvL: {User['LVL']}"
elif rowCount == 9: ends += f"\033[94m|\033[0m {biome.getFloorColor()} \033[30m{User['Current Biome']} "
else: ends = "\033[94m|\033[0m "
# elif row == 2: ends += f"\033[94m__\033[90mP:{monsterAttacks.armor}|{itemBuffs[1][User['Wearing']][0]}"
# elif row == 4: ends += f"\033[94m__\033[35mD:{takeItem.mainhand}" #change for when map is different sizes
if counterM > biome.getWidth(): break
row_str += f'{lineMark}{color}{col}\033[0m'
# print(f'{starts}{lineMark}{color}{col}\033[0m',end = f"{ends}\033[0m\033[K", flush= True);
starts = f"{color}"; lineMark = ""
print(row_str+ends + "\033[0m\033[K", flush= True)
counterM = 0; ends = "\033[0m"; starts = " "*65; lineMark = "\033[94m|\033[0m"
lengthC+=1; rowCount += 1
print(" "*63,"\033[94m","\033[94m\u203e"*(int(biome.getWidth()*1.2)) + "\033[0m", "\033[K", flush= True)
print(" "*63, yellow + "Gold: " + reset, flush= True)
# print(" "*64,f" \033[033mLvL: {User['LVL']}", "\33[94m\u203e"*(int(Call.biMap.getWidth()*2.1)),end = "\33[0m\033[K", flush= True)
print("\033[?25h", end="",flush=True)
mapErase(12)
def getNumberInSentence(sentence):
newInt = 0 #Only gets numbers in sentence/string and ignores non numbers
for num in sentence:
for x in range(0, 10):
if str(x) == num:
newInt = newInt*10 + x
return newInt
def help():
#Maybe make it so jeffery says help
help.ran = True
os.system(clear_command)
print("-"*56)
print("""Do to the indcredible work of Hershel Thomas, the game now allows you to naturally
talk to the game as if it was a normal conversation. The game looks for key words and phrases in order
to run the game. For example you can write 'n' to move north or you can write something along the lines of
'I want to move forward' or 'take a step north'. Therese are just a few examples of sentences you can do
Play around with what you can and cannot do. Its awesome!
----------------------------------------------------------------------------------------------------
You can pick up items, drop items, attack monsters, shoot arrows, check your inventory, hold weapons and wear cloths
animate the mouth of Jeffery at the top, look at your current quest or main storyline adventure.
craft items, check in the recipe book, check a certain crafting recipe for an item by saying
'recipe' and the name of the item in the same sentence. ('n', 'e', 's', 'w') for shorthand movement without sentences
get the users location and item info. Just remeber you can use sentences to test out which ones work and which ones dont
to get what you want, check how many monsters have been killed, or what biome you are in
most importantly exit the game with 'exit'""")
def anys(choice ,inputCase: list):
wordle = inputCase
if any(word in choice for word in wordle): return True
def location():
print("Biome: {}".format(User["Current Biome"]))
print("Location: ")
print(f"North: {space[0]}:{Movement.spotN}")
print(f"East: {space[1]}:{Movement.spotE}")
def lookAhead(objOrBlock : bool = False):
#looks ahead one spot depending on direction of player
directionN = Movement.spotN;directionE = Movement.spotE; overColor=Call.biMap.getFloorColor()
# floor = '\033[31m' + "*" + '\033[39m'
if Movement.userImage == "▼" :newAdd = 1
elif Movement.userImage == "▲":newAdd = -1
if Movement.userImage == "◄" :newAdd = -1
elif Movement.userImage == "►":newAdd = 1
if Movement.userImage == "▼"or Movement.userImage == "▲":
directionN += newAdd
else:
directionE += newAdd
try:
# if objOrBlock == True:
# else:
if directionN < Call.biMap.getLength() and directionN >= 0 and directionE >=0 and directionE < Call.biMap.getWidth():
try:
objectAtSpot = Call.biMap.getObj(directionN,directionE)
except:
objectAtSpot = Call.biMap.getStuffPos(directionN,directionE)
else:
objectAtSpot=False
except:
objectAtSpot = False
#returns an array of[northernLocation,EasternLocation,ObjectAtSpot]
return [directionN,directionE,objectAtSpot]
def Movement():
direct = words["direction"]; t = Input.choice;
BoundryLine = ""; increment = [0,0]
if (("move" or "step" in t) and any(word in t.lower() for word in direct[8: 10])) or "w" == t.lower():increment[1]-= 1; BoundryLine = "West"; Movement.userImage = "◄"#ᐊ▲►▼◄◀֎֎֎֎
elif (("move" or "step" in t) and any(word in t.lower() for word in direct[0:3])) or "n" == t.lower(): increment[0]+= 1; BoundryLine = "North"; Movement.userImage = "▲"#ᐃ▲/3456
elif (("move" or "step" in t) and any(word in t.lower() for word in direct[3:5])) or "e" == t.lower(): increment[1]+= 1; BoundryLine = "East"; Movement.userImage = "►"#ᐅ☻ elif (("move" or "step" in t) and any(word in t.lower() for word in direct[4:7])) or "s" == t.lower(): t = "s"; Movement.userImage = "▼"#ᐁ ▼▼◄
elif (("move" or "step" in t) and any(word in t.lower() for word in direct[5:8])) or "s" == t.lower(): increment[0]-= 1; BoundryLine = "South"; Movement.userImage = "▼"#ᐁ ▼▼◄
elif t == "start": Movement.userImage = "▲"; Call.biMap.setStuffPos(Movement.spotN, Movement.spotE, Movement.userImage);mapErase(1);loadMap(); return False
SpotAhead = lookAhead()
if (((space[0] + increment[0] < LowerBound) or (space[0] + increment[0] >= UpperBound)) or ((space[1] +increment[1] < EasternBound) or (space[1] + increment[1] >= WesternBound))):
Call.biMap.setStuffPos(Movement.spotN, Movement.spotE, Movement.userImage)
mapErase(1);loadMap()
print(colored("The " + BoundryLine + "ern Boundry Line blocks your path","light_red"))
return False
elif (SpotAhead[2] == False):
Call.biMap.setStuffPos(Movement.spotN,Movement.spotE, Movement.pre)
space[0] += increment[0]
Movement.spotN += -increment[0]
space[1] += increment[1]
Movement.spotE += increment[1]
for bObject in buildList:
bound = bObject.getCordinate()
if space[0] >= bound[0] and space[0] < bound[1] and space[1] >= bound[2] and space[1] < bound[3]:
if bObject.getStuffPos(Movement.spotN % (bObject.getLength()),space[1] % bObject.getWidth()) in blockedItems:
blockingObject = bObject.getStuffPos(Movement.spotN % (bObject.getLength()),space[1] % bObject.getWidth())
space[0] -= increment[0]
space[1] -= increment[1]
Movement.spotN -= -increment[0]
Movement.spotE -= increment[1]
Call.biMap.setStuffPos(Movement.spotN,Movement.spotE, Movement.userImage)
mapErase(1);loadMap()
print(f"{blockingObject}", colored(f"Blocks Your path On {BoundryLine}ern Side","light_red"))
return False
display1 = User["Current Biome"]; User["Current Biome"] = bObject.getName()
display2 = "Entered Biome: {}".format(User["Current Biome"])
Call.biMap = bObject
scatterItem("item", User["Current Biome"], bound[0], bound[1], bound[2], bound[3], True)
scatterItem("monster", User["Current Biome"], bound[0], bound[1], bound[2], bound[3], True)
Movement.spotN = Movement.spotN % (Call.biMap.getLength())
Movement.spotE = space[1] % Call.biMap.getWidth()
Movement.pre = Call.biMap.getStuffPos(Movement.spotN,Movement.spotE)
Call.biMap.setStuffPos(Movement.spotN,Movement.spotE, Movement.userImage)
mapErase(1);loadMap()
print(colored(f"--------------\nLeaving Biome: {display1}\n{display2}\n--------------","light_yellow"))
#Make a for loop to spawn monsters from old adventures if decide to use that ma=echanic (will be lot of monsters but can change that)
#Can also make a loop to give each place a new random amount of monsters, super eas
if (not User["Current Biome"] in User["Biomes Discovered"]):
User["Biomes Discovered"].append(User["Current Biome"])
print(colored(f"New Biome Discovered!","light_yellow"))
findMonster()
findItem()
return False
print("Game is broken")
time.sleep(10)
elif SpotAhead[2] in blockedItems:
Call.biMap.setStuffPos(Movement.spotN,Movement.spotE,Movement.userImage)
mapErase(1);loadMap()
print(f"{SpotAhead[2]} : \033[94m({itemDrops[SpotAhead[2]][2]})" + colored(" Blocks Your path","light_red"))
return False
else:
# objectInFront = lookAhead(True)
if isinstance(SpotAhead[2], KeyBlocks):
# passingRequirment = objectInFront.getKeyLevel()
Call.biMap.setStuffPos(Movement.spotN,Movement.spotE, Movement.userImage)
mapErase(1);loadMap()
print(f"{SpotAhead[2].getLook()} : {SpotAhead[2].getName()} " + colored(f"Blocks Your Path\n{SpotAhead[2].getMessage()}","red"))
return False
elif isinstance(SpotAhead[2], StoreKeeper): #Work on later after finals only if you pass
Call.biMap.setStuffPos(Movement.spotN,Movement.spotE, Movement.userImage)
mapErase(1);loadMap()
print(yellow, f"{SpotAhead[2].getName()} Wants to shop with you", reset)
print(SpotAhead[2].getItemsAndPrices())
return False
else:
Call.biMap.setStuffPos(Movement.spotN,Movement.spotE,Movement.pre)
space[0] += increment[0]
Movement.spotN += -increment[0]
space[1] += increment[1]
Movement.spotE += increment[1]
Movement.pre = SpotAhead[2]
Call.biMap.setStuffPos(Movement.spotN,Movement.spotE,Movement.userImage)
mapErase(1);loadMap()
findMonster()
findItem()
def shoot():
#(TO DO) - Make it so different weapons can shoot faster so change time speed
#shooting mechanic for arrows later
#add if statement to see if location touches a monster
try:
isArrow = "nothing"
for item in User["Inventory"]:
if "arrow" in item.lower():
isArrow = item
break
if isArrow == "nothing": print("No Arrows or Range weapons in inventory"); return False
mapErase(1)
leMap = Call.biMap.getLength()
wiMap = Call.biMap.getWidth()
directionN = Movement.spotN;directionE = Movement.spotE
firstTry = True;minusNorth = directionN;minusEast = directionE
counter = 0
#would have to change for different size room
#Make it so it only checks when you have arrows
#(TO DO) - Make Cleaner and condense
if Movement.userImage == "▼" :newAdd = 1;compare = directionN < leMap; test = compare
elif Movement.userImage == "▲":newAdd = -1;compare = directionN > 0; test = compare
if Movement.userImage == "◄" :newAdd = -1;compare = directionE > 1; test = compare
elif Movement.userImage == "►":newAdd = 1;compare = directionE < (wiMap-1); test = compare
while compare:
if Movement.userImage == "▼"or Movement.userImage == "▲":
directionN += newAdd;minusNorth = directionN - newAdd
else:
directionE += newAdd;minusEast = directionE - newAdd
if firstTry == False:
Call.biMap.setStuffPos(minusNorth, minusEast, shoot.pre)
# map[minusNorth][minusEast] = shoot.pre (Deprecated not needed 12/22/2023)
shoot.pre = Call.biMap.getStuffPos(directionN, directionE)
if shoot.pre in blockedItems: #tests if wall is in the way Should add test for if object like gate in way
break
Call.biMap.setStuffPos(directionN,directionE, "֎")
firstTry = False
if Movement.userImage == "▼": compare = directionN < (leMap-1)
elif Movement.userImage == "▲": compare = directionN > 0
if Movement.userImage == "◄" : compare = directionE > 0
elif Movement.userImage == "►": compare = directionE < (wiMap-1)
loadMap()
time.sleep(0.2)
counter+=1
if test:
Call.biMap.setStuffPos(directionN,directionE, shoot.pre)
else: print("Shot can't leave biome"); return False
if counter>0:
User["Inventory"].remove(isArrow)
if isArrow not in User["Inventory"]:
User["Main Hand"] = ""
else: print("Shot cant shoot through walls"); return False #Maybe make certaub utens shoot through different walls
mapErase(1);loadMap()
except:
print("Cant Shoot there")
def teleport():
try:
tp = [space[0], space[1]] #cordinate at spot
tpStr = Input.choice[11:-1]
#sets spots and movement to new cordinate
for x in range(0, 2):
space[x] = int(tpStr.partition(',')[x*2])
mapErase(1)
Movement()
print(f"teleporting...{space}")
except:
print("Command Input wrong")
def specItemInfo(item):
br = False
for rows in itemInfo:
for elem in rows:
if elem in item:
print(item + rows[elem])
br = True
break
if br:
break
def dice(start, limit):
roll = random.randint(start, limit)
return roll
def attackMonster(mon):
buff = 0; roll = 0; attackMonster.cL = 0; listI = itemBuffs[2]
if User["Main Hand"] != "":
for lists in itemBuffs[2]:
if User["Main Hand"] == lists:
listB = listI[lists]
listBuff = listB[0]
buff = int(listBuff)
break
roll = dice(1, 6); totalDG = roll + buff
time.sleep(0.35)
print(colored("<------>|User is Attacking|<------>", "light_cyan"))
time.sleep(0.5)
print(colored(f"Rolled: {roll} on a d6", "dark_grey"))
if buff != 0:
time.sleep(0.5)
print(colored(f'{User["Main Hand"]} additional damage: {buff}', "dark_grey"))
attackMonster.cL = 1
time.sleep(0.5)
print(colored(f"Total Damage: \033[94m{totalDG}\033[0m", "dark_grey"))
findMonster.HP -= totalDG
time.sleep(0.5)
# print(f"----{mon}----\n-> Health: {findMonster.HP} <-")
return totalDG
def monsterAttacks(mon):
roll = dice(1, 6); totalDG = roll + findMonster.DG
usingArmor = "User"
if monsterAttacks.armor > 0:
monsterAttacks.armor -= totalDG
usingArmor = "Armor"
if monsterAttacks.armor < 0: monsterAttacks.armor = 0
else:
# totalDG -= itemBuffs[1][User['Wearing']][0]
if totalDG < 0: totalDG = 0
else: User["Health"] -= totalDG
#User is invulnerable when wearin higher level armor, I want user to go through armor first and then health
loadMap()#Displays before actual event
time.sleep(0.35)
print(colored(f"<------>|{mon} is Attacking|<------>", "light_magenta"))
time.sleep(0.5)
print(colored(f"{mon} Rolled: {roll} on a d6", "dark_grey"))
time.sleep(0.5)
print(colored(f'{mon} additional damage: {totalDG} [{findMonster.DG}+{roll}]', "dark_grey"))
time.sleep(0.5)
print(colored(f"Total Damage Towards {usingArmor}: \033[31m{totalDG}\033[0m", "dark_grey"))
return totalDG
#Make it so armor takes away damage from weapons, but if armor causes weapon to do no damage make it
#so the person always does 1 damage
def findMonster():
findMonster.list = []; findMonster.HP = 0; findMonster.DG = 0; attack = " "; findMonster.yes = False
try: #Checks if position equals a pos of item alos checks if pick up command is used and pos is right
for monster in monstersClear:
if space == monstersClear[monster]:
findMonster.yes = True
#erases(30); animation(Call.level, True, True, False) #FIx tests to make it so it prints and you can still see it
if "-" in monster: monsterN = monster.rpartition('-')[0]
else: monsterN = monster
findMonster.list = monMDandHP[monsterN]
findMonster.HP = findMonster.list[1]
findMonster.DG = findMonster.list[0]
findMonster.damageMonster = 0
findMonster.damageUser = 0
rewM = findMonster.list
print(colored(f'-------------------\nA wild {monsterN} appeard: \n <---->|Combat Mode|<---->',"dark_grey"))
while findMonster.HP > 0:
if attack != "":time.sleep(0.5)
print(colored(f"---------User----------\n -> Health: {User['Health']} | {User['Max Health']} <-\n -> Armor Protection: {monsterAttacks.armor} | {itemBuffs[1][User['Wearing']][0]}\n -> Damage Dealt To \033[94mMonster\033[0m\033[31m: {findMonster.damageUser} <-\033[0m", "red"))
print(colored(f"---------{monsterN}----------\n -> Health: {findMonster.HP} | {monMDandHP[monsterN][1]} <-\n -> Damage Dealt To \033[31mUser\033[0m\033[94m: {findMonster.damageMonster} <-\033[0m", "light_blue"))
if attack != "": time.sleep(0.25)
attack = input("Attack or Flee? (a/f) \n->");
while attack == "":#Gets rid of stupid enter thing changing look(1/4/2024)
print(' \033[F \033[F', end='')
attack = input("Attack or Flee? (a/f) \n->");
erases(1)
# print("\033[K")
mapErase(1)
loadMap()
if "attack" in attack.lower() or "a" == attack:
#erases(cLine); cLine = 0
# print(f"You choose to attack the {monsterN}"); cLine +=1
findMonster.damageUser = attackMonster(monsterN)
print(colored((f"---------User----------\n -> Health: {User['Health']} | {User['Max Health']} <-\n -> Armor Protection: {monsterAttacks.armor} | {itemBuffs[1][User['Wearing']][0]}\n -> Damage To \033[94mMonster\033[0m\033[31m: {findMonster.damageUser} <-\033[0m"), "red"))
print(colored((f"---------{monsterN}----------\n -> Health: {findMonster.HP} | {monMDandHP[monsterN][1]} <-\n -> Damage Dealt To \033[31mUser\033[0m\033[94m: {findMonster.damageMonster} <-\033[0m"), "light_blue"))
if findMonster.HP <= 0: break
time.sleep(0.5)
#(DO) wait for user to input enter to move on to next line of code
input("Press Enter to continue fight...")
mapErase(1)
loadMap()
findMonster.damageMonster = monsterAttacks(monsterN) #Finally making combat system
#choose betwene armor increasing health or preventing more damage
elif "flee" in attack or "f" == attack: #(TO DO): Make it so when you flee you lose damage
#erases(2)
monsterAttacks.armor = itemBuffs[1][User['Wearing']][0] #Maybe make it so fleeing doesnt replenish armor
mapErase(1)
loadMap()
print("-Fleeing Combat Like a COWARD-\n")
return 0 #Make it so when you flee you lose health #and when enemy attacks chance not to hit anf you too/
elif anys(attack, words["hand"]):
item = checkItemInfo(attack)
print('Mainhand: ')
if attack == "mainhand" or attack == "mainhand ":
print(f'{User["Main Hand"]}')
else: mainhand("MH", item)
elif anys(attack, words["wear"]):
wear = checkItemInfo(attack)
print("Wearing: ")
if attack == "equip " or attack == "wear" or attack == "wear ":
print(f'{User["Wearing"]}')
else: mainhand("Wear", wear)
elif anys(attack, words["consume"]):
food = checkItemInfo(attack)
if attack == "consume " or attack == "eat " or attack == "consume" or attack == "eat":
print(colored('Choose something to eat!',"light_red"))
else:
consume(food)
# mapErase()
# loadMap()
elif "/kill" in attack: findMonster.HP = -1
#Add a return if health is below or equal to 0
mapErase(1)
dropA = []
# if dropProb >= (10 - rewM[4]):
dropArr = rewM[3]
itemArr = rewM[2]
counter = 0
for item in itemArr:
dropMinMax = dropArr[counter]
dropAmount = dice(int(dropMinMax[0]), int(dropMinMax[1]))# + rewM[4]
for it in range(dropAmount):
dropA.append(item)
User["Inventory"].append(item)
User["InventoryCollected"].append(item)
counter += 1
#print(dropAmount)Change dnyamix where there is no probability drop count
#But there is more items that can drop from monster Problem is individual
#items should have higher drop chance if they are from bosses or lower level items
#Make it so it can drop a random item from each list or a certain amounts of items from each list
#It chooses randomly which items are dropped and stuff can add another drop percantage for each item
if dropA != []:
sortDrop = sortItemCount(dropA, "")
sortDrop = " ".join(sortDrop)
else: sortDrop = "Nothing"
#else: sortDrop = Nothing
time.sleep(0.5)
erases(30)
print("<-","-"*40,"->")
changeMessage(f"""#--|Congrats on defeating {monsterN}|--\n${monsterN} Dropped: \n$->{sortDrop}""")
animation("Spokesman", True, False, (f" \033[90mKilled {monsterN}: \033[94m({findMonster.HP} | {monMDandHP[monsterN][1]})\033[0m"))
Call.level = "Spokesman"; Call.thing = True; Call.message = f" \033[90mKilled {monsterN}:\033[0m \033[94m({findMonster.HP} | {monMDandHP[monsterN][1]})\033[0m"#could add this in changeMessage board
User["Monsters Killed"].append(monsterN)
monstersClear.pop(monster)
monsterAttacks.armor = itemBuffs[1][User['Wearing']][0]
mapErase(1)
loadMap()
return 0
except:
return 0
def consume(food):
if food in itemBuffs[3]:
if food in User["Inventory"]:
if User["Health"] == User["Max Health"]:
print(colored(f"Health already full!, Can't eat {food}", "light_red"))
else:
User["Inventory"].remove(food)
# User["InventoryCollected"].remove(food)
User["Health"] += itemBuffs[3][food][0]
if User["Health"] > User["Max Health"]: User["Health"] = User["Max Health"]
mapErase(1);loadMap()
print(colored(f"Consumed {food} and gained {itemBuffs[3][food][0]} health","light_blue"))
return 0
else: print(colored("Item not in inventory","light_red"))
else: print(colored("Item not in game","light_red"))
def mainhand(type,item):
ch = 0
if type == "MH": ch = 2
if type == "Wear": ch = 1
if item in User["Inventory"] and item != User["Main Hand"] and item != User["Wearing"]:
for obj in itemInfo[ch]:
if item == obj and ch == 2:
User["Main Hand"] = item
takeItem.mainhand = int(itemBuffs[2][User['Main Hand']][0])
mapErase(1);loadMap()
print(f'Putting {item} in Main Hand')
return 0
elif item == obj and ch == 1:
User["Wearing"] = item
monsterAttacks.armor = itemBuffs[1][User['Wearing']][0]
mapErase(1);loadMap()
print(f'Equipping {item} on Body')
return 0
if item == User["Main Hand"] and ch == 2: print(f'{item} already in mainhand')
elif item in User["Wearing"] and ch == 1: print(f"Already wearing {item}")
elif checkItemInfo(item) == "nothing": print("Item not in game")
elif item not in User["Inventory"]: print(f"Dont have {item} in inventory")
elif ch == 1: print(f"Can't equip {item}")
elif ch == 2: print(f"Can't put {item} in Mainhand")
def findItem(): #cut it into multiple definitions so its easier with new noun system
#Checks if location has item, then puts item in inventory and deletes item from dictionary and biome items
#if findItem.skip == True and findItem.c != True: erases(3)
#Checks if position equals a pos of item alos checks if pick up command is used and pos is right
try:
for items in itemLoc:
drops = list(itemLoc[items])
if space == itemLoc[items] or space == drops[0]:
if "DROP" in items: itemN = items.rpartition("DROP")[0]
if "-" in items: itemN = items.rpartition('-')[0]
else: itemN = items
if takeItem.s:
#if findEnv.yes == False and findMonster.yes == False: erases(30); animation(Call.level, True, True, False)
#else: print(f"\n ")
print(f"Unbelievable, you come across a {itemN}! (Pick it up)")
#map[9-(space[0]%10)][space[1]%10] = itemN[0]
return items
return "False"
except:
return "False"
def takeItem():
takeItem.s, Call.erase, findItem.era = False, False, 0
wF, ch, item = words["itemFind"], Input.choice, findItem()
#Make alternate for describing (DONE)
gridI = gridItems[User["Current Biome"]]
if "-" in item: itemN = item.rpartition('-')[0]
else: itemN = item
if "DROP" in item: itemN = itemN.rpartition('DROP')[2]
if item != "False" and anys(ch.lower() ,wF[3:]):
User["Inventory"].append(itemN); User["InventoryCollected"].append(itemN)
itemLoc.pop(item)
#Fix for later if armor becomes array
gridIt = list(gridI[0]); gridNum = list(gridI[1])
for x in range(0, len(gridI[0])):
if gridIt[x] == item:
break
gridNum[x] = (gridNum[x] - 1)
if gridNum[x] == 0:
gridNum.pop(x)
gridIt.pop(x);
if item in itemDrop:
Movement.pre = Call.biMap.getFloorColor() + " "
itemDrop.pop(item)
gridItems[User["Current Biome"]] = [gridIt, gridNum]
specItemInfo(itemN)
findItem.ItemMemory = itemN; findItem.era = 3
itemIsDroped = False
for drop in itemDrop:
listDrop = itemDrop[drop]
if space == listDrop[0]:
Movement.pre =drop[0]
# itemIsDroped = True
break
#12/31 (Have error were map gets rid of door if item spawns under it) (1/18/2024-FIXED)
# if itemIsDroped == False:
# Movement.pre = Call.biMap.getFloorColor() + " "
mapErase(1);loadMap()
print(f"-------PICKING UP--------\n{itemN} added to your inventory!")
# dropItem.count -= 1
elif item != "False": specItemInfo(itemN)
elif anys(ch.lower(), wF[3:]): print("Nothing to pick up Man!")
else: print("Nothing to describe over here Dude!")
takeItem.s = True
def scatterItem(t, envir, nS, nE, eS, eE, scatter : bool):
try:
if "monster" in t:
monstersClear.clear(); t = monstersClear;
if storyLevel.level >= len(storyNum):
gridI = monsters[storyNum[len(storyNum) - 1]]
else: gridI = monsters[storyNum[storyLevel.level]]
elif "item" in t:
t = itemLoc
if scatter == True:
itemLoc.clear();
gridI = gridItems[envir]
if scatter == True:
itemArray = [];itemCounter = 1; stepCounter = 0;
itemMultipliyer = gridI[1];
for item in gridI[0]:
itemCounter = 1
for x in range(0, itemMultipliyer[stepCounter]):
newItem = (f'{item}-{itemCounter}')
itemCounter += 1
itemArray.append(newItem)
stepCounter += 1
for items in itemArray:
t[items] = [random.randint(nS,nE - 1), random.randint(eS,eE - 1)]
if t == itemLoc:
for drops in itemDrop:
spot = itemDrop[drops]
spotList = spot[0]
if User["Current Biome"] in spot[1]:
sizes = Call.biMap
leMap = sizes.getLength()
wiMap = sizes.getWidth()
itemLoc[drops] = spot[0]
n = (spotList[0]) % leMap
e = spotList[1] % wiMap
Call.biMap.setStuffPos((leMap-1)-n,e,str(drops[0]))
if spotList == space:
Movement.pre = str(drops[0])
except:
print("Did not run")
time.sleep(5.5)
return 0
def testForNewEnv():
counter = 0
for bObject in buildList:
bounds = bObject.getCordinate()
if not User["Current Biome"] == bObject.getName():
if space[0] >= bounds[0] and space[0] < bounds[1] and space[1] >= bounds[2] and space[1] < bounds[3]:
return buildList[counter]
counter+=1
return [Call.biMap, False]
def findEnv():
findEnv.yes = False; counter = 0
for bObject in buildList:
bound = bObject.getCordinate()
if not User["Current Biome"] == bObject.getName():
if space[0] >= bound[0] and space[0] < bound[1] and space[1] >= bound[2] and space[1] < bound[3]:
#Trying to make boundry lines for each qaudrant
#Cehcks boundries for each environment location (Can save memory later by doing onyl whats touching)
display1 = User["Current Biome"]; User["Current Biome"] = bObject.getName()
display2 = "Entered Biome: {}".format(User["Current Biome"])
Call.biMap = bObject
scatterItem("item", User["Current Biome"], bound[0], bound[1], bound[2], bound[3], True)
scatterItem("monster", User["Current Biome"], bound[0], bound[1], bound[2], bound[3], True)
mapErase(1);loadMap()
print(f"--------------\nLeaving Biome: {display1}\n{display2}\n--------------")
#Make a for loop to spawn monsters from old adventures if decide to use that ma=echanic (will be lot of monsters but can change that)
#Can also make a loop to give each place a new random amount of monsters, super eas
#also need to make a thing to place stuff on map
if (not User["Current Biome"] in User["Biomes Discovered"]):
User["Biomes Discovered"].append(User["Current Biome"])
print(f"New Biome Discovered!")
#print(f'Monsters for Story: {s} are roaming across the land')
arrB = [bound[0], bound[1], bound[2], bound[3]]
return arrB
counter +=1
return False
def itemDesc():
#Prints out the description of items that are only in the inventory
c = 0; t = 0; cInv = User["Inventory"][:]
print("."*8)
for i in itemInfo:
for j in i:
if j in cInv:
print(j + itemInfo[c][j])
t = 0
while t < len(cInv):
if cInv[t] == j:
cInv.remove(j)
t += 1
c += 1
print("."*8)
def arrayChecker(OG, inThis: list, lengths: list): #checks if array contains other elements by sorting them through magic
#use with len function to make sure you use apprpriate one
#Doesnt matter order
sortedItems = []
itemIndex, count = OG, 0
thing = inThis.copy()
for item in OG:
if item in itemIndex[count] and item in thing:
sortedItems.append(item)
thing.remove(item)
count += 1
if sortedItems == OG and len(OG) == len(lengths): return True
else: return False
def craftItem(create, inp): #can Change the whole dynamic where you type in the thing you want
#and then it checks if you have those items in your inventory
#and therfore dont need to write down all items
#leaves room for guessing and fun, but tedious if recipes are large
#Can add something to display recipee book for objects
cho = Input.choice; buildTypes = itemCraft; name = "CRAFT"
if anys(cho.lower(), words["craft"]): buildTypes = itemCraft;
elif anys(cho.lower(), words["smelt"]): buildTypes = itemCook; name = "SMELT"
if inp == False:
creUp = string.capwords(create)
arrCraft = creUp.split(", ")
userInv = False; ItemArray = False; sortedItems = False
for i in buildTypes:
itemCount = sortItemCount(buildTypes[i], "add")
if inp == False:
ItemArray = arrayChecker(itemCount, arrCraft, arrCraft)
sortedItems = arrayChecker(itemCount, User["Inventory"], arrCraft)
elif create == i:
userInv = arrayChecker(itemCount, User["Inventory"], itemCount)
if (ItemArray == True and sortedItems == True) or userInv == True:# Tests if arrays match up and then gets rid of items and creates new
for ele in itemCount:
User["Inventory"].remove(ele)
times = buildTypes[i]; itemList = []; tTwo = times[2]
for x in range(tTwo[0]):
User["Inventory"].append(i)
User["InventoryCollected"].append(i)
itemList.append(i)
countItemList = sortItemCount(itemList, "None")
print(f"\033[33m| |--[{name}ING]--|\n| .............\033[0m")
time.sleep(0.3)
print(f"\033[31m| [Resources Expended] ")
print(f"|{sortItemCount(buildTypes[i], 'count')}\033[0m")
print(f"\033[32m| [{name}ED]")
print(f"|{countItemList}\033[0m ")
findItem.ItemMemory = i
return 0
elif ItemArray: #TO DO(Problem is for cooking you have to say final product now what you want to put in, like if i say cook iron axe, it will say cant smelt it, you have to say smelt iron ore)
#change for singal smelts or add new book for smelting
print("Do not have required items in inventory for {}".format(i))
return 0
if inp == True:
if create in buildTypes:
print(colored(f"Don't have enough items in inventory for {create}","light_red"))
craftRecipe(create)
print(colored(f"You only have:","light_red"))
needs = []; listUI = list(User["Inventory"])
craftItems = sortItemCount(buildTypes[create], "add")
setUser = set(User["Inventory"])
for i in craftItems:
if i in setUser:
needs.append(f"{i} ({listUI.count(i)})")
setUser.remove(i)
if needs == []: needs = "No Items"
print(colored(f"->{needs}", "light_red"))
else: print(f"Non craftable recipe for {create}")
else: print("Not a craftable recipe!")
def craftRecipe(craftable): #Describes crafting recipee for whatever you put down
cho = Input.choice; name = "Building"; buildT = itemCraft
if craftable in itemCook: buildT = itemCook; names = "smelt for"; name = "smelt"
elif craftable in itemCraft: buildT = itemCraft; name = "craft"; names = "craft"
for ele in buildT:
if craftable == ele:
print(colored(f'To {names} {ele} You will need: \n{sortItemCount(buildT[ele], "count")}',"dark_grey"))
return 0
print(colored(f"Non {name}able item","light_red")) # Can write code to figure out which one if its not in game or just not cratfable
def recipeBook(type): #make it so you can change to different recipe book and journals
page = 1; sR = 0; eR = 4; lineDraw = True; erase = True; t = 0; cLine = 0
if "Cook" in type: types= itemCook
elif "Craft" in type: types = itemCraft
elif "Item Locate" in type: types = itemLoc
else: types = type
print("")#Make a checker to see if it is a book in game
keys = list(types)
key_listener = MyKeyListener()
listener = keyboard.Listener(
on_press=key_listener.on_press,
on_release=key_listener.on_release)
listener.start()
while True:
if erase:
erases(cLine+1);cLine = 0
if lineDraw and erase:
print(" \n----------------------: Arrow keys to move left and right");cLine+=1
if lineDraw:
print("Page {}".format(page));cLine+=1
lineDraw = False
try:
if erase:
for x in range(sR, eR-1):
if "Item Locate" not in type:#FIX TO MAKE ANY BOOK
multType = types[keys[x]]
tTwo = multType[2]
print((f'({tTwo})'),keys[x], ": ",sortItemCount(types[keys[x]], "count")); cLine += 1
else:
print(keys[x], ":", types[keys[x]]); cLine += 1
t = 0
except: t = 1
if erase: print("---------------------: Press 'Enter' to leave book \n "); cLine+=2
erase = True
if key_listener.is_right_arrow_pressed():
keyboard.Controller().release(keyboard.Key.right)
if t == 0: sR = eR-1; eR += 3; page+=1; lineDraw = True
else: erase = False
elif key_listener.is_left_arrow_pressed():
keyboard.Controller().release(keyboard.Key.left)
if sR - 3 > -1: eR -= 3; sR -= 3; page-=1; lineDraw = True
else: erase = False
elif key_listener.is_enter_pressed():
input(" ")
if (key_listener.is_enter_pressed()): erases(1)
listener.stop()
del key_listener
return 0
else: erase = False
# listener.stop()
def breakItem():
NorthEastAndObjectAtSpot = lookAhead()
if User["Main Hand"] == "":
print("Need to hold something to break")
return False
if NorthEastAndObjectAtSpot[2] != False and NorthEastAndObjectAtSpot[2] in itemDrops and not isinstance(NorthEastAndObjectAtSpot[2], KeyBlocks):
# add ability to check for material and give user item broken or drop it
#destroy item and grab it (TO-DO)
floor = '\033[31m' + " " + '\033[39m'
directionN = NorthEastAndObjectAtSpot[0]
directionE = NorthEastAndObjectAtSpot[1]
objectAtSpot = NorthEastAndObjectAtSpot[2]
if objectAtSpot == floor:
print("Nothing to break")
else:
ItemBlockChecker = heirarchyCheck(objectAtSpot,itemBuffs[2][User['Main Hand']][1])
if ItemBlockChecker[0] == False:
print(colored(f"Not holding correct tool to break : \033[39m{objectAtSpot}","cyan"))
print(colored(f"Need tool level of \033[31m{ItemBlockChecker[1]}\033[96m or higher","light_cyan"))
print(colored(f"Current tool level is \033[31m{itemBuffs[2][User['Main Hand']][1]}", "light_cyan"))
return False
Call.biMap.setStuffPos(directionN,directionE, floor)
mapErase(1);loadMap()
print(f"\033[32mBroke {objectAtSpot} : \033[94m({itemDrops[objectAtSpot][2]})\033[0m")
destroyedObject = getItemList(objectAtSpot)
items = destroyedObject[0]
countOfItems = destroyedObject[1]
lists = [[],[]]
#Goes through list and adds item counts and items to inv
for item in items:
if isinstance(countOfItems[items.index(item)],list):
num = dice(countOfItems[items.index(item)][0], countOfItems[items.index(item)][1])
else:
num = countOfItems[items.index(item)]
if num > 0:
lists[0].append(item)
lists[1].append(num)
else: num = 0
for x in range(num):
User["Inventory"].append(item)
User["InventoryCollected"].append(item)
#Get the item and amount in nice to read string
sorts = sortItemCount(lists, "count")
print("\033[32mAnd collected: ")
print(sorts,"\033[0m")
else:
print("Cant break there")
def build(item):
if item == "nothing":
print("Not a buildable item in the game")
return False
elif item not in User["Inventory"]:
print("Item not in Inventory")
return False
else:
for key in itemDrops.keys():
if item == itemDrops[key][2]:
Call.biMap.setStuffPos(Movement.spotN, Movement.spotE, key)
loadMap()
print(f"Building {item} on {space}")
User["Inventory"].remove(item)
Movement.pre = Call.biMap.getStuffPos(Movement.spotN, Movement.spotE)
return True
print(f"Cant Place {item}")
return False
def dropItem(said):
it = checkItemInfo(said)
if it == "nothing":
print("item does not exist")
return False
elif it not in User["Inventory"]:
print("Item not in Inventory")
return False
if Movement.pre != Call.biMap.getFloorColor() + " ":
print("\033[31mCan't drop item here!\033[0m")
return False
if it in User["Main Hand"]: User["Main Hand"] = "";takeItem.mainhand = int(itemBuffs[2][User['Main Hand']][0])
elif it in User["Wearing"]: User["Wearing"] = "";monsterAttacks.armor = itemBuffs[1][User['Wearing']][0];
gridList = gridItems[User["Current Biome"]]
gridItem = gridList[0]; gridNum = gridList[1]
User["Inventory"].remove(it)
it = (f'{it}-DROP{dropItem.count}')
dropItem.count += 1
itemDrop[it] = [[space[0], space[1]],[User["Current Biome"]]]
gridItems[User["Current Biome"]] = [gridItem, gridNum]
#(TO DO) Change to use bi map so now i keep track on whatever biome I am on
#for ele in text:
bound = Call.biMap.getCordinate()
# if space[0] >= bound[0] and space[0] < bound[1] and space[1] >= bound[2] and space[1] < bound[3]:
scatterItem("item", User["Current Biome"], bound[0],bound[1],bound[2],bound[3], False)
mapErase(1);loadMap()
leMap = Call.biMap.getLength()
wiMap = Call.biMap.getWidth()
# if "Wall" in it: Movement.pre = "\033[38;2;218;165;32m" + "Ⅱ" + "\033[0m"
# #Add mechanic to destory walls (░♀▒▓█▄▀▐▌)
# #DO the array thing so each specialty item has a special object font,
# #like walls and doors and EVEN ANY ITem has its unique texture
# elif "Door" in it: Movement.pre = "∏"
# elif "Crafting Table" in it: Movement.pre = "🪵"
Movement.pre = it[0]
n = (space[0]) % leMap
e = space[1] % wiMap
Call.biMap.setStuffPos((leMap-1)-n,e, Movement.userImage) #(Fixed) Fix so correct letter is displayed when you pick up
print(f"~~~Dropping {it.rpartition('-')[0].rpartition('DROP')[0]} at [{space[0]}, {space[1]}]~~~")
return True
def addItem(item, num :int):
x = 0; item = string.capwords(item)
while x < len(itemInfo):
for list in itemInfo[x]:
if item == list:
for x in range(0, num):
User["Inventory"].append(item)
User["InventoryCollected"].append(item)
print("Adding {} to your inventory {} times".format(item, str(num)))
findItem.ItemMemory = item
return 0
x += 1
print("Not an item in the game")
def Info():
print(f'Health: {User["Health"]}')
print(f'Current Biome: \n{User["Current Biome"]}')
def invLoc():
Inventory1 = copy.deepcopy(Inventory)
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print(colored(f'Main Hand: ({User["Main Hand"]}) \nWearing: ({User["Wearing"]})',"light_green"))
for i in User["Inventory"]: #Can just do this when retrieve item so it doesnt have to use space
CT = 0
for j in Inventory:
if (test0 := (i in itemInfo[CT] and i) or
(i.rpartition("-")[0] in itemInfo[CT] and i.rpartition("-")[0])):
if test0 in itemInfo[CT]:
Inventory1[j].append(test0)
break
CT+=1
arrJ = []; sortU = []
for name in Inventory: arrJ.append(name)
for x in range(0, len(arrJ)): #fix to use itemCountSort()
sortU = []
for item in Inventory1[arrJ[x]]:
itemC = (f'{item} ({Inventory1[arrJ[x]].count(item)})')
if itemC not in sortU:
sortU.append(itemC)
print(f'{arrJ[x]}: {sortU}')
print("\033[m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
def storyAdv(): #Prints out story for levek you Are on
lev = storyLevel.level
if lev >= len(storyNum):
Call.level = "Spokesman"; Call.message = f" Completed all levels"
changeMessage(f"""#You Rock!!!\n$Lets Celebrate!!!!\n$Have a slice of cake""")
animation("Spokesman", True, False, Call.message)
return True
else:
print(f'To complete Story: {storyNum[lev]}')
storyList(story[storyNum[lev]] , False, 0,0,0,0,0, True)
return False
def storyLevel(check): #Sets what level you are on. Pops all other Stories so youi only can do one Need to make deep copy
storyLevel.skip = False
try:
if check == True:
storyLevel.level += 1
User["LVL"]=storyLevel.level
if storyLevel.level < len(storyNum):
Call.level = storyNum[storyLevel.level];
animation(storyNum[storyLevel.level], True, False, False)
if storyLevel.level == 1: User["Max Health"] += 20; User["Health"] = User["Max Health"]
time.sleep(0.3)
bA = User["Current Biome"]
for bObject in buildList:
#for ele in text:
bA = bObject.getCordinate()
if User["Current Biome"] == bObject.getName():
scatterItem("monster", storyNum[storyLevel.level], bA[0], bA[1], bA[2], bA[3], True)
time.sleep(0.3)
mapErase(1)
loadMap()
mapErase(1)