neelthee-mansion 3.2.0__tar.gz → 3.3.0__tar.gz

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.
Files changed (19) hide show
  1. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/PKG-INFO +1 -1
  2. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion/Mansion_of_Amnesia.py +15 -13
  3. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion/Rooms.py +17 -0
  4. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion.egg-info/PKG-INFO +1 -1
  5. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/setup.py +1 -1
  6. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/README.md +0 -0
  7. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion/Quests.py +0 -0
  8. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion/__init__.py +0 -0
  9. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion/__main__.py +0 -0
  10. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion/all_game_utils.py +0 -0
  11. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion/creatures.py +0 -0
  12. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion/items.py +0 -0
  13. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion/utils.py +0 -0
  14. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion.egg-info/SOURCES.txt +0 -0
  15. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion.egg-info/dependency_links.txt +0 -0
  16. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion.egg-info/entry_points.txt +0 -0
  17. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion.egg-info/requires.txt +0 -0
  18. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/neelthee_mansion.egg-info/top_level.txt +0 -0
  19. {neelthee_mansion-3.2.0 → neelthee_mansion-3.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neelthee_mansion
3
- Version: 3.2.0
3
+ Version: 3.3.0
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
@@ -257,28 +257,27 @@ def Use(moveone, movetwo=None):
257
257
 
258
258
 
259
259
  def PickKey(lock):
260
- if player.inventory.keys():
260
+ keys = player.inventory.keys()
261
+
262
+ if keys:
261
263
  while True:
262
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:")
263
- keys = player.inventory.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
 
@@ -325,15 +324,18 @@ def Move(move):
325
324
  key = PickKey(ROOMS[player.CURRENTROOM]['directions'][move].lock)
326
325
  ROOMS[player.CURRENTROOM]['directions'][move].unlock(key, player)
327
326
  newRoom = ROOMS[player.CURRENTROOM]['directions'][move].GetRoom()
328
- player.CURRENTROOM = move_to_room()
327
+ newRoom = move_to_room()
329
328
  return
330
329
  elif move in ROOMS:
331
330
  newRoom = move
332
331
  if newRoom == 'Garden':
333
- player.CURRENTROOM = attempt_move_to_garden()
334
- else:
335
- player.CURRENTROOM = newRoom
332
+ newRoom = attempt_move_to_garden()
336
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)
337
339
  return
338
340
  type_text(f"There is no exit {move}", colorTrue=color_coding)
339
341
 
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neelthee-mansion
3
- Version: 3.2.0
3
+ Version: 3.3.0
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
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='neelthee_mansion',
5
- version='3.2.0',
5
+ version='3.3.0',
6
6
  packages=find_packages(), # Automatically finds all packages and modules
7
7
  install_requires=[
8
8
  'wheel', 'psutil', 'playsound', 'requests', 'keyboard', 'pandas', 'validators', 'dicttoxml', 'pytz',