-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDungeonCli.py
More file actions
1485 lines (1189 loc) · 47.9 KB
/
DungeonCli.py
File metadata and controls
1485 lines (1189 loc) · 47.9 KB
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
# NOTE: JOIN THE DISCORD: https://discord.gg/eAUqKKe
# DungeonCli is a terminal based program where you get to explore places and
# earn coins. You can spend those coins on various items, have fun!
# Import Libraries here:
#from __future__ import print_function, unicode_literals
#from __future__ import print_function
from colorama import Fore, Back, Style# type: ignore
from PyInquirer import prompt, print_json # type: ignore
import threading
import time
import random
import os
import sys
from src import richPrecense
from src import multiplayer
from Game.Engine import *
import Game.Enemies as Enemies
from Game.Scenes import *
import Game.Scenes as Scenes
# What??? this import fixed my error???
from Game.Engine import DGSave
from Game.Engine import DGUpdate
from sys import stdout
from threading import Lock
# import multiprocessing # DANIEL YOU CUNK :) PLS USE THREADS!!
# ONCE I FIGURE OUT HOW TO END THREADS, XENTHIO!
# You know how hard it is?
# YES I NEEDED TO DO THE SAME THING! BUT YOU KNOW THREADS END AFTER THE FUNCTION FINISHES, RIGHT?
# I CAN'T MAKE A BUILD UNTIL YOU SWITCH TO THREADS...
# I KNOW THAT A THREAD ENDS WHEN THE FUNCTION END,
# BUT I CAN'T END A PLAYSOUND() FUNCTION UNTIL IT FINISHES
# ALSO WHY ARE WE TALKING IN CAPS LOCK?
# AND WHY ARE WE USING THIS TO CHAT? Lol.
# IDK BUT KEEP THIS GIANT BLOCK OF TEXT FOR HISTORICAL PURPOSES, OR ATLEAST UNTIL YOU USE THREADS.
from colorama import init # type: ignore
operatingsystem = detect_system()
# TODO: Improve requirements.txt to include all depends
# Simpleaudio requires visual studio on windows?
if not operatingsystem == 'windows':
import readline
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# --------------------------
# | Version! |
# --------------------------
version = "Development Version 0.6.11"
# --------------------------
# Define variables here:
all_processes = []
# Used to prevent cheating:
devPassword = "hackerman"
isDeveloper = False
invalidCommands = 0
mainLoop = 1
tempProgressCommand = ["nil"]
tempFunctionCommand = ["nil"]
def tempFunction():
print("nil")
# TODO: when 'wizardThatWantsToKillYou' is done, add it here
events = ["store", "store", "store", "randomFight", "none", "none", "bombTrap",
"treasure", "treasure", "unknownCrate"]
CSSOptions = [["Matches", 5], ["Basic Healing Potion", 15],
["Copper Armour", 75], ["Iron Armour", 125], ["Stone Sword", 60],
["Iron Sword", 90],
["Advanced Healing Potion", 60], ["Poison Potion", 20],
["Lucky Coin", 550]]
# theCombatHasNotFinished! alsoICanTalkInCamelCaseMakesSenseRight?
hasCombatFinished = "no."
hasSeenAStore = False
# Define classes here:
# Some useful stuff
Scene = DGScene
Scene.description = "The room is dark. You only hear the droplets of water in the distance."
class quest:
quests = []
def add(newQuest):
quest.quests.append(newQuest)
def list():
if len(quest.quests) < 1:
printScan(DGText.error + "You don't have any quests so far")
else:
DGText.printScan(DGText.success + "Your current quests:")
for theQuest in quest.quests:
DGText.printScan(Style.BRIGHT + Fore.CYAN + theQuest)
print(Style.RESET_ALL)
# TODO: Make printspeed configurable by user
printspeed = 0.013
defprntspd = 0.013
def callScene(scene):
global tempFunctionCommand
global tempProgressCommand
global tempFunction
print("calling scene")
tempProgressCommand = scene.tempProgressCommand
tempFunctionCommand = scene.tempFunctionCommand
Scene.description = scene.description
def tempFunction():
scene.tempFunction()
scene.startScene()
# Unused function?
def initRandomRoom():
global DGDialog
# Not my code but what I think it does is
# has a 50% chance of placing coins in the room.
# Also, there would be a 1 in 10 chance of the room not being lit
global Scene
a = random.randint(1,2)
Scene.description = DGDialog.randomDialog.roomDescription()
if a == 2:
Scene.hasCoins == True
Scene.description == Scene.description + " " + DGDialog.randomDialog.coinsOnFloor()
b = random.randint(1,10)
if b == 2:
Scene.surroundingsLit == False
def invalidCommand():
global invalidCommands
invalidCommands = invalidCommands + 1
DGText.printScan(DGText.error + "Invalid command! \n")
if invalidCommands > 3:
DGText.printScan(hint + "if you're stuck on how to progress, simply type 's')\n"
+ Style.RESET_ALL)
invalidCommands = 0
def useBrick(): # temp function called when in a specific room
global Scene
if Scene.current == 8:
DGText.printScan(DGText.action + "You pull out the brick however, quickly drop it as a massive spider lay on it.")
time.sleep(0.7)
DGText.printScan("You hear a latch go *click!* and the sound of Bricks on Bricks"
" fill the room... A massive door lays upon your sight.\n")
time.sleep(1)
Scene.description = "A massive door is upon your sight. You should probably check it out"
Scene.canProgress = True
else:
DGText.printScan(DGText.error + "There are no bricks nearby!\n")
def passwordPrompt():
global isDeveloper
if isDeveloper is False:
DGText.printScan(Style.BRIGHT + Fore.YELLOW + "This is a developer command!"
" Please input the developer password!" + Style.RESET_ALL)
questions = [
{
'type': 'password',
'message': 'Enter the Developer password',
'name': 'password'
}
]
answers = prompt(questions)
userInput = answers['password']
if userInput == devPassword:
isDeveloper = True
DGText.printScan(DGText.success + "Access granted!\n" + Style.RESET_ALL)
return "granted"
else:
DGText.printScan(rip + "Incorrect password!\n")
return "denied"
else:
# yes, the print is on purpose
print(DGText.success + "Developer mode granted." + Style.RESET_ALL)
return "granted"
def removeFromList(list, removal):
index = 0
listLoop = True
while listLoop:
if list[index] == removal:
modifiedList = list
modifiedList.pop(index)
return modifiedList
listLoop = False
else:
index = index + 1
def ask(funcQuestion, answer1, answer2):
askLoop = 1
while askLoop == 1:
# Asks the user a question
userInput = input(question + "{funcQuestion} [{answer1}/{answer2}] "
.format(funcQuestion=funcQuestion, answer1=answer1, answer2=answer2)
+ Style.RESET_ALL)
# Checks if it's correct
if userInput == answer1:
askLoop = 0
DGText.printScan("")
return answer1
elif userInput == answer2:
askLoop = 0
DGText.printScan("")
return answer2
else:
DGText.printScan(error + "Answer must be either "
"{answer1} or {answer2}!\n".format(answer1=answer1, answer2=answer2))
def bombTrapScene():
global Scene
global DGDialog
Scene.description = "The walls are charred, the room is full of smoke. You probably should get out of here."
DGMain.playSound("Sounds/explosion.ogg", False)
DGText.printScan(rip + "BANG!")
time.sleep(1)
DGText.printScan(DGDialog.randomDialog.bombExplodes())
DGPlayer.damage(random.randint(5, 15) * DGPlayer.Inventory.absorbtion)
time.sleep(1)
# Commands used
def bossBattle():
global Scene
global DGText
endThreads()
DGClear()
DGMain.playSound("Music/finalbossintro.ogg", True)
DGText.printspeed = 0.05
DGText.printScan(action + "The door behind you closes. There is no escape.")
time.sleep(2)
DGText.printScan(quote + "I've been expecting you. Any last words?\"\n")
time.sleep(2)
DGText.printScan(quote + "Nothing eh? You're too weak to defeat me,"
" and there's nothing that can stop me.\"\n")
DGText.printspeed = 0.65
print(Style.BRIGHT + Fore.WHITE)
DGText.printScan("\"goodbye.\"\n")
DGText.printspeed = 0.013
time.sleep(1.5)
endThreads()
DGMain.playSound("Music/finalboss.ogg", True)
Scene.combatOverrideMusic = False
bossLoop = True
while bossLoop == True:
theResult = DGCombat.combat("Boss", 25000, 1000, 1500)
if theResult == "killed":
bossSuccess()
elif theResult == "flee":
DGText.printScan(quote + "You think you can run away from me?\"")
time.sleep(1)
DGText.printScan(quote + "Think again.\"")
time.sleep(1)
endThreads()
DGMain.playSound("Music/finalboss.ogg", True)
def bossSuccess():
global DGText
endThreads()
DGClear()
DGMain.playSound("Music/endCredits.ogg", False)
message = """
__ __ _ _
\ \ / /__ _ _ __ _(_)_ __ | |
\ V / _ \| | | | \ \ /\ / / | '_ \| |
| | (_) | |_| | \ V V /| | | | |_|
|_|\___/ \__,_| \_/\_/ |_|_| |_(_)
"""
DGText.printScan(Fore.GREEN + Style.BRIGHT + message)
DGText.printspeed = 0.020
time.sleep(2.5)
DGText.printScan(Style.BRIGHT + Fore.CYAN + "Once the boss was destroyed,"
" the rebellion was dismantled, letting the town recover!\n" + Style.RESET_ALL)
time.sleep(2.5)
DGText.printspeed = 0.007
creditScreen()
time.sleep(2.5)
DGExit()
def options():
global DGMain
questions = [
{
'type': 'list',
'name': 'selection',
'choices': ['Toggle Music',
'Exit',],
'message': 'What options would you like to toggle?',
}
]
askLoop = 1
while askLoop == 1:
print(Style.RESET_ALL)
answers = prompt(questions)
# DGText.printScan_json(answers)
userInput = answers['selection']
# DGText.printScan(action + "You selected:" + userInput)
if userInput == "Exit":
askLoop = 0
DGText.printScan(action + "You exited the options menu\n")
elif userInput == "Toggle Music":
DGMain.toggleSound()
DGText.printScan("You toggled music to {value}\n".format(value=DGMain.playMusic))
# TODO: Move these into DGPLayer as a player actions class.!
def checkCoins():
global DGPlayer
DGText.printScan(DGText.success + "You have $" + str(DGPlayer.coins) + "!\n")
if DGPlayer.coins == 0:
time.sleep(0.7)
DGText.printScan(Style.BRIGHT + Fore.WHITE + "You have 0 coins? I feel bad, here"
" take 10 coins!")
time.sleep(0.7)
DGMain.addCoins(10)
time.sleep(0.7)
def openStatistics():
DGText.printScan(DGText.success + "Your damage inflicted multipler is {m}x".format(m=DGPlayer.Inventory.damage))
DGText.printScan(DGText.success + "Your damage taken multiplyer is {p}x".format(p=DGPlayer.Inventory.absorbtion))
DGText.printScan(DGText.success + "Your money multiplyer is {p}x\n".format(p=DGPlayer.Inventory.moneyMultiplyer))
def openInventory():
DGText.printScan(DGText.success + "Inventory:")
# moved stats into stats
DGText.printScan(DGText.success + "Type 'stats' for combat statistics.\n")
#DGText.printScan(DGText.success + "Your damage inflicted multipler is {m}x".format(m=DGPlayer.Inventory.damage))
#DGText.printScan(DGText.success + "Your damage taken multiplyer is {p}x".format(p=DGPlayer.Inventory.absorbtion))
#DGText.printScan(DGText.success + "Your money multiplyer is {p}x\n".format(p=DGPlayer.Inventory.moneyMultiplyer))
count = 0
if DGPlayer.Inventory.matches != 0:
DGText.printScan(str(DGPlayer.Inventory.matches) + " x Matches")
if DGPlayer.Inventory.sticks != 0:
DGText.printScan(str(DGPlayer.Inventory.sticks) + " x Sticks")
if DGPlayer.Inventory.basicHealingPotion != 0:
DGText.printScan(str(DGPlayer.Inventory.basicHealingPotion) + " x Basic Healing Potion")
if DGPlayer.Inventory.advancedHealingPotion !=0:
DGText.printScan(str(DGPlayer.Inventory.advancedHealingPotion) + " x Advanced Healing Potion")
if DGPlayer.Inventory.poisonPotion !=0:
DGText.printScan(str(DGPlayer.Inventory.poisonPotion) + " x Poison Healing Potion")
if DGPlayer.Inventory.sword == 1:
DGText.printScan("Wooden Sword")
if DGPlayer.Inventory.sword == 2:
DGText.printScan("Stone Sword")
if DGPlayer.Inventory.sword == 3:
DGText.printScan("Iron Sword")
elif DGPlayer.Inventory.armour == 1:
DGText.printScan("Copper Armour")
elif DGPlayer.Inventory.armour == 2:
DGText.printScan("Iron Armour")
if DGPlayer.Inventory.secretKey == 1:
DGText.printScan("Random Key?")
# This DGText.printScan just adds some white space
DGText.printScan(" ")
def purchase(storeSelected, id):
global DGPlayer
global absorbtion
global damageMultiplyer
item = storeSelected[id][0]
price = storeSelected[id][1]
if DGPlayer.coins >= price:
if item == "Matches":
DGPlayer.Inventory.matches = DGPlayer.Inventory.matches + 1
elif item == "Basic Healing Potion":
DGPlayer.Inventory.basicHealingPotion = DGPlayer.Inventory.basicHealingPotion + 1
elif item == "Advanced Healing Potion":
DGPlayer.Inventory.advancedHealingPotion = DGPlayer.Inventory.advancedHealingPotion + 1
elif item == "Poison Potion":
DGPlayer.Inventory.poisonPotion = DGPlayer.Inventory.poisonPotion + 1
elif item == "Copper Armour":
if DGPlayer.Inventory.armour == 1:
DGText.printScan(error + "You already have this item!\n")
return "bruh"
else:
DGPlayer.Inventory.armour = 1
DGPlayer.Inventory.absorbtion = 0.8
elif item == "Iron Armour":
if DGPlayer.Inventory.armour == 2:
DGText.printScan(error + "You already have this item!\n")
return "bruh"
else:
DGPlayer.Inventory.armour = 2
DGPlayer.Inventory.absorbtion = 0.6
elif item == "Stone Sword":
if DGPlayer.Inventory.sword == 2:
DGText.printScan(error + "You already have this item!\n")
return "bruh"
else:
DGPlayer.Inventory.sword = 2
DGPlayer.Inventory.damage = 1.4
elif item == "Iron Sword":
if DGPlayer.Inventory.sword == 3:
DGText.printScan(error + "You already have this item!\n")
return "bruh"
else:
DGPlayer.Inventory.sword = 3
DGPlayer.Inventory.damage = 1.7
elif item == "Lucky Coin":
if DGPlayer.Inventory.moneyMultiplyer == 2:
DGText.printScan(error + "You already have this item!\n")
return "bruh"
else:
DGPlayer.Inventory.moneyMultiplyer = 2
DGText.printScan(action + "You purchased {item} for {price} coins!\n"
.format(item=item, price=price))
DGPlayer.coins = DGPlayer.coins - price
else:
DGText.printScan(error + "You do not have enough coins to purchase this item!\n")
def openStore():
initStore()
DGText.printScan("You entered the store!")
global CSSOptions
global DGPlayer
global Scene
DGText.printScan("------------------")
DGText.printScan(" STORE ")
DGText.printScan("------------------")
DGText.printScan(DGText.success + "You have $" + str(DGPlayer.coins))
for i in Scene.storeSelected:
DGText.printScan(Fore.WHITE + "{name} -- {price}".format(name=i[0], price=i[1]))
DGText.printScan("")
questions = [
{
'type': 'list',
'name': 'itemChoice',
'choices': [(Scene.storeSelected[0])[0],
(Scene.storeSelected[1])[0],
(Scene.storeSelected[2])[0], 'Check stats', 'Exit'],
'message': 'Which item would you like to purchase?',
}
]
askLoop = 1
while askLoop == 1:
print(Style.RESET_ALL)
answers = prompt(questions)
# DGText.printScan_json(answers)
userInput = answers['itemChoice']
# DGText.printScan(action + "You selected:" + userInput)
if userInput == "Exit":
askLoop = 0
DGText.printScan(action + "You left the store.\n")
elif userInput == "Check stats":
DGMain.hpCheck()
checkCoins()
elif userInput == Scene.storeSelected[0][0]:
purchase(Scene.storeSelected, 0)
elif userInput == Scene.storeSelected[1][0]:
purchase(Scene.storeSelected, 1)
elif userInput == Scene.storeSelected[2][0]:
purchase(Scene.storeSelected, 2)
def useMatch():
global DGPlayer
global surroundingsLit
global Scene
if DGPlayer.Inventory.matches == 0:
DGText.printScan(error + "You don't have any matches!\n")
elif Scene.surroundingsLit == True:
DGPlayer.Inventory.matches = DGPlayer.Inventory.matches - 1
DGMain.playSound("Sounds/matchUse.ogg", False)
time.sleep(0.3)
DGText.printScan("You light a match. it begins to burn away.")
DGText.printScan(rip + "You used up one match. \n")
elif Scene.surroundingsLit == False:
Scene.description = "This place is in ruins, and it's possibly been like that for decades."
DGPlayer.Inventory.matches = DGPlayer.Inventory.matches - 1
Scene.surroundingsLit = True
DGMain.playSound("Sounds/matchUse.ogg", False)
time.sleep(0.3)
DGText.printScan("You Light a match, your surroundings fill up with light. "
"you can now see!")
DGText.printScan(rip + "You used up one match. \n")
if Scene.current == 0:
print("")
time.sleep(1)
nextScene()
def start():
global Scene
global DGPlayer
global DGText
global tempProgressCommand
Scene.storeSelected = []
## GAME SCENES
if Scene.surroundingsLit == False:
Scene.current = 0
DGText.printScan("You are lying down, the cold, wet floor pressed"
" against your face..." + Style.RESET_ALL + "\nWhere are you?\n")
Scene.description = "It's extremely dark and cold \n(however that could be because of your wet clothes), but despite that you can't see a single thing..."
time.sleep(1)
DGText.printScan("You get up, your footsteps echo through out the room. It's extremely dark.")
DGText.printScan(hint + "Check your Inventory, you might have something to improve your vision...)\n" + Style.RESET_ALL)
time.sleep(1)
if DGPlayer.Inventory.matches < 1:
DGText.printScan(rip + "You don't have any matches left!")
time.sleep(1)
DGText.printScan(rip + "There's no way to light this room.")
time.sleep(1)
DGText.printScan(action + "The only thing you can do is proceed to the next room...\n")
Scene.canProgress == True
else:
if Scene.current == 1:
Scene.description = DGDialog.randomDialog.roomDescription()
DGText.printScan(Style.RESET_ALL + "The Light is bright enough to "
"see where you are walking, no walls are nearby.")
DGText.printScan(action + "While being scared, you think it is "
"probably safe enough to \nwander about your surroundings a bit... \n")
tempProgressCommand = ["walk around", "wander", "walk", "wonder"]
elif Scene.current == 2:
Scene.description = "The chest is locked. It is made out of a fine wood material. You question what lies within it."
DGText.printScan("You start to take a small wander and look around.")
time.sleep(0.75)
DGText.printScan("After wandering around for some time, something shiny catches your attention.\n")
time.sleep(0.75)
DGText.printScan(Style.RESET_ALL + "It's a lock, it hangs losely on a chest. It's extremely "
"rusted, \nmuch to the point where the fact that it's shine caught your eye is astounding.\n")
tempProgressCommand = ["break lock", "attempt to open", "open",
"open chest", "unlock", "unlock chest", "pick", "pick lock"]
time.sleep(1)
elif Scene.current == 3:
Scene.description = DGDialog.randomDialog.roomDescription()
DGText.printScan("The lock being so rusted, snaps off without trying. you gently lift up the lid and take what is inside.")
DGText.printScan(success + "You pickup a basic healing potion and"
" a wooden sword.")
endThreads()
DGMain.playSound("Music/intro.ogg", True)
DGPlayer.Inventory.basicHealingPotion = DGPlayer.Inventory.basicHealingPotion + 1
DGPlayer.Inventory.damage = 1.2
DGPlayer.Inventory.sword = 1
time.sleep(2)
# Add a new line
print("")
elif Scene.current == 4:
Scene.description = DGDialog.randomDialog.roomDescription()
DGText.printScan(DGText.action + "You carefully proceed into the next room...")
time.sleep(1)
DGText.printScan(Style.RESET_ALL + "It's completely empty. The water trickling down the wall"
"fills your ears...\n")
time.sleep(1)
DGText.printScan(DGText.rip + "Suddenly, a goblin bursts through"
" the other door!")
time.sleep(0.5)
DGText.printScan(DGText.rip + "There's nothing you can do other than"
" fight!\n")
time.sleep(0.2)
DGCombat.combat("Anomynous Goblin", 20, 3, 5)
elif Scene.current == 5:
Scene.description = "An ancient civilisation, spanning thousands of years. It appears to have ended here."
# TODO: This scene is pretty garbage tbh, too much being introduced
# in a poor way, and that poem is complete garbage.
# todo, fix
DGText.printScan(DGText.action + "You find a small outpost here. There are unknown creatures"
" scattered across the place")
DGText.printScan(Style.RESET_ALL + "The outpost seems to be in ruins,"
" blood scattered across the wall of burned down houses.\n")
time.sleep(1)
DGText.printScan(Style.BRIGHT + Fore.WHITE + "Theres a sign on a dusty wall, it reads,\n")
DGText.printspeed = 0.05
DGText.printScan(DGText.quote +
"It used to be great here,\n"
"But then, the rebellion wiped us clear,\n"
"There's only one way back,\n"
"It's simple yet hard,\n"
"Defeat the guard.\"\n")
DGText.printspeed = 0.013
time.sleep(1)
DGText.printScan(DGText.action + "Suddenly, something scurries down a dug out hole in the ground,"
" slamming a trapdoor shut behind them.")
tempFunctionCommand = ["trapdoor", "open trapdoor", "enter trapdoor", "climb", "climb down"]
# questions = [
# {
# 'type': 'confirm',
# 'name': 'promptChoice',
# 'message': 'Will you climb down the trapdoor?',
# }
# ]
# print(Style.RESET_ALL)
# theAnswer = prompt(questions)
# theSelection = theAnswer['promptChoice']
def tempFunction():
DGText.printScan(DGText.success + "You climb down onto the trapdoor."
" Once you reach the bottom, you found a key!")
DGText.printScan(DGText.action + "You don't know what this key is for,"
" but you take it anyway.\n")
DGPlayer.Inventory.secretKey = 1
time.sleep(2)
DGText.printScan(Style.RESET_ALL + "As you begin to exit the trapdoor...\n")
bombTrapScene()
#else:
#DGText.printScan(DGText.action + "You decide it is too risky and"
#" prepare to move on.\n")
elif Scene.current == 6:
Scene.description = "The faceless figure continues to stare at you."
DGText.printScan(DGText.action + "You open the door. It's a faceless, expresionless figure. Somehow, even with no mouth, it says")
time.sleep(2)
DGText.printScan(DGText.quote + "Install Debian.\"\n")
time.sleep(1)
elif Scene.current == 7:
SceneExample.startScene()
else:
# TODO: Replace random events with actual scenes, leaving this in for now
if len(events) > 0:
randomEvent()
else:
# Multilines in vars are scuffed, I know.
Scene.description = """\
The room is empty. Two chairs lie in the room
A man sits in one, and prompts you to take a seat.
He appears to be the main developer of the game.
"Join the discord server", he says."""
DGText.printScan(DGText.success + "Thanks for testing DungeonCli!" + Fore.WHITE)
DGText.printScan("We haven't finished this scene.")
DGText.printScan("If you want to help us improve, feel free to send a screenshot or video of you")
DGText.printScan("playing the game, at the discord server:")
DGText.printScan(Style.BRIGHT + Fore.BLUE + "https://discord.gg/eAUqKKe\n")
def randomEvent():
global events
global hasSeenAStore
global Scene
global storeSelected
global DGDialog
randomLoop = True
DGText.printScan(action + "You proceed into the next room...\n")
if len(events) > 0:
selection = random.choice(events)
if selection == "store":
DGText.printScan(DGText.action + "You find a small store setup here")
DGText.printScan(DGText.action + "Maybe they'll have something useful here..\n")
Scene.description = Scene.description + " " + DGDialog.randomDialog.store()
questions = [
{
'type': 'confirm',
'name': 'promptChoice',
'message': 'Will you enter the store?',
}
]
print(Style.RESET_ALL)
theAnswer = prompt(questions)
theSelection = theAnswer['promptChoice']
if theSelection is True:
theLuck = random.randint(1, 5)
if theLuck == 1:
DGText.printScan(DGText.action + 'You knock on the door and ask to enter...')
time.sleep(2)
DGText.printScan(DGText.action + "Nobody responds...")
time.sleep(0.8)
DGText.printScan(DGText.action + "As you begin to walk away, you hear a slight hissing sound")
time.sleep(0.8)
DGText.printScan(DGText.rip + "A snake is trying to bite you!\n")
time.sleep(0.8)
DGCombat.combat("Snake", 20, 5, 15)
else:
Scene.hasStore = True
DGText.printScan(DGText.action + 'You knock on the door and ask to enter...')
time.sleep(2)
# DGText.printScan(randomDialog.store(randomDialog))
DGText.printScan(DGText.quote + 'Greetings! This place is in ruins however,'
' I was able to setup a small store from the remains!"')
time.sleep(0.8)
openStore()
else:
DGText.printScan(DGText.action + "This seems too risky... you prepare to leave...\n")
elif selection == "randomFight":
Scene.description = DGDialog.randomDialog.roomDescription()
DGText.printScan(DGText.action + "You hear a movement -- you freeze")
time.sleep(0.6)
DGText.printScan(DGText.action + "Someone is trying to attack you,")
time.sleep(0.6)
DGText.printScan(DGText.action + "It's too late to avoid a fight now!\n")
time.sleep(0.6)
randomEnemy()
elif selection == "none":
Scene.description = "Nothing to see here."
DGText.printScan(action + "You find absolutely nothing in this room...\n")
elif selection == "bombTrap":
# Scene description set in bombTrapScene()
DGText.printScan(action + "It is odly quiet here... you begin to look around... \n")
time.sleep(2)
bombTrapScene()
elif selection == "wizardThatWantsToKillYou":
#TODO: Finish this!
DGText.printScan(DGText.quote + 'You. You have the information you need.\n'
'')
pass
elif selection == "treasure":
DGText.printScan(DGText.action + "A massive Vault stands in this room.")
time.sleep(1)
DGText.printScan(DGText.action + "Something useful might be in it...")
time.sleep(1)
DGText.printScan(DGText.action + "Perhaps you could try break into it...\n")
time.sleep(1)
questions = [
{
'type': 'confirm',
'name': 'promptChoice',
'message': 'Will you try break into the vault?',
}
]
print(Style.RESET_ALL)
theAnswer = prompt(questions)
theDecision = theAnswer['promptChoice']
if theDecision is False:
print("")
DGText.printScan(DGText.action + "You think this is too risky and proceed to move on.\n")
Scene.description = "The vault remains unopen. What lies within nobody will know."
else:
Scene.hasVault = True
openVault()
Scene.hasVault = False
Scene.description = "You wonder whether you are alone. Whether or not someone is watching."
elif selection == "unknownCrate":
global DGPlayer
DGText.printScan(DGText.action + "You find a mysterious crate...")
questions = [
{
'type': 'confirm',
'name': 'promptChoice',
'message': 'Will you open it?',
}
]
print(Style.RESET_ALL)
theAnswer = prompt(questions)
theDecision = theAnswer['promptChoice']
if theDecision is False:
print("")
DGText.printScan(DGText.action + "You think this is too risky and proceed to move on.\n")
Scene.description = "An unknown figure watches you from above. You do not know what to think about this."
else:
areYaLucky = random.randint(1, 5)
if areYaLucky == 1:
Scene.description = "You got what you wanted. But at what cost?"
# You get free loot
lootGoodies = ["Stone sword", "Iron armour"]
chosenGoodies = random.choice(lootGoodies)
DGText.printScan(DGText.success + "You open the chest and find {item}!"
.format(item=chosenGoodies))
if chosenGoodies == "Stone sword":
if DGPlayer.Inventory.sword >= 3:
DGText.printScan(error + "You already have this item!\n")
else:
DGPlayer.Inventory.sword = 3
DGPlayer.Inventory.damage = 1.7
elif chosenGoodies == "Iron armour":
if DGPlayer.Inventory.armour >= 2:
DGText.printScan(error + "You already have this item!\n")
else:
DGPlayer.Inventory.armour = 2
DGPlayer.Inventory.absorbtion = 0.6
elif areYaLucky == 2:
Scene.description = "You got what you wanted. But at what cost?"
# You get free gold
DGText.printScan(DGText.success + "You open the chest and you find free gold!")
DGMain.addCoins(random.randint(100, 120))
elif areYaLucky == 3:
Scene.description = "Perhaps you were trolled. Who set this up, you do not know."
# You get nothing
DGText.printScan(DGText.rip + "You open the chest and find nothing.")
DGText.printScan(DGText.action + "You move on...\n")
else:
# It's a bomb!
DGText.printScan(DGText.action + "You open the chest and find nothing.")
DGText.printScan(DGText.action + "You hear a sound...")
bombTrapScene()
events = removeFromList(events, selection)
else:
DGText.printScan("There are no more unvisited events left!")
def openVault():
if Scene.hasVault == True:
theLuck = random.randint(1, 3)
if theLuck == 1:
DGText.printScan(DGText.action + "You spent several minutes trying to unlock the vault...")
time.sleep(2)
DGText.printScan(DGText.success + "You somehow unlock it!\n")
time.sleep(0.6)
DGText.printScan(DGText.action + "You walk into the vault but you are"
" disappointed as it looks like someone has cleared out"
" all the gold.\n")
time.sleep(1)
elif theLuck == 2:
DGText.printScan(DGText.action + "You spent several minutes trying to unlock the vault...")
time.sleep(2)
DGText.printScan(DGText.success + "You somehow unlock it!\n")
time.sleep(0.6)
DGText.printScan(DGText.success + "You walk into the vault and you find"
" hundreds of coins! You pick up as much as you can...")
DGMain.addCoins(50)
elif theLuck == 3:
DGText.printScan(DGText.action + "You spent several minutes trying to unlock the vault...")
time.sleep(2)
DGText.printScan(DGText.action + "You seem to be out of luck, however"
" you've been spotted!\n")
time.sleep(0.6)
DGText.printScan(DGText.quote + 'YOU! STOP RIGHT THERE! YOU THIEF!"')
DGText.printScan(Style.BRIGHT + "The Money Grinch shouted.\n")
time.sleep(0.6)
DGCombat.combat("Money Grinch", 30, 1, 30)
else:
DGText.printScan("There is no vault in this room...")
def initStore():
global Scene
if not Scene.storeSelected:
storeOptions = CSSOptions.copy()
i = 0
while i < 3:
i += 1
theChosenOne = random.choice(storeOptions)
Scene.storeSelected.append(theChosenOne)
storeOptions = removeFromList(storeOptions, theChosenOne)
def randomEnemy():
# [Name, Health, Enemy Minimum Damage, Enemy Maximum Damage]
# enemyName, enemyHealth, enemyMinDamage, enemyMaxDamage
# names = [["Unidentified", 25, 5, 10], ["Wizard", 40, 10, 20],
# ["Giant Spider", 25, 5, 15], ["Bob", 100, 1, 1]]
enemy = random.choice(Enemies.listCommon)
enemy.startBattle()
#combat(decision[0], decision[1], decision[2], decision[3])
def lookAround():
DGText.printScan(Scene.description + "\n")
def pickCoins():
global Scene
if Scene.hasCoins == True:
amount = random.randint(10, 12)
DGText.printScan(action + DGDialog.randomDialog.collectCoins())
time.sleep(0.8)
DGMain.addCoins(amount)
Scene.hasCoins = False
else:
DGText.printScan(error + "There are no coins to pick up! \n")