neelthee-mansion 3.1.3__py3-none-any.whl → 3.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- neelthee_mansion/Mansion_of_Amnesia.py +104 -40
- neelthee_mansion/Rooms.py +454 -405
- neelthee_mansion/items.py +89 -5
- {neelthee_mansion-3.1.3.dist-info → neelthee_mansion-3.3.0.dist-info}/METADATA +1 -1
- {neelthee_mansion-3.1.3.dist-info → neelthee_mansion-3.3.0.dist-info}/RECORD +8 -8
- {neelthee_mansion-3.1.3.dist-info → neelthee_mansion-3.3.0.dist-info}/WHEEL +0 -0
- {neelthee_mansion-3.1.3.dist-info → neelthee_mansion-3.3.0.dist-info}/entry_points.txt +0 -0
- {neelthee_mansion-3.1.3.dist-info → neelthee_mansion-3.3.0.dist-info}/top_level.txt +0 -0
@@ -15,7 +15,9 @@ GameState = {
|
|
15
15
|
Neel-thee's Mansion of Amnesia
|
16
16
|
'''
|
17
17
|
|
18
|
-
global player, evil_mage, commands, NOTE_NUM, credits, characters, color_coding, quest_manager
|
18
|
+
global player, evil_mage, commands, NOTE_NUM, credits, characters, color_coding, quest_manager, revealer
|
19
|
+
|
20
|
+
revealer = KeyRevealer()
|
19
21
|
|
20
22
|
quest_manager = QuestManager()
|
21
23
|
|
@@ -167,7 +169,7 @@ NOTE_NUM = 0
|
|
167
169
|
|
168
170
|
|
169
171
|
def add_note(note, parchment_index=None):
|
170
|
-
global player
|
172
|
+
global player, NOTE_NUM
|
171
173
|
player.NOTES.append(note)
|
172
174
|
NOTE_NUM += 1
|
173
175
|
inv_note = 'note ' + str(NOTE_NUM)
|
@@ -254,6 +256,31 @@ def Use(moveone, movetwo=None):
|
|
254
256
|
type_text("You can't use that", colorTrue=color_coding)
|
255
257
|
|
256
258
|
|
259
|
+
def PickKey(lock):
|
260
|
+
keys = player.inventory.keys()
|
261
|
+
|
262
|
+
if keys:
|
263
|
+
while True:
|
264
|
+
type_text(f"Please pick which key you want to use in the lock. This is what you know about the lock: {lock}. These are your keys:")
|
265
|
+
|
266
|
+
# Enumerate keys and display them
|
267
|
+
for idx, key in enumerate(keys, 1): # Starts numbering at 1
|
268
|
+
type_text(f"{idx}. {key}")
|
269
|
+
|
270
|
+
# Use loop_til_valid_input to get a valid integer within the correct range
|
271
|
+
choice = loop_til_valid_input(
|
272
|
+
input_text="Enter the number of the key you'd like to use: ",
|
273
|
+
bad_text="That's not a valid choice, please try again.",
|
274
|
+
Class=int # Ensuring input is an integer
|
275
|
+
)
|
276
|
+
|
277
|
+
# Since loop_til_valid_input ensures valid input, just return the selected key
|
278
|
+
if 1 <= choice <= len(keys):
|
279
|
+
return keys[choice - 1] # Fetch the key using 0-based index
|
280
|
+
|
281
|
+
return Key(KeyCode=None)
|
282
|
+
|
283
|
+
|
257
284
|
def Move(move):
|
258
285
|
global player
|
259
286
|
|
@@ -271,45 +298,51 @@ def Move(move):
|
|
271
298
|
|
272
299
|
def attempt_move_to_garden():
|
273
300
|
global player
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
301
|
+
type_text("Please pick whitch key you want to try in the lock on the gate")
|
302
|
+
for key in player.inventory.keys():
|
303
|
+
if key.KeyCode == "629.IdnXwnt":
|
304
|
+
End('You unlock the gate to the garden with the key!')
|
305
|
+
return newRoom
|
306
|
+
type_text('The gate is locked.', colorTrue=color_coding)
|
307
|
+
return newRoom
|
280
308
|
|
281
309
|
def move_to_room():
|
282
310
|
global player
|
283
311
|
player.LASTROOM = player.CURRENTROOM
|
312
|
+
if 'descovered' in ROOMS[newRoom] and not ROOMS[newRoom]['descovered']:
|
313
|
+
ROOMS[newRoom]['descovered'] = True
|
284
314
|
if move == '0':
|
285
315
|
return attempt_charter()
|
286
316
|
elif newRoom == 'Garden':
|
287
|
-
if 'descovered' in ROOMS[newRoom] and not ROOMS[newRoom]['descovered']:
|
288
|
-
ROOMS[newRoom]['descovered'] = True
|
289
317
|
return attempt_move_to_garden()
|
290
318
|
else:
|
291
|
-
if 'descovered' in ROOMS[newRoom] and not ROOMS[newRoom]['descovered']:
|
292
|
-
ROOMS[newRoom]['descovered'] = True
|
293
319
|
return newRoom
|
294
320
|
|
295
321
|
if move in ROOMS[player.CURRENTROOM]['directions']:
|
296
|
-
|
297
|
-
|
322
|
+
if isinstance(ROOMS[player.CURRENTROOM]['directions'][move], Door):
|
323
|
+
if isinstance(ROOMS[player.CURRENTROOM]['directions'][move].lock, Lock):
|
324
|
+
key = PickKey(ROOMS[player.CURRENTROOM]['directions'][move].lock)
|
325
|
+
ROOMS[player.CURRENTROOM]['directions'][move].unlock(key, player)
|
326
|
+
newRoom = ROOMS[player.CURRENTROOM]['directions'][move].GetRoom()
|
327
|
+
newRoom = move_to_room()
|
298
328
|
return
|
299
329
|
elif move in ROOMS:
|
300
330
|
newRoom = move
|
301
331
|
if newRoom == 'Garden':
|
302
|
-
|
303
|
-
else:
|
304
|
-
player.CURRENTROOM = newRoom
|
332
|
+
newRoom = attempt_move_to_garden()
|
305
333
|
player.LASTROOM = player.CURRENTROOM
|
334
|
+
player.CURRENTROOM = newRoom
|
335
|
+
if 'random_events' in ROOMS[player.CURRENTROOM]:
|
336
|
+
for randomEvent in ROOMS[player.CURRENTROOM]['random_events']:
|
337
|
+
if isinstance(randomEvent, RandomEvent):
|
338
|
+
randomEvent.check_and_trigger(player)
|
306
339
|
return
|
307
|
-
type_text("
|
340
|
+
type_text(f"There is no exit {move}", colorTrue=color_coding)
|
308
341
|
|
309
342
|
|
310
343
|
def start():
|
311
344
|
global player
|
312
|
-
#
|
345
|
+
# shows the main menu
|
313
346
|
type_text(f'\nHello %*MAGENTA*%{player.name}%*RESET*% and welcome to my Role Playing Game. \nI hope you have fun!', colorTrue=color_coding)
|
314
347
|
showInstructions()
|
315
348
|
|
@@ -383,10 +416,41 @@ def display_directions(text):
|
|
383
416
|
text += f'\n{direction_descriptions[room_type][direction]} %*GREEN*%{direction}%*RESET*%.'
|
384
417
|
|
385
418
|
if 'teleport' in ROOMS[player.CURRENTROOM]['directions']:
|
386
|
-
text += "\nThere is a %*GREEN*%teleport%*RESET*%ation circle on the ground"
|
419
|
+
text += "\nThere is a %*GREEN*%teleport%*RESET*%ation circle on the ground."
|
387
420
|
|
388
421
|
return text
|
389
422
|
|
423
|
+
def Examin(*Args):
|
424
|
+
Name = ' '.join(Args)
|
425
|
+
if player.inventory.index(Name):
|
426
|
+
_ = player.inventory[player.inventory.index(Name)]
|
427
|
+
if isinstance(_, Key):
|
428
|
+
type_text("You look at your key and you figure out this about it:")
|
429
|
+
revealer.reveal_key_code(_)
|
430
|
+
elif isinstance(_, item):
|
431
|
+
if _.type == 'weapon':
|
432
|
+
type_text(f"This item is a weapon that adds {_.value} damage.")
|
433
|
+
elif Name in ROOMS[player.CURRENTROOM]['directions']:
|
434
|
+
door = ROOMS[player.CURRENTROOM]['directions'][Name]
|
435
|
+
if isinstance(door, Door):
|
436
|
+
if isinstance(door.lock, Lock):
|
437
|
+
type_text("The door is locked," if door.lock.is_locked else "The door is not locked,", "you know this about its key code:")
|
438
|
+
revealer.reveal_key_code(door)
|
439
|
+
else:
|
440
|
+
type_text(f"The exit {Name} has no lock.")
|
441
|
+
else:
|
442
|
+
type_text(f"There is nothing spechial about the exit {Name}.")
|
443
|
+
elif Name in ROOMS[player.CURRENTROOM]['containers']:
|
444
|
+
containerins = ROOMS[player.CURRENTROOM]['containers'][Name]
|
445
|
+
if isinstance(containerins, container):
|
446
|
+
if isinstance(containerins.lock, Lock):
|
447
|
+
type_text("The container is locked," if containerins.lock.is_locked else "The container is not locked,", "you know this about its key code:")
|
448
|
+
revealer.reveal_key_code(containerins)
|
449
|
+
else:
|
450
|
+
type_text(f"The container {Name} has no lock.")
|
451
|
+
else:
|
452
|
+
type_text(f"There is no container {containerins} in this room")
|
453
|
+
|
390
454
|
def battle(player: PC, good_guys: list, bad_guys: list, last_room):
|
391
455
|
"""
|
392
456
|
Simulate a battle between the player (and allies) and monsters.
|
@@ -630,7 +694,7 @@ def handle_sleep_command(player: PC):
|
|
630
694
|
sleep(2) # Example: sleep for 2 seconds
|
631
695
|
|
632
696
|
# Restore player's health or apply any other effects
|
633
|
-
player.heal(3) # Example: heal
|
697
|
+
player.heal(3) # Example: heal 3 health points during sleep
|
634
698
|
|
635
699
|
# Optional: Print a message or effect that happens during sleep
|
636
700
|
type_text("You feel refreshed after a good rest.", colorTrue=color_coding)
|
@@ -658,14 +722,11 @@ def handle_get_command(player: PC, item_name):
|
|
658
722
|
|
659
723
|
def handle_look_command():
|
660
724
|
global player
|
661
|
-
return_ = False
|
662
725
|
if 'item' in ROOMS[player.CURRENTROOM]:
|
663
726
|
type_text(f'The item in the room: %*BLUE*%{ROOMS[player.CURRENTROOM]["item"].name}%*RESET*%.', colorTrue=color_coding)
|
664
|
-
|
727
|
+
return
|
665
728
|
if 'containers' in ROOMS[player.CURRENTROOM]:
|
666
729
|
type_text(f"The containers here are: %*RED*%{', '.join(ROOMS[player.CURRENTROOM]['containers'].keys())}%*RESET*%", colorTrue=color_coding)
|
667
|
-
return_ = True
|
668
|
-
if return_:
|
669
730
|
return
|
670
731
|
type_text('There is nothing of interest.', colorTrue=color_coding)
|
671
732
|
|
@@ -682,15 +743,20 @@ def handle_search_command(player, container = None, sub_container = None):
|
|
682
743
|
else:
|
683
744
|
type_text(f"You cannot search the {container}", colorTrue=color_coding)
|
684
745
|
|
685
|
-
def search_container(player: PC,
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
if
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
746
|
+
def search_container(player: PC, Container):
|
747
|
+
ContainerName = Container
|
748
|
+
Container = ROOMS[player.CURRENTROOM]['containers'][Container]
|
749
|
+
if isinstance(Container, container):
|
750
|
+
if isinstance(Container.lock, Lock):
|
751
|
+
key = PickKey(Container.lock)
|
752
|
+
Container.Unlock(key, player)
|
753
|
+
Container.take_contents(player)
|
754
|
+
type_text(f"You search the{' secret' if Container.secret else ''} %*RED*%{ContainerName}%*RESET*% and find a ", newline=False, colorTrue=color_coding)
|
755
|
+
for searchitem in Container.contents:
|
756
|
+
if searchitem:
|
757
|
+
if isinstance(searchitem, item):
|
758
|
+
end_str = ' and a ' if Container.contents.index(searchitem) < last_index(Container.contents) else '\n'
|
759
|
+
type_text(f"%*BLUE*%{searchitem.name}%*RESET*%{end_str}", newline=False, colorTrue=color_coding)
|
694
760
|
|
695
761
|
|
696
762
|
def handle_put_command(player: PC, PutItem: item = None, container = None, sub_container = None):
|
@@ -792,6 +858,7 @@ commands = {
|
|
792
858
|
'sleep': handle_sleep_command,
|
793
859
|
'put': handle_put_command,
|
794
860
|
'map': PrintMap,
|
861
|
+
'examin': Examin,
|
795
862
|
}
|
796
863
|
|
797
864
|
|
@@ -914,7 +981,7 @@ def main():
|
|
914
981
|
f"You have no friends back home; you were always very lonely",
|
915
982
|
f"You are an only child. You ran away from home to join the army; your mother misses you terribly",
|
916
983
|
f"She was a baker, and you spent a lot of time helping her bake bread. You never went to school",
|
917
|
-
f"The people you admire the most are Sam and Aragorn from Lord of the Rings, which you read as a child. You
|
984
|
+
f"The people you admire the most are Sam and Aragorn from Lord of the Rings, which you read as a child. You also read the Hunger Games when you were {13 if age >= 13 else age}",
|
918
985
|
f"Your favorite weapon is a bow; however, the scimitar is a close second.",
|
919
986
|
],
|
920
987
|
backstory=f"""
|
@@ -929,8 +996,8 @@ You were deeply influenced by the heroes of your childhood—Sam and Aragorn fro
|
|
929
996
|
Games%*RESET*%, which you read when you were {13 if age >= 13 else age}. These stories inspired you and fueled your dream of heroism. Though your favorite weapon is a bow, you also have a
|
930
997
|
fondness for the scimitar.
|
931
998
|
|
932
|
-
Now, you find yourself in the Mansion of Amnesia, a place that seems to have erased your memories. The details of your past are fragmented, but the echoes of your history drive you forward.
|
933
|
-
must navigate the mansion and uncover the truth behind your captivity, all while drawing strength from the remnants of your past.
|
999
|
+
Now, you find yourself in the Mansion of Amnesia, a place that seems to have erased your memories. The details of your past are fragmented, but the echoes of your history drive you forward.
|
1000
|
+
You must navigate the mansion and uncover the truth behind your captivity, all while drawing strength from the remnants of your past.
|
934
1001
|
""",
|
935
1002
|
CURRENTROOM='Hall'
|
936
1003
|
)
|
@@ -942,8 +1009,6 @@ must navigate the mansion and uncover the truth behind your captivity, all while
|
|
942
1009
|
while True:
|
943
1010
|
command()
|
944
1011
|
|
945
|
-
enemy_REFs = []
|
946
|
-
|
947
1012
|
# Move guards
|
948
1013
|
for guard in guards:
|
949
1014
|
if isinstance(guard, Guard):
|
@@ -982,7 +1047,6 @@ must navigate the mansion and uncover the truth behind your captivity, all while
|
|
982
1047
|
|
983
1048
|
for enemy in enemies:
|
984
1049
|
if isinstance(enemy, creature):
|
985
|
-
enemy.type_text_flavor_text()
|
986
1050
|
|
987
1051
|
# Handle specific creatures
|
988
1052
|
if enemy.name == 'hungry bear':
|