-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLastNightOnEarth.py
1111 lines (1064 loc) · 42.5 KB
/
LastNightOnEarth.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 random
import json
import os
import time
from pip import main
class format:
clear = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
underline = "\u001b[4m"
italic = "\u001b[3m"
dim = "\u001b[2m"
bold = "\u001b[1m"
end = "\u001b[0m"
red = "\u001b[31m"
blue = "\u001b[36m"
green = "\u001b[32m"
directory = os.path.dirname(__file__)
filename = os.path.join(directory, ('json/dialogue.json'))
dialogue = json.load(open(filename, "r"))
filename = os.path.join(directory, ('json/maps.json'))
maps = json.load(open(filename, "r"))
filename = os.path.join(directory, ('json/items.json'))
items = json.load(open(filename, "r"))
filename = os.path.join(directory, ('json/lootpools.json'))
lootpool = json.load(open(filename, "r"))
filename = os.path.join(directory, ('json/democontent.json'))
demo = json.load(open(filename, "r"))
def defineVariables():
global x
global y
global day
global hours
global minutes
global period
global headHealth
global torsoHealth
global leftArmHealth
global rightArmHealth
global leftLegHealth
global rightLegHealth
global sanity
global inventory
global inventoryIDs
global inventoryDurability
global equipped
global equippedDurability
global shadows
global shadowhealth
global side
global looted
global building
global huntstart
global level
x = 1
y = 1
day = 0
hours = 7
minutes = random.randint(0, 4) * 10
period = "PM"
headHealth = 50
torsoHealth = 100
leftArmHealth = 75
rightArmHealth = 75
leftLegHealth = 75
rightLegHealth = 75
sanity = 100
inventory = []
inventoryIDs = []
inventoryDurability = []
equipped = "None"
equippedDurability = 0
shadows = []
shadowhealth = []
side = 1
looted = []
building = "house"
huntstart = 0
level = 1
def testVariables():
global x
global y
global day
global hours
global minutes
global period
global inventory
global inventoryIDs
global inventoryDurability
global equipped
global equippedDurability
global shadows
global shadowhealth
global difficulty
x = 1
y = 1
day = 0
hours = 1
minutes = random.randint(0, 59)
period = "AM"
inventory = ["TEST_BAT", "TEST_SHOTGUN", "TEST_REVOLVER", "ROCKET_LAUNCHER"]
inventoryIDs = ["baseballbat", "shotgun", "revolver", "rocketlauncher"]
inventoryDurability = [3, 5, 6, 1]
equipped = "None"
equippedDurability = 0
shadows = ["diningroom"]
shadowhealth = [100]
difficulty = 1
def updateTime(addminutes = 0):
global minutes
global minutesstr
global hours
global day
global period
minutes = minutes + addminutes
while minutes >= 60:
hours = hours + 1
minutes = minutes - 60
while hours > 12:
if period == "AM":
period = "PM"
else:
period == "AM"
hours = hours - 12
minutesstr = str(minutes)
if minutes < 10:
minutesstr = "0" + minutesstr
def ask(message, indent, options, delay):
y = 0
while y <= indent:
print(" ", end = "")
y = y + 1
print(message)
x = 0
while x < len(options):
y = 0
while y <= indent:
print(" ", end = "")
y = y + 1
print(str(x + 1) + ". " + options[x])
time.sleep(delay)
x = x + 1
y = 0
while y <= indent:
print(" ", end = "")
y = y + 1
x = int(input("> "))
if x > len(options) or x < 1:
while x > len(options) or x < 1:
y = 0
while y <= indent:
print(" ", end = "")
y = y + 1
x = int(input("Invalid input!\n > "))
return x
def askString(message, indent):
y = 0
while y <= indent:
print(" ", end = "")
y = y + 1
print(message)
while y <= indent:
print(" ", end = "")
y = y + 1
x = input("> ")
return x
def genShadows():
global shadows
global huntstart
global huntbegin
if (hours >= 8 and minutes >= 30 and period == "PM") or (hours <= 6 and period == "AM"):
if huntstart == 0:
huntstart = 1
huntbegin = format.red + format.bold + " " + fetchDialogue("menu", "huntstart") + format.end
if len(shadows) < difficulty * 2:
rand = random.randint(1, 5)
if rand == 1:
roomlist = maps[building]["roomlist"]
rand = random.randint(0, len(roomlist) - 1)
shadows.append(roomlist[rand])
shadowhealth.append(100 * difficulty)
rand = random.randint(0, 3)
if rand == 1:
run = 0
layout = maps[building]["layout"]
while run < len(shadows):
vertical = 0
while vertical <= len(layout) and shadows[run] not in layout[vertical]:
if shadows[run] in layout[vertical]:
horizontal = layout[vertical].index(shadows[run])
shadowdirections = []
if layout[vertical - 1][horizontal] == "open":
shadowdirections.append("up")
if layout[vertical + 1][horizontal] == "open":
shadowdirections.append("down")
if layout[vertical][horizontal - 1] == "open":
shadowdirections.append("left")
if layout[vertical][horizontal + 1] == "open":
shadowdirections.append("right")
if len(shadowdirections) > 0:
dir = random.randint(0, (len(shadowdirections) - 1))
print("dir: " + str(dir))
print(shadowdirections)
print(str(run) + "/" + str(len(shadows)))
time.sleep(1)
if shadowdirections[dir] == "up":
vertical = vertical - 2
shadows[run] = layout[vertical][horizontal]
if shadowdirections[dir] == "down":
vertical = vertical + 2
shadows[run] = layout[vertical][horizontal]
if shadowdirections[dir] == "left":
horizontal = horizontal - 2
shadows[run] = layout[vertical][horizontal]
if shadowdirections[dir] == "right":
horizontal = horizontal + 2
shadows[run] = layout[vertical][horizontal]
else:
vertical = vertical + 1
run = run + 1
def checkHealth():
global headHealth
global torsoHealth
global leftArmHealth
global rightArmHealth
global leftLegHealth
global rightLegHealth
global sanity
actions = ""
if headHealth <= 0:
death("head")
if torsoHealth <= 0:
death("torso")
if leftArmHealth <= 0:
actions = actions + "\n " + format.red + format.bold + "You wince in pain. Your left arm is crippled." + format.end
if rightArmHealth <= 0:
actions = actions + "\n " + format.red + format.bold + "You wince in pain. Your right arm is crippled." + format.end
if leftLegHealth <= 0:
actions = actions + "\n " + format.red + format.bold + "You wince in pain. Your left leg is crippled." + format.end
if rightLegHealth <= 0:
actions = actions + "\n " + format.red + format.bold + "You wince in pain. Your right leg is crippled." + format.end
if headHealth + 1 <= 50:
headHealth = headHealth + 1
if torsoHealth + 1 <= 100:
torsoHealth = torsoHealth + 1
if leftArmHealth + 1 <= 75:
leftArmHealth = leftArmHealth + 1
if rightArmHealth + 1 <= 75:
rightArmHealth = rightArmHealth + 1
if leftLegHealth + 1 <= 75:
leftLegHealth = leftLegHealth + 1
if rightLegHealth + 1 <= 75:
rightLegHealth = rightLegHealth + 1
if sanity + 1 <= 100:
sanity = sanity + 1
return actions
def fetchDialogue(speaker, prompt):
return dialogue[speaker][prompt][str(random.randint(1, dialogue[speaker][prompt]["number"]))]
def cutsceneDialogue(message, indent, delay):
y = 0
while y < indent:
print(" ", end = "")
y = y + 1
y = 0
print("\"", end = "")
while y < len(message):
print(message[y : y + 1], end = "")
if y < len(message) - 1:
time.sleep(delay)
y = y + 1
print("\"")
def cutsceneOther(message, indent, delay):
y = 0
while y < indent:
print(" ", end = "")
y = y + 1
y = 0
while y < len(message):
print(message[y : y + 1], end = "")
time.sleep(delay)
y = y + 1
print("")
def death(target):
print(format.clear)
cutsceneOther(format.red + format.bold + "The shadow hits you in the " + target + "." + format.end, 2, 0.05)
time.sleep(1)
cutsceneDialogue(fetchDialogue("player", "attacked"), 2, 0.05)
time.sleep(3)
cutsceneOther(format.red + format.bold + "You die." + format.end, 2, 0.05)
time.sleep(3)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
time.sleep(1)
playerDecision = ask("Return to the menu, or watch the ending cutscenes?", 2, ["Watch cutscenes", "Return to menu"], 0.25)
if playerDecision == 2:
mainMenu()
else:
print(format.clear)
time.sleep(3)
cutsceneOther("March " + str(6 + day) + ", 2013", 2, 0.05)
cutsceneOther("Bell ridge police department", 2, 0.05)
cutsceneOther("-------------------------------", 2, 0.01)
time.sleep(2)
cutsceneOther("Police recovered a body from the Marshall residence at approximately", 2, 0.05)
cutsceneOther("9:14 am. Victim had taken numerous blunt attacks throughout the", 2, 0.05)
cutsceneOther("body, but postmortem examination has revealed that the immediate", 2, 0.05)
cutsceneOther("cause of death was due to extensive damage to the " + target + " area.", 2, 0.05)
cutsceneOther("-------------------------------", 2, 0.01)
time.sleep(2)
cutsceneOther("Current theories in the case include possible home invasion", 2, 0.05)
cutsceneOther("with the intent of homicide.", 2, 0.05)
time.sleep(3)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
time.sleep(2)
cutsceneDialogue("It wasn't your fault, Lindsay.", 2, 0.05)
time.sleep(3)
print(format.clear)
apartment = """
──────═══─────┐
i │
─┐ │
┌─┐ ║ u│ │
│ │ ║ ▓│ │
└─┘ ─┘ │"""
print(apartment)
print("\n " + format.bold + "Vanessa" + format.end + ", friend\n Apartment, 8:54am")
print("")
time.sleep(0.5)
cutsceneDialogue("It really wasn't.", 2, 0.05)
time.sleep(0.5)
cutsceneDialogue("I don't know why you're blaming yourself for this.", 2, 0.05)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
print(apartment)
print("\n " + format.bold + "Lindsay" + format.end + ", caretaker\n Apartment, 8:55am")
print("")
cutsceneDialogue("Oh god, I was the last one to see him though!", 2, 0.05)
time.sleep(0.5)
cutsceneDialogue("What if he knew something was wrong?", 2, 0.05)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
print(apartment)
print("\n " + format.bold + "Vanessa" + format.end + ", friend\n Apartment, 8:55am")
print("")
cutsceneDialogue("My god. Stop blaming yourself.", 2, 0.05)
time.sleep(0.5)
cutsceneDialogue("If he knew something was wrong, he'd have gone and said it.", 2, 0.05)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
print(apartment)
print("\n " + format.bold + "Vanessa" + format.end + ", friend\n Apartment, 8:55am")
print("")
cutsceneDialogue("We both knew him, you know.", 2, 0.05)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
print(apartment)
print("\n " + format.bold + "Vanessa" + format.end + ", friend\n Apartment, 8:56am")
print("")
cutsceneDialogue("Look, even if he knew, it still wouldn't be your fault.", 2, 0.05)
time.sleep(1)
cutsceneDialogue("It'd still be the fault of the bastard that killed him.", 2, 0.05)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
print(apartment)
print("\n " + format.bold + "Lindsay" + format.end + ", caretaker\n Apartment, 8:57am")
print("")
cutsceneDialogue("God...", 2, 0.05)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
print(apartment)
print("\n " + format.bold + "Vanessa" + format.end + ", friend\n Apartment, 8:57am")
print("")
cutsceneDialogue("We gotta get to the meeting with the police on this though.", 2, 0.05)
time.sleep(0.5)
cutsceneDialogue("C'mon. We'll get through this. We'll find the bastard.", 2, 0.05)
time.sleep(3)
print(format.clear)
time.sleep(3)
cutsceneDialogue("We'll find em.", 2, 0.05)
time.sleep(4)
print(format.clear)
time.sleep(0.5)
input("\n Press " + format.bold + "enter" + format.end + " to return to the menu. ")
mainMenu()
def mainMenu():
print(format.clear)
print(format.bold + format.red)
print(" __ ______ ______ ______")
print(" / / / __ / / ____/ /_ __/")
print(" / / / /_/ / / /___ / /")
print(" / / / __ / /___ / / /")
print(" / /___ / / / / ____/ / / /")
print(" /_____/ /_/ /_/ /_____/ /_/")
print("")
print(" ___ __ ______ _____ __ __ ______")
print(" / | / / /_ __/ / ___/ / / / / /_ __/")
print(" / /| | / / / / / / / /_/ / / /")
print(" / / | | / / / / / / __ / __ / / /")
print(" / / | |/ / __/ /_ / /_/ / / / / / / /")
print(" /_/ |___/ /_____/ /_____/ /_/ /_/ /_/")
print("")
print(" ______ ___ __")
print(" / __ / / | / /")
print(" / / / / / /| | / /")
print(" / / / / / / | | / /")
print(" / /_/ / / / | |/ /")
print(" /_____/ /_/ |___/")
print("")
print(" ______ ______ ______ ______ __ __")
print(" / ____/ / __ / / __ / /_ __/ / / / /")
print(" / /___ / /_/ / / /_/ / / / / /_/ /")
print(" / ____/ / __ / / __ / / / / __ /")
print(" / /___ / / / / / / | | / / / / / /")
print(" /_____/ /_/ /_/ /_/ |_| /_/ /_/ /_/")
print(format.end)
playerDecision = ask("v0.0.1 PRE-RELEASE \n" + " " + format.italic + format.dim + fetchDialogue("menu", "splashtext") + format.end + "\n", 2, ["Start new game", "Load Game (Nothing actually saves, sorry)", "Tutorial (Currently not functioning)", "Demo content (Not much here)", "Exit"], 0.25)
if playerDecision == 1:
startGame()
if playerDecision == 2:
loadGame()
if playerDecision == 3:
tutorial()
if playerDecision == 4:
demoContent()
if playerDecision == 5:
exit()
def startGame():
global difficulty
time.sleep(1)
print(format.clear)
time.sleep(2)
cutsceneDialogue("So your appointment with the doctor is next week.", 2, 0.03)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
cutsceneDialogue("I actually need to go, it's getting late.", 2, 0.03)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
print(" ")
print(" # # ")
print(" # # ")
print(" # # ")
print(" # u # ")
print(" ────── ─────┬")
print(" o │")
print(" ")
print("\n " + format.bold + "Lindsay" + format.end + ", caretaker\n Living room, 7:02pm\n ")
time.sleep(2)
cutsceneDialogue("So uh, I'll see you soon.", 2, 0.03)
time.sleep(1)
print("")
cutsceneOther(format.italic + format.dim + "For some reason this conversation starts to feel really important.\n" + format.end, 2, 0.03)
time.sleep(1)
playerDecision = ask("", 1, [
"\"Have a good night.\"\n [ Easy difficulty. ]\n - Mild psychosis.\n - Lindsay will return often, and her opinion will be improved. \n",
"\"Alright.\"\n [ Normal difficulty. ]\n - Average psychosis.\n - Lindsay will return sometimes, and her opinion will be average. \n",
"\"...\"\n [ Hard difficulty. ]\n - Severe psychosis.\n - Lindsay will only call, and her opinion will be worsened. \n"], 1)
if playerDecision == 1:
difficulty = 0.5
said = "Have a good night."
nextLine = "You too."
if playerDecision == 2:
difficulty = 1
said = "Alright."
nextLine = "Have a good night."
if playerDecision == 3:
difficulty = 2
said = "..."
nextLine = "Okay, jeez, fine. Don't talk. I'll be seein' ya."
print(format.clear)
print(" ", end = "")
cutsceneDialogue(said, 0, 0.03)
time.sleep(2)
print(" ")
print(" # # ")
print(" # u # ")
print(" # # ")
print(" # # ")
print(" ────── ─────┬")
print(" o │")
print(" ")
print("\n " + format.bold + "Lindsay" + format.end + ", caretaker\n Living room, 7:03pm\n ")
cutsceneDialogue(nextLine, 2, 0.03)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
print(" # # ")
print(" # # ")
print(" # # ")
print(" # # ")
print(" ────── ─────┬")
print(" o │")
print(" ")
print("\n Living room, 7:03pm")
time.sleep(2)
print(format.clear)
print(" # # ")
print(" # # ")
print(" # # ")
print(" # # ")
print(" ──────═══─────┬")
print(" o │")
print(" ")
print("\n Living room, 7:03pm")
time.sleep(2.71828)
print(format.clear)
print(" # # ")
print(" # # ")
print(" # # ")
print(" ──────═══─────┬")
print(" * * │")
print(" ─┐ o │")
print(" ")
print("\n Living room, 7:03pm")
time.sleep(0.75)
print(format.clear)
print(" # # ")
print(" # # ")
print(" ──────═══─────┬")
print(" * ** * │")
print(" ─┐ │")
print(" ║ ▓│ o │")
print(" ")
print("\n Living room, 7:03pm")
time.sleep(0.75)
print(format.clear)
print(" # # ")
print(" ──────═══─────┬")
print(" * *** ** │")
print(" ─┐ * * │")
print(" ║ ▓│ * │")
print(" ║ ▓│ o │")
print(" ")
print("\n Living room, 7:03pm")
time.sleep(0.75)
print(format.clear)
print(" ──────═══─────┬")
print(" ******** │")
print(" ─┐ ***** │")
print(" ║ ▓│ ** │")
print(" ║ ▓│ │")
print(" ─┘ o │")
print(" ")
print("\n Living room, 7:03pm")
time.sleep(3)
print(format.clear)
time.sleep(1)
print(" ┌─────┐ ┌─┐ ┌─┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐ ┌─┐")
print(" │ ┌───┘ │ │ │ │ │ ┌─┐ │ │ ┌─┐ │ └─┐ ┌─┘ │ ┌───┘ │ ┌─┐ │ │ │")
print(" │ │ │ └─┘ │ │ └─┘ │ │ └─┘ │ │ │ │ └───┐ │ └─┘ │ │ │")
print(" │ │ │ ┌─┐ │ │ ┌─┐ │ │ ┌───┘ │ │ │ ┌───┘ │ ┌┐ ┌┘ │ │")
print(" │ └───┐ │ │ │ │ │ │ │ │ │ │ │ │ │ └───┐ │ ││ │ │ │")
print(" └─────┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─┘ └─────┘ └─┘└─┘ └─┘")
time.sleep(1)
cutsceneOther("WHISPERS", 2, 0.03)
time.sleep(1)
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
cutsceneOther("A game by " + format.dim + format.bold + "Those Who Wander studios" + format.end, 2, 0.05)
time.sleep(0.5)
print("")
cutsceneOther("With design and story help from members of " + format.dim + format.bold + "SEXOOOOOO" + format.end + ", " + format.dim + format.bold + "KRINK" + format.end + ", and " + format.dim + format.bold + "Union" + format.end, 2, 0.05)
time.sleep(0.5)
print("")
cutsceneOther(format.bold + "Thanks to all of those who have motivated me to work on this project." + format.end, 2, 0.05)
print("")
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
print(format.clear)
time.sleep(1)
defineVariables()
startNew()
def loadGame():
global difficulty
#Placeholder, planned to be implemented
print(format.clear)
print(" This is planned to be implemented. Progress is not saved,")
print(" but I can jump you right to gameplay if you want.")
playerDecision = ask("", 3, ["Yes", "No"], 0.05)
if playerDecision == 1:
defineVariables()
playerDecision = ask("\nDifficulty selection:\n", 1, [
"Wait for an eternity to have a shadow spawn simulator\n [ Easy difficulty. ]\n - Mild psychosis.\n - Lindsay will return often, and her opinion will be improved. \n",
"Average night in florida simulator\n [ Normal difficulty. ]\n - Average psychosis.\n - Lindsay will return sometimes, and her opinion will be average. \n",
"SCHIZOOOOOO\n [ Hard difficulty. ]\n - Severe psychosis.\n - Lindsay will only call, and her opinion will be worsened. \n"], 0.25)
if playerDecision == 1:
difficulty = 0.5
if playerDecision == 2:
difficulty = 1
if playerDecision == 3:
difficulty = 2
print(format.clear)
startNew()
if playerDecision == 2:
mainMenu()
def startNew():
global room
global side
room = "livingroom"
side = 1
updateTime()
printMap(fetchDialogue("player", "wayblocked"))
def printMap(dialogue="", action=""):
global huntstart
genShadows()
print(format.clear)
shadowin = ""
if room in shadows:
shadowin = "s"
if checkHealth() != "":
action = action + checkHealth()
print(maps[building][room]["side" + str(side)]["1" + shadowin])
print(maps[building][room]["side" + str(side)]["2" + shadowin])
print(maps[building][room]["side" + str(side)]["3" + shadowin])
print(maps[building][room]["side" + str(side)]["4" + shadowin])
print(maps[building][room]["side" + str(side)]["5" + shadowin])
print(maps[building][room]["side" + str(side)]["6" + shadowin])
print("\n " + maps[building][room]["name"] + ", " + str(hours) + ":" + minutesstr + " " + period)
if huntstart == 1:
print(huntbegin)
huntstart = 2
if action != "":
print(" " + format.italic + action + format.end)
if dialogue != "":
print(" \"" + dialogue + "\"")
actions = ["Move", "Do", "Inventory", "Leave room"]
if room in shadows:
actions.append("Combat")
playerDecision = ask("", 2, actions, 0)
print("")
if playerDecision == 1:
move()
if playerDecision == 2:
do()
if playerDecision == 3:
inv()
if playerDecision == 4:
moveRoom()
if actions[playerDecision - 1] == "Combat":
combat()
def move():
global side
global sanity
if side == 2:
side = 1
else:
side = 2
x = random.randint(1, 6)
if x == 1:
updateTime(10)
said = ""
action = ""
if shadows != []:
rand = random.randint(1, int(5 / difficulty))
if rand == 1:
heard = fetchDialogue("shadow", "sound")
rand = random.randint(0, len(shadows) - 1)
location = maps[building][shadows[rand]]["name"]
said = fetchDialogue("player", "heard")
action = "You hear " + heard + " coming from the " + location + "."
sanity = sanity - random.randint(0, 5)
printMap(said, action)
def do():
playerDecision = ask("Action menu:", 2, ["Loot area", "Check self", "Exit menu"], 0.1)
if playerDecision == 1:
loot()
if playerDecision == 2:
checkSelf()
if playerDecision == 3:
printMap(fetchDialogue("player", "nevermind"))
def loot():
global inventoryIDs
interactable = maps[building][room]["side" + str(side)]["interactable"]
if interactable != [] and len(inventory) <= 10:
print(format.clear)
playerDecision = ask("Loot menu:", 2, interactable, 0.1)
if interactable[playerDecision - 1] + room in looted:
printMap("", "You already looted this object!")
else:
pool = lootpool[interactable[playerDecision - 1]]["loot"]
loot = pool[random.randint(0, len(pool) - 1)]
inventoryIDs.append(loot)
inventory.append(items[loot]["name"])
inventoryDurability.append(items[loot]["durability"])
if lootpool[interactable[playerDecision - 1]]["reloot"] == "no":
looted.append(interactable[playerDecision - 1] + room)
updateTime(random.randint(2, 5) * 10)
printMap("", "You looted a " + items[loot]["name"] + " from the " + interactable[playerDecision - 1] + ".")
else:
if maps[building][room]["side" + str(side)]["interactable"] == []:
printMap("", "No places to loot!")
else:
printMap("", "No space for loot!")
def checkSelf():
print(format.clear)
cutsceneOther("Self check:", 2, 0.05)
print("")
print(" Head: " + format.red + str(headHealth) + format.end + "/50")
print(" Left arm: " + str(leftArmHealth) + "/75")
print(" Right arm: " + str(rightArmHealth) + "/75")
print(" Torso: " + format.red + str(torsoHealth) + format.end + "/100")
print(" Left leg: " + str(leftLegHealth) + "/75")
print(" Right leg: " + str(rightLegHealth) + "/75")
print(" Sanity: " + str(sanity) + "/100")
print("")
print(" Items printed in " + format.red + "red" + format.end + " are vital parts.")
input("\n Press " + format.bold + "enter" + format.end + " to continue. ")
printMap()
def inv():
global inventory
global inventoryIDs
global inventoryDurability
global equipped
global equippedDurability
global sanity
print(format.clear)
if equipped != "None":
print(" Equipped: " + items[equipped]["name"])
print(" Damage: " + format.red + str(items[equipped]["damage"]) + format.end)
print(" Durability: " + format.green + str(equippedDurability) + format.end + "/" + format.blue + str(items[equipped]["durability"]) + format.end)
else:
print(" Equipped: None")
print("")
if inventory == []:
cutsceneOther("Nothing in pockets!", 2, 0.01)
input("\n Press " + format.bold + "enter" + format.end + " to exit menu. ")
printMap()
else:
displayInventory = inventory
playerDecision = ask("Inventory:", 2, displayInventory, 0.1)
if displayInventory[playerDecision - 1] == "Exit menu":
printMap()
else:
item = items[inventoryIDs[playerDecision - 1]]
temp = playerDecision - 1
said = ""
action = ""
print("")
cutsceneOther(format.bold + item["name"] + format.end, 2, 0.01)
print(" Damage: " + format.red + str(item["damage"]) + format.end)
print(" Durability: " + format.green + str(inventoryDurability[playerDecision - 1]) + format.end + "/" + format.blue + str(item["durability"]) + format.end)
print(" " + item["1"])
print(" " + item["2"])
print(" " + item["3"])
print(" " + item["4"])
print(" " + item["5"])
print("")
playerDecision = ask("Item options:", 1, ["Equip item", "Drop item", "Exit menu"], 0.1)
if playerDecision == 1:
if equipped != "None":
inventory.append(items[equipped]["name"])
inventoryIDs.append(equipped)
inventoryDurability.append(equippedDurability)
equipped = inventoryIDs[temp]
equippedDurability = inventoryDurability[temp]
action = items[equipped]["name"] + " equipped."
if items[equipped]["type"] == "melee":
said = fetchDialogue("player", "meleeweapongained")
if items[equipped]["type"] == "ranged":
said = fetchDialogue("player", "rangedweapongained")
inventory.pop(temp)
inventoryIDs.pop(temp)
inventoryDurability.pop(temp)
if playerDecision == 2:
action = "You drop the " + inventory[temp]
inventory.pop(temp)
inventoryIDs.pop(temp)
inventoryDurability.pop(temp)
if playerDecision == 3:
printMap(fetchDialogue("player", "nevermind"))
if shadows != []:
rand = random.randint(1, int(5 / difficulty))
if rand == 1:
heard = fetchDialogue("shadow", "sound")
rand = random.randint(0, len(shadows) - 1)
location = maps[building][shadows[rand]]["name"]
said = fetchDialogue("player", "heard")
action = "You hear " + heard + " coming from the " + location + "."
sanity = sanity - random.randint(0, 5)
printMap(said, action)
def moveRoom():
global x
global y
global room
global sanity
layout = maps[building]["layout"]
movement = []
if layout[y][x + 1] == "open":
movement.append("Right")
if layout[y][x - 1] == "open":
movement.append("Left")
if layout[y + 1][x] == "open":
movement.append("Down")
if layout[y - 1][x] == "open":
movement.append("Up")
movement.append("Stay in room")
playerDecision = ask("Movement menu:", 2, movement, 0.1)
if movement[playerDecision - 1] == 'Right':
x = x + 2
if movement[playerDecision - 1] == 'Left':
x = x - 2
if movement[playerDecision - 1] == 'Down':
y = y + 2
if movement[playerDecision - 1] == 'Up':
y = y - 2
room = layout[y][x]
run = random.randint(1, 6)
if run == 1:
updateTime(10)
if movement[playerDecision - 1] == "Stay in room":
printMap(fetchDialogue("player", "nevermind"))
else:
if room in shadows:
print(format.clear)
print(maps[building][room]["side" + str(side)]["1s"])
print(maps[building][room]["side" + str(side)]["2s"])
print(maps[building][room]["side" + str(side)]["3s"])
print(maps[building][room]["side" + str(side)]["4s"])
print(maps[building][room]["side" + str(side)]["5s"])
print(maps[building][room]["side" + str(side)]["6s"])
print("\n " + maps[building][room]["name"] + ", " + str(hours) + ":" + minutesstr + " " + period)
print(" \"" + fetchDialogue("player", "saw") + "\"")
print("")
combat()
else:
said = ""
action = ""
if shadows != []:
rand = random.randint(1, int(5 / difficulty))
if rand == 1:
heard = fetchDialogue("shadow", "sound")
rand = random.randint(0, len(shadows) - 1)
location = maps[building][shadows[rand]]["name"]
said = fetchDialogue("player", "heard")
action = "You hear " + heard + " coming from the " + location + "."
sanity = sanity - random.randint(0, 5)
printMap(said, action)
def combat():
global headHealth
global torsoHealth
global leftArmHealth
global rightArmHealth
global leftLegHealth
global rightLegHealth
global equipped
global equippedDurability
global shadows
global shadowhealth
playerDecision = ask("Combat menu:", 2, ["Attack", "Block", "Dodge", "Exit menu"], 0.1)
print("")
if playerDecision == 1:
updateTime(random.randint(1, 4) * 10)
said = ""
roll = random.randint(1, 10)
currentshadow = shadows.index(room)
if roll != 10:
rand = random.randint(1,3)
if rand == 3:
said = fetchDialogue("player", "attacking")
if equipped != "None":
shadowhealth[currentshadow] = shadowhealth[currentshadow] - items[equipped]["damage"]
equippedDurability = equippedDurability - 1
action = (format.blue + items[equipped]["attack"] + "shadow." + format.end)
if equippedDurability == 0:
action = action + "\n " + format.red + format.bold + items[equipped]["break"] + format.end
equipped = "None"
else:
shadowhealth[currentshadow] = shadowhealth[currentshadow] - 1
rand = random.randint(1,3)
if rand == 3:
said = fetchDialogue("player", "attacking")
rand = random.randint(1,2)
if rand == 1:
leftArmHealth = leftArmHealth - 1
else:
rightArmHealth = rightArmHealth - 1
action = "You punch the shadow."
action = action + enemyHit()
action = action + "\n " + format.green + "Your hit connects." + format.end
else:
rand = random.randint(1,5)
if rand == 3:
said = fetchDialogue("player", "attackmissed")
if equipped != "None":
action = (format.blue + items[equipped]["attack"] + "shadow." + format.end)
else:
action = (format.blue + "You swing at the shadow with your fists." + format.end)
action = action + enemyHit()
action = action + format.red + format.bold + "\n Attack missed!" + format.end
if equipped != "None":
if items[equipped]["faildamage"] == "yes":
equippedDurability = equippedDurability - 1
if shadowhealth[currentshadow] <= 0:
action = action + "\n " + format.green + format.bold + "The shadow dies." + format.end
shadows.pop(currentshadow)
shadowhealth.pop(currentshadow)
printMap(said, action)
if playerDecision == 2:
updateTime(random.randint(1, 4) * 10)
rand = random.randint(1, 3)
said = ""
action = ""
if rand != 1:
if equipped != "None":
action = format.blue + "You brace for the next hit with your " + items[equipped]["name"] + "." + format.end
block = 25
else:
action = format.blue + "You brace for the next hit." + format.end
block = 20
said = fetchDialogue("player", "successfulblock")
else:
action = format.red + format.bold + "You fail to block the hit in time!" + format.end
said = fetchDialogue("player", "failedblock")
block = 0
action = action + enemyHit(block)
printMap(said, action)
if playerDecision == 3:
updateTime(random.randint(1, 4) * 10)
rand = random.randint(1, 5)
if rand <= 2:
action = format.blue + "You jump out of the way." + format.end
else:
action = format.red + format.bold + "You attempt to jump out of the way, but fail." + format.end
action = action + enemyHit(10)
printMap("", action)
if playerDecision == 4:
printMap(fetchDialogue("player", "nevermind"))
def enemyHit(block = 0):
global headHealth
global torsoHealth
global leftArmHealth
global rightArmHealth
global leftLegHealth
global rightLegHealth
global sanity
target = random.randint(1, 6)
damage = random.randint(0, 25)
sanity = sanity - random.randint(0,5)
if target == 1:
headHealth = (headHealth + block) - damage
target = "head"
if target == 2:
torsoHealth = (torsoHealth + block) - damage
target = "torso"
if target == 3:
leftArmHealth = (leftArmHealth + block) - damage
target = "left arm"
if target == 4:
rightArmHealth = (rightArmHealth + block) - damage
target = "right arm"
if target == 5:
leftLegHealth = (leftLegHealth + block) - damage
target = "left leg"
if target == 6:
rightLegHealth = (rightLegHealth + block) - damage
target = "right leg"
return format.red + format.bold + "\n The shadow hits you in the " + target + "." + format.end
def tutorial():
print(format.clear)
time.sleep(1)
cutsceneOther(format.bold + "Welcome to the Last Night On Earth tutorial!" + format.end, 2, 0.05)
time.sleep(1)