neelthee-mansion 3.2.0__py3-none-any.whl → 3.3.1__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.
@@ -256,29 +256,28 @@ def Use(moveone, movetwo=None):
256
256
  type_text("You can't use that", colorTrue=color_coding)
257
257
 
258
258
 
259
- def PickKey(lock):
260
- if player.inventory.keys():
259
+ def PickKey(locked_obj):
260
+ keys = player.inventory.keys()
261
+
262
+ if keys:
261
263
  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
+ type_text(f"Please pick which key you want to use in the lock. This is what you know about the lock: {locked_obj}. These are your keys:")
264
265
 
265
266
  # Enumerate keys and display them
266
267
  for idx, key in enumerate(keys, 1): # Starts numbering at 1
267
268
  type_text(f"{idx}. {key}")
268
-
269
- # Use loop_til_valid_input to get a valid integer
269
+
270
+ # Use loop_til_valid_input to get a valid integer within the correct range
270
271
  choice = loop_til_valid_input(
271
272
  input_text="Enter the number of the key you'd like to use: ",
272
273
  bad_text="That's not a valid choice, please try again.",
273
274
  Class=int # Ensuring input is an integer
274
275
  )
275
276
 
276
- # Check if the chosen number corresponds to a valid key
277
+ # Since loop_til_valid_input ensures valid input, just return the selected key
277
278
  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.")
279
+ return keys[choice - 1] # Fetch the key using 0-based index
280
+
282
281
  return Key(KeyCode=None)
283
282
 
284
283
 
@@ -300,10 +299,10 @@ def Move(move):
300
299
  def attempt_move_to_garden():
301
300
  global player
302
301
  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
302
+ key = PickKey(Lock("629.IdnXwnt"))
303
+ if key.KeyCode == "629.IdnXwnt":
304
+ End('You unlock the gate to the garden with the key!')
305
+ return newRoom
307
306
  type_text('The gate is locked.', colorTrue=color_coding)
308
307
  return newRoom
309
308
 
@@ -320,20 +319,26 @@ def Move(move):
320
319
  return newRoom
321
320
 
322
321
  if move in ROOMS[player.CURRENTROOM]['directions']:
322
+ newRoom = "Hall"
323
323
  if isinstance(ROOMS[player.CURRENTROOM]['directions'][move], Door):
324
324
  if isinstance(ROOMS[player.CURRENTROOM]['directions'][move].lock, Lock):
325
325
  key = PickKey(ROOMS[player.CURRENTROOM]['directions'][move].lock)
326
326
  ROOMS[player.CURRENTROOM]['directions'][move].unlock(key, player)
327
327
  newRoom = ROOMS[player.CURRENTROOM]['directions'][move].GetRoom()
328
- player.CURRENTROOM = move_to_room()
328
+ elif isinstance(ROOMS[player.CURRENTROOM]['directions'][move], str):
329
+ newRoom = ROOMS[player.CURRENTROOM]['directions'][move]
330
+ newRoom = move_to_room()
329
331
  return
330
332
  elif move in ROOMS:
331
333
  newRoom = move
332
334
  if newRoom == 'Garden':
333
- player.CURRENTROOM = attempt_move_to_garden()
334
- else:
335
- player.CURRENTROOM = newRoom
335
+ newRoom = attempt_move_to_garden()
336
336
  player.LASTROOM = player.CURRENTROOM
337
+ player.CURRENTROOM = newRoom
338
+ if 'random_events' in ROOMS[player.CURRENTROOM]:
339
+ for randomEvent in ROOMS[player.CURRENTROOM]['random_events']:
340
+ if isinstance(randomEvent, RandomEvent):
341
+ randomEvent.check_and_trigger(player)
337
342
  return
338
343
  type_text(f"There is no exit {move}", colorTrue=color_coding)
339
344
 
neelthee_mansion/Rooms.py CHANGED
@@ -24,6 +24,23 @@ KEY = [
24
24
  'π = desk',
25
25
  ]
26
26
 
27
+ class RandomEvent:
28
+ def __init__(self,
29
+ name='Event name',
30
+ probability=0.0, # Probability of the event running (0.1 = 10% chance)
31
+ condition=lambda player: True, # Condition under which the event can occur
32
+ effect=lambda player: None): # Define the effect of the event
33
+ self.name = name
34
+ self.probability = probability
35
+ self.condition = condition
36
+ self.effect = effect
37
+
38
+ def check_and_trigger(self, player):
39
+ """Check if the event can occur based on its condition and probability, and trigger the effect."""
40
+ import random
41
+ if self.condition(player) and random.random() < self.probability:
42
+ self.effect(player)
43
+
27
44
  class Door:
28
45
  def __init__(self, RoomName, KeyCode=None) -> None:
29
46
  self.destination = RoomName
@@ -40,6 +57,9 @@ class Door:
40
57
  else:
41
58
  type_text("The door is locked.")
42
59
  return currentroom
60
+
61
+ def __str__(self) -> str:
62
+ return self.CurentRevealStr
43
63
 
44
64
  class SwitchDoor(Door):
45
65
  def __init__(self, RoomOneName, RoomTwoName, KeyCode=None) -> None:
@@ -300,7 +320,7 @@ You notice a ''%*RED*%storage%*RESET*% device in one corner. You hear a %*YELLOW
300
320
  'directions': {
301
321
  'west': Door('Armoury'),
302
322
  'south': Door('Dining Room'),
303
- 'down': 'Basement 1',
323
+ 'down': Door('Basement 1'),
304
324
  },
305
325
  'creatures stats': creature(
306
326
  'grumpy pig',
@@ -336,7 +356,7 @@ You notice a ''%*RED*%storage%*RESET*% device in one corner. You hear a %*YELLOW
336
356
  'position': (1, 8, 0),
337
357
  'discovered': False,
338
358
  'directions': {
339
- 'down': 'Hall',
359
+ 'down': Door('Hall'),
340
360
  'north': Door('Tower Bottom'),
341
361
  'east': Door('Bedroom'),
342
362
  'south': Door('Balcony'),
@@ -452,7 +472,7 @@ You notice a ''%*RED*%storage%*RESET*% device in one corner. You hear a %*YELLOW
452
472
  'directions': {
453
473
  'south': Door('Landing'),
454
474
  'east': Door('Office'),
455
- 'down': 'Armoury',
475
+ 'down': Door('Armoury'),
456
476
  'up': Door('Tower Middle'),
457
477
  },
458
478
  'info': 'You are in the base of a stone tower, there is a spiral staircase going up into the darkness.',
@@ -479,7 +499,7 @@ You notice a ''%*RED*%storage%*RESET*% device in one corner. You hear a %*YELLOW
479
499
  'position': (2, 0, 0),
480
500
  'discovered': False,
481
501
  'directions': {
482
- 'down': 'Tower Bottom',
502
+ 'down': Door('Tower Bottom'),
483
503
  'up': Door('Tower Top'),
484
504
  },
485
505
  'containers': {
@@ -507,7 +527,7 @@ You notice a ''%*RED*%storage%*RESET*% device in one corner. You hear a %*YELLOW
507
527
  'position': (3, 0, 0),
508
528
  'discovered': False,
509
529
  'directions': {
510
- 'down': 'Tower Middle',
530
+ 'down': Door('Tower Middle'),
511
531
  'teleport': Door('Teleportation Deck'),
512
532
  },
513
533
  'creatures stats': creature(
@@ -668,9 +688,11 @@ You notice a ''%*RED*%storage%*RESET*% device in one corner. You hear a %*YELLOW
668
688
 
669
689
  'Cavern 1': {
670
690
  'room type': 'cavern',
691
+ 'position': (-2, 0, 0),
692
+ 'discovered': False,
671
693
  'directions': {
672
694
  'up': Door('Basement 4'),
673
- 'down': 'Cavern 2',
695
+ 'down': Door('Cavern 2'),
674
696
  },
675
697
  'info': 'you are in a dark cavern with the only light coming from the shoot you came through. A voice in the back of your head says: \'Do not go down the shoot, leave while you still can!\'',
676
698
  'map': '''
@@ -690,10 +712,12 @@ You notice a ''%*RED*%storage%*RESET*% device in one corner. You hear a %*YELLOW
690
712
 
691
713
  'Cavern 2': {
692
714
  'room type': 'cavern',
715
+ 'position': (-3, 0, 0),
716
+ 'discovered': False,
693
717
  'directions': {
694
-
718
+ 'up': SwitchDoor('Cavern 1', 'Cavern 3', '7k69fImz4y')
695
719
  },
696
- 'info': 'you are in a dark cavern with the only light coming from the shoot you came through. A voice in the back of your head says: \'You fool! You can never escape!\'',
720
+ 'info': 'you are in a dark cavern with the only light coming from the shoot you came through. A voice in the back of your head says: \'You fool! You can never get back now!\'',
697
721
  'map': '''
698
722
  █████████
699
723
  █ █
@@ -705,7 +729,8 @@ You notice a ''%*RED*%storage%*RESET*% device in one corner. You hear a %*YELLOW
705
729
  █ █
706
730
  █████████''',
707
731
  'Hints': [
708
- 'I should probably quit so I\'m not here forever.',
732
+ 'I should probably go back up so I\'m not here forever.',
733
+ 'I wander what the voice was talking about.',
709
734
  ],
710
735
  },
711
736
 
neelthee_mansion/items.py CHANGED
@@ -156,3 +156,6 @@ class container:
156
156
 
157
157
  def Unlock(self, key: Key, player):
158
158
  return self.lock.unlock(key, player)
159
+
160
+ def __str__(self) -> str:
161
+ return self.CurentRevealStr
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neelthee-mansion
3
- Version: 3.2.0
3
+ Version: 3.3.1
4
4
  Summary: A text-based adventure game set in Neel-thee’s mansion.
5
5
  Home-page: https://github.com/Flameblade375/neelthee_mansion
6
6
  Author: Alexander.E.F
@@ -1,14 +1,14 @@
1
- neelthee_mansion/Mansion_of_Amnesia.py,sha256=cB9Ql3o6dPbYWAVNbGoO7Dw7OBYqPWb4getkzVJlKLg,45661
1
+ neelthee_mansion/Mansion_of_Amnesia.py,sha256=n1x4vtwczYcQ9mMrD8MZLGiEVwBOMJr8WzyHMkDStv0,45955
2
2
  neelthee_mansion/Quests.py,sha256=q6VzR3mt9AYe29ACWZuf-suz4yOKrL946aJ493eQRS0,2611
3
- neelthee_mansion/Rooms.py,sha256=CWha-UQOxWvaJWJeh1HDzfBqKvw8g_HFXeYVZDsGuCg,86124
3
+ neelthee_mansion/Rooms.py,sha256=j8jJObdeTFGIn_G1a_saSx8C7ihWWYiJWAGfyAfY5u0,87314
4
4
  neelthee_mansion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  neelthee_mansion/__main__.py,sha256=OIAWZ04le70DyjtR4hlmK9csHej7EHxeUrMoNnM-Vjc,95
6
6
  neelthee_mansion/all_game_utils.py,sha256=Xfty9uXiYAfmA6iVzJurq852ZBPn7a4gQUcUcaV9yEU,341
7
7
  neelthee_mansion/creatures.py,sha256=kSfzQSE5UmFiDV0eDsTXCk-LQwZIyY5Rwsyh5Uhropw,14826
8
- neelthee_mansion/items.py,sha256=T5Y_oTuWv4SlDHG1Q3Z_wdddQJgtjMfdTdDU489yjCw,5027
8
+ neelthee_mansion/items.py,sha256=ysXxbGTfVSW9gc8N4uGEZlQ-_Nsv2eFjHdfIBUGxBNQ,5101
9
9
  neelthee_mansion/utils.py,sha256=PhFBDQXQoSNHpBUd0NKhP0KcclXK5Mho0qGnrpKAbe0,12187
10
- neelthee_mansion-3.2.0.dist-info/METADATA,sha256=EC_4oexL3YVwh-U4hj0HBpVmWYDNDKe-BbcrLa8YTkg,1991
11
- neelthee_mansion-3.2.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
12
- neelthee_mansion-3.2.0.dist-info/entry_points.txt,sha256=j5ScTTyIidFhmT3F6hcX9pnlom4cJdDmfe26BmM6Igo,56
13
- neelthee_mansion-3.2.0.dist-info/top_level.txt,sha256=woQImQewylhly5Rb24HwPEGMxPY6do_PaUwGd5BNLOM,17
14
- neelthee_mansion-3.2.0.dist-info/RECORD,,
10
+ neelthee_mansion-3.3.1.dist-info/METADATA,sha256=o0Wti0QOa-OkGfYlNq0but3Q0Fhn5edcBp5DaBbetJE,1991
11
+ neelthee_mansion-3.3.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
12
+ neelthee_mansion-3.3.1.dist-info/entry_points.txt,sha256=j5ScTTyIidFhmT3F6hcX9pnlom4cJdDmfe26BmM6Igo,56
13
+ neelthee_mansion-3.3.1.dist-info/top_level.txt,sha256=woQImQewylhly5Rb24HwPEGMxPY6do_PaUwGd5BNLOM,17
14
+ neelthee_mansion-3.3.1.dist-info/RECORD,,