neelthee-mansion 3.1.2__py3-none-any.whl → 3.2.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.
@@ -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,32 @@ 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
+ if player.inventory.keys():
261
+ while True:
262
+ 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:")
263
+ keys = player.inventory.keys()
264
+
265
+ # Enumerate keys and display them
266
+ for idx, key in enumerate(keys, 1): # Starts numbering at 1
267
+ type_text(f"{idx}. {key}")
268
+
269
+ # Use loop_til_valid_input to get a valid integer
270
+ choice = loop_til_valid_input(
271
+ input_text="Enter the number of the key you'd like to use: ",
272
+ bad_text="That's not a valid choice, please try again.",
273
+ Class=int # Ensuring input is an integer
274
+ )
275
+
276
+ # Check if the chosen number corresponds to a valid key
277
+ if 1 <= choice <= len(keys):
278
+ selected_key = keys[choice - 1] # Adjust index since list is 0-based
279
+ return selected_key
280
+ else:
281
+ type_text("Invalid choice, please try again.")
282
+ return Key(KeyCode=None)
283
+
284
+
257
285
  def Move(move):
258
286
  global player
259
287
 
@@ -271,30 +299,33 @@ def Move(move):
271
299
 
272
300
  def attempt_move_to_garden():
273
301
  global player
274
- if 'key' in player.inventory:
275
- End('You unlock the gate to the garden with the key!')
276
- return newRoom
277
- else:
278
- type_text('The gate is locked.', colorTrue=color_coding)
279
- return newRoom
302
+ type_text("Please pick whitch key you want to try in the lock on the gate")
303
+ for key in player.inventory.keys():
304
+ if key.KeyCode == "629.IdnXwnt":
305
+ End('You unlock the gate to the garden with the key!')
306
+ return newRoom
307
+ type_text('The gate is locked.', colorTrue=color_coding)
308
+ return newRoom
280
309
 
281
310
  def move_to_room():
282
311
  global player
283
312
  player.LASTROOM = player.CURRENTROOM
313
+ if 'descovered' in ROOMS[newRoom] and not ROOMS[newRoom]['descovered']:
314
+ ROOMS[newRoom]['descovered'] = True
284
315
  if move == '0':
285
316
  return attempt_charter()
286
317
  elif newRoom == 'Garden':
287
- if 'descovered' in ROOMS[newRoom] and not ROOMS[newRoom]['descovered']:
288
- ROOMS[newRoom]['descovered'] = True
289
318
  return attempt_move_to_garden()
290
319
  else:
291
- if 'descovered' in ROOMS[newRoom] and not ROOMS[newRoom]['descovered']:
292
- ROOMS[newRoom]['descovered'] = True
293
320
  return newRoom
294
321
 
295
322
  if move in ROOMS[player.CURRENTROOM]['directions']:
296
- newRoom = ROOMS[player.CURRENTROOM]['directions'][move]
297
- player.CURRENTROOM = move_to_room()
323
+ if isinstance(ROOMS[player.CURRENTROOM]['directions'][move], Door):
324
+ if isinstance(ROOMS[player.CURRENTROOM]['directions'][move].lock, Lock):
325
+ key = PickKey(ROOMS[player.CURRENTROOM]['directions'][move].lock)
326
+ ROOMS[player.CURRENTROOM]['directions'][move].unlock(key, player)
327
+ newRoom = ROOMS[player.CURRENTROOM]['directions'][move].GetRoom()
328
+ player.CURRENTROOM = move_to_room()
298
329
  return
299
330
  elif move in ROOMS:
300
331
  newRoom = move
@@ -304,12 +335,12 @@ def Move(move):
304
335
  player.CURRENTROOM = newRoom
305
336
  player.LASTROOM = player.CURRENTROOM
306
337
  return
307
- type_text("You can't go that way!", colorTrue=color_coding)
338
+ type_text(f"There is no exit {move}", colorTrue=color_coding)
308
339
 
309
340
 
310
341
  def start():
311
342
  global player
312
- # type_text a main men, colorTrue=color_codingu
343
+ # shows the main menu
313
344
  type_text(f'\nHello %*MAGENTA*%{player.name}%*RESET*% and welcome to my Role Playing Game. \nI hope you have fun!', colorTrue=color_coding)
314
345
  showInstructions()
315
346
 
@@ -383,10 +414,41 @@ def display_directions(text):
383
414
  text += f'\n{direction_descriptions[room_type][direction]} %*GREEN*%{direction}%*RESET*%.'
384
415
 
385
416
  if 'teleport' in ROOMS[player.CURRENTROOM]['directions']:
386
- text += "\nThere is a %*GREEN*%teleport%*RESET*%ation circle on the ground"
417
+ text += "\nThere is a %*GREEN*%teleport%*RESET*%ation circle on the ground."
387
418
 
388
419
  return text
389
420
 
421
+ def Examin(*Args):
422
+ Name = ' '.join(Args)
423
+ if player.inventory.index(Name):
424
+ _ = player.inventory[player.inventory.index(Name)]
425
+ if isinstance(_, Key):
426
+ type_text("You look at your key and you figure out this about it:")
427
+ revealer.reveal_key_code(_)
428
+ elif isinstance(_, item):
429
+ if _.type == 'weapon':
430
+ type_text(f"This item is a weapon that adds {_.value} damage.")
431
+ elif Name in ROOMS[player.CURRENTROOM]['directions']:
432
+ door = ROOMS[player.CURRENTROOM]['directions'][Name]
433
+ if isinstance(door, Door):
434
+ if isinstance(door.lock, Lock):
435
+ type_text("The door is locked," if door.lock.is_locked else "The door is not locked,", "you know this about its key code:")
436
+ revealer.reveal_key_code(door)
437
+ else:
438
+ type_text(f"The exit {Name} has no lock.")
439
+ else:
440
+ type_text(f"There is nothing spechial about the exit {Name}.")
441
+ elif Name in ROOMS[player.CURRENTROOM]['containers']:
442
+ containerins = ROOMS[player.CURRENTROOM]['containers'][Name]
443
+ if isinstance(containerins, container):
444
+ if isinstance(containerins.lock, Lock):
445
+ type_text("The container is locked," if containerins.lock.is_locked else "The container is not locked,", "you know this about its key code:")
446
+ revealer.reveal_key_code(containerins)
447
+ else:
448
+ type_text(f"The container {Name} has no lock.")
449
+ else:
450
+ type_text(f"There is no container {containerins} in this room")
451
+
390
452
  def battle(player: PC, good_guys: list, bad_guys: list, last_room):
391
453
  """
392
454
  Simulate a battle between the player (and allies) and monsters.
@@ -630,7 +692,7 @@ def handle_sleep_command(player: PC):
630
692
  sleep(2) # Example: sleep for 2 seconds
631
693
 
632
694
  # Restore player's health or apply any other effects
633
- player.heal(3) # Example: heal 5 health points during sleep
695
+ player.heal(3) # Example: heal 3 health points during sleep
634
696
 
635
697
  # Optional: Print a message or effect that happens during sleep
636
698
  type_text("You feel refreshed after a good rest.", colorTrue=color_coding)
@@ -658,14 +720,11 @@ def handle_get_command(player: PC, item_name):
658
720
 
659
721
  def handle_look_command():
660
722
  global player
661
- return_ = False
662
723
  if 'item' in ROOMS[player.CURRENTROOM]:
663
724
  type_text(f'The item in the room: %*BLUE*%{ROOMS[player.CURRENTROOM]["item"].name}%*RESET*%.', colorTrue=color_coding)
664
- return_ = True
725
+ return
665
726
  if 'containers' in ROOMS[player.CURRENTROOM]:
666
727
  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
728
  return
670
729
  type_text('There is nothing of interest.', colorTrue=color_coding)
671
730
 
@@ -682,15 +741,20 @@ def handle_search_command(player, container = None, sub_container = None):
682
741
  else:
683
742
  type_text(f"You cannot search the {container}", colorTrue=color_coding)
684
743
 
685
- def search_container(player: PC, container):
686
- player.inventory_add(ROOMS[player.CURRENTROOM]['containers'][container].contents)
687
- type_text(f"You search the{' secret' if ROOMS[player.CURRENTROOM]['containers'][container].secret else ''} %*RED*%{container}%*RESET*% and find a ", newline=False, colorTrue=color_coding)
688
- for searchitem in ROOMS[player.CURRENTROOM]['containers'][container].contents:
689
- if searchitem:
690
- if isinstance(searchitem, item):
691
- end_str = ' and a ' if ROOMS[player.CURRENTROOM]['containers'][container].contents.index(searchitem) < last_index(ROOMS[player.CURRENTROOM]['containers'][container].contents) else '\n'
692
- type_text(f"%*BLUE*%{searchitem.name}%*RESET*%{end_str}", newline=False, colorTrue=color_coding)
693
- ROOMS[player.CURRENTROOM]['containers'][container].contents = []
744
+ def search_container(player: PC, Container):
745
+ ContainerName = Container
746
+ Container = ROOMS[player.CURRENTROOM]['containers'][Container]
747
+ if isinstance(Container, container):
748
+ if isinstance(Container.lock, Lock):
749
+ key = PickKey(Container.lock)
750
+ Container.Unlock(key, player)
751
+ Container.take_contents(player)
752
+ type_text(f"You search the{' secret' if Container.secret else ''} %*RED*%{ContainerName}%*RESET*% and find a ", newline=False, colorTrue=color_coding)
753
+ for searchitem in Container.contents:
754
+ if searchitem:
755
+ if isinstance(searchitem, item):
756
+ end_str = ' and a ' if Container.contents.index(searchitem) < last_index(Container.contents) else '\n'
757
+ type_text(f"%*BLUE*%{searchitem.name}%*RESET*%{end_str}", newline=False, colorTrue=color_coding)
694
758
 
695
759
 
696
760
  def handle_put_command(player: PC, PutItem: item = None, container = None, sub_container = None):
@@ -792,6 +856,7 @@ commands = {
792
856
  'sleep': handle_sleep_command,
793
857
  'put': handle_put_command,
794
858
  'map': PrintMap,
859
+ 'examin': Examin,
795
860
  }
796
861
 
797
862
 
@@ -851,12 +916,12 @@ def handle_guard_action(guard):
851
916
  guard = function_to_call(player, guard)
852
917
  return [True, guard] # Function was found and called
853
918
  else:
854
- return [False, guard] # Function was not found
919
+ return [False, [guard, True]] # Function was not found
855
920
 
856
921
  def main():
857
922
  global player, color_coding
858
923
  global charactersList
859
-
924
+
860
925
 
861
926
  df = pd.DataFrame(charactersList)
862
927
 
@@ -914,7 +979,7 @@ def main():
914
979
  f"You have no friends back home; you were always very lonely",
915
980
  f"You are an only child. You ran away from home to join the army; your mother misses you terribly",
916
981
  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 have also read the Hunger Games when you were {13 if age >= 13 else age}",
982
+ 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
983
  f"Your favorite weapon is a bow; however, the scimitar is a close second.",
919
984
  ],
920
985
  backstory=f"""
@@ -929,8 +994,8 @@ You were deeply influenced by the heroes of your childhood—Sam and Aragorn fro
929
994
  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
995
  fondness for the scimitar.
931
996
 
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. You
933
- must navigate the mansion and uncover the truth behind your captivity, all while drawing strength from the remnants of your past.
997
+ 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.
998
+ You must navigate the mansion and uncover the truth behind your captivity, all while drawing strength from the remnants of your past.
934
999
  """,
935
1000
  CURRENTROOM='Hall'
936
1001
  )
@@ -942,13 +1007,14 @@ must navigate the mansion and uncover the truth behind your captivity, all while
942
1007
  while True:
943
1008
  command()
944
1009
 
945
- enemy_REFs = []
946
-
947
1010
  # Move guards
948
1011
  for guard in guards:
949
1012
  if isinstance(guard, Guard):
950
1013
  guard.move(ROOMS, player)
951
1014
 
1015
+ good_guys = []
1016
+ bad_guys = []
1017
+
952
1018
  # Check for detection
953
1019
  for guard in guards:
954
1020
  if isinstance(guard, Guard):
@@ -977,12 +1043,8 @@ must navigate the mansion and uncover the truth behind your captivity, all while
977
1043
  if not isinstance(enemies, list):
978
1044
  enemies = [enemies] # Ensure enemies is a list even if there's only one creature
979
1045
 
980
- good_guys = []
981
- bad_guys = []
982
-
983
1046
  for enemy in enemies:
984
1047
  if isinstance(enemy, creature):
985
- enemy.type_text_flavor_text()
986
1048
 
987
1049
  # Handle specific creatures
988
1050
  if enemy.name == 'hungry bear':