neelthee-mansion 3.23.4__py3-none-any.whl → 3.23.6__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.
@@ -35,7 +35,7 @@ class base_character:
35
35
  Represents a base character in the game, including both players and creatures.
36
36
  """
37
37
 
38
- def take_damage(self, damage_taken: int = 5):
38
+ def take_damage(self, damage_taken: int = 5, text_area=None):
39
39
  """
40
40
  Reduces the character's hit points by the specified amount of damage.
41
41
 
@@ -45,14 +45,14 @@ class base_character:
45
45
  Returns:
46
46
  None
47
47
  """
48
- string_beginning = "%*MAGENTA*%"
48
+ string_beginning = ""
49
49
  if type(self) == creature:
50
- string_beginning = "The %*CYAN*%"
50
+ string_beginning = "The "
51
51
  self.hp = self.hp - damage_taken
52
52
  if self.hp < 0:
53
53
  self.hp = 0
54
- type_text(
55
- f"{string_beginning}{self.name}%*RESET*% takes {damage_taken} damage and has {self.hp} HP left!"
54
+ add_text_to_textbox(text_area,
55
+ f"{string_beginning}{self.name} takes {damage_taken} damage and has {self.hp} HP left!"
56
56
  )
57
57
 
58
58
 
@@ -142,35 +142,35 @@ class creature(base_character):
142
142
  self.dropped_items = dropped_items
143
143
  self.xp = rounding(self.difficulty * 2 + len(self.dropped_items))
144
144
  self.description = (
145
- description if description else f"A %*CYAN*%{self.name}%*RESET."
145
+ description if description else f"A {self.name}."
146
146
  )
147
147
  self.flavor_text = (
148
- flavor_text if flavor_text else f"You see a %*CYAN*%{self.name}%*RESET*%!"
148
+ flavor_text if flavor_text else f"You see a {self.name}!"
149
149
  )
150
150
  self.type = type
151
151
  self.crit_chance = crit_chance
152
152
  self.frendly = False
153
153
  self.frendly_text = frendly_text
154
154
 
155
- def type_text_flavor_text(self):
155
+ def add_text_flavor_text(self, text_area):
156
156
  """
157
157
  Prints the flavor text associated with encountering the creature.
158
158
  """
159
- type_text(self.flavor_text)
159
+ add_text_to_textbox(text_area, self.flavor_text)
160
160
 
161
- def type_text_description(self):
161
+ def add_text_description(self, text_area):
162
162
  """
163
163
  Prints the description of the creature.
164
164
  """
165
- type_text(self.description)
165
+ add_text_to_textbox(text_area, self.description)
166
166
  curent_holiday = get_holiday()
167
167
  if curent_holiday == "christmas":
168
- type_text(f"The {self.name} also has a santa hat.")
168
+ add_text_to_textbox(text_area, f"The {self.name} also has a santa hat.")
169
169
  elif curent_holiday == "easter":
170
- type_text(f"The {self.name} also has bunny ears.")
170
+ add_text_to_textbox(text_area, f"The {self.name} also has bunny ears.")
171
171
  elif curent_holiday == "halloween":
172
- if random < 0.2:
173
- type_text(f"The {self.name} also has a pumkin on it's head.")
172
+ if random() < 0.2:
173
+ add_text_to_textbox(text_area, f"The {self.name} also has a pumkin on it's head.")
174
174
 
175
175
 
176
176
  class Guard(creature):
@@ -252,7 +252,7 @@ class Guard(creature):
252
252
  self.current_room = room.GetRoom(self.current_room)
253
253
  return
254
254
 
255
- def check_detection(self, player_room):
255
+ def check_detection(self, player_room, text_area):
256
256
  """
257
257
  Checks if the guard has detected the player.
258
258
 
@@ -263,13 +263,13 @@ class Guard(creature):
263
263
  bool: True if the player is detected, False otherwise.
264
264
  """
265
265
  if self.current_room == player_room and not self.frendly:
266
- type_text(
266
+ add_text_to_textbox(text_area,
267
267
  f"You have been caught by {self.name} in the {self.current_room}!"
268
268
  )
269
269
  return True
270
270
  elif self.current_room == player_room and self.frendly:
271
271
  if random() <= 0.015:
272
- type_text(self.frendly_text)
272
+ add_text_to_textbox(text_area, self.frendly_text)
273
273
  return False
274
274
 
275
275
 
@@ -280,18 +280,18 @@ class base_ability:
280
280
  self.cooldown_time = cooldown_time
281
281
  self.current_cooldown = 0
282
282
 
283
- def activate(self, target: creature, damage: int = 5):
283
+ def activate(self, target: creature, damage: int = 5, text_area=None):
284
284
  self.ready = False
285
285
  self.current_cooldown = 0
286
- print(f"Ability {self.name} will be ready after {self.cooldown_time} commands.")
286
+ add_text_to_textbox(f"Ability {self.name} will be ready after {self.cooldown_time} commands.")
287
287
 
288
- def Tick(self):
288
+ def Tick(self, text_area):
289
289
  self.current_cooldown += 1
290
- self.check_cooldown()
290
+ self.check_cooldown(text_area)
291
291
 
292
- def check_cooldown(self):
292
+ def check_cooldown(self, text_area):
293
293
  if self.current_cooldown >= self.cooldown_time and not self.ready:
294
- type_text(f"\nAbility {self.name} is ready to use again. ")
294
+ add_text_to_textbox(text_area, f"\nAbility {self.name} is ready to use again. ")
295
295
  self.ready = True
296
296
 
297
297
 
@@ -375,7 +375,7 @@ class PC(base_character):
375
375
  self.xp += xp_added
376
376
  self.check_xp()
377
377
 
378
- def inventory_add(self, added: list[item]):
378
+ def inventory_add(self, added: list[item], text_area):
379
379
  try:
380
380
  if not isinstance(added, list):
381
381
  added = [added]
@@ -389,64 +389,15 @@ class PC(base_character):
389
389
  self.get_change_weapon(item_to_add.value)
390
390
  else:
391
391
  # Print an error message if the item is not an instance of Item class
392
- type_text(f"Error: {item_to_add} is not an instance of Item class")
392
+ add_text_to_textbox(text_area, f"Error: {item_to_add} is not an instance of Item class")
393
393
  except Exception as e:
394
394
  # Print the full traceback if an exception occurs
395
- type_text(f"Error: {e}")
395
+ add_text_to_textbox(text_area, f"Error: {e}")
396
396
 
397
397
  def heal(self, value):
398
398
  self.hp = clamp(value, 0, self.maxhp)
399
399
 
400
400
 
401
- class NPC(PC):
402
- def __init__(
403
- self,
404
- Name: str,
405
- Age: int,
406
- Class: str,
407
- Level: int,
408
- Background: str,
409
- Height: Height,
410
- Weight: int,
411
- Notes: list = [],
412
- special_ability: base_ability = supercrit_ability(),
413
- NOTES: list = [],
414
- xp: int = None,
415
- inventory: inv = None,
416
- money: int = 0,
417
- weapons_atpws: list = [],
418
- npc_role: str = "generic", # New attribute for NPC role (e.g., merchant, enemy, etc.)
419
- aggressive: bool = False, # New attribute to determine if NPC is aggressive
420
- ):
421
- super().__init__(
422
- Name=Name,
423
- Age=Age,
424
- Class=Class,
425
- Level=Level,
426
- Background=Background,
427
- Height=Height,
428
- Weight=Weight,
429
- Notes=Notes,
430
- special_ability=special_ability,
431
- NOTES=NOTES,
432
- xp=xp,
433
- inventory=inventory,
434
- money=money,
435
- weapons_atpws=weapons_atpws,
436
- )
437
- self.npc_role = npc_role
438
- self.aggressive = aggressive
439
-
440
- def interact(self):
441
- if self.aggressive:
442
- return f"{self.name} looks hostile and prepares for a fight!"
443
- else:
444
- return f"{self.name} has nothing to say to you."
445
-
446
- def npc_info(self):
447
- return f"Name: {self.name}, Age: {self.Age}, Class: {self.Class}, Level: {self.Level}, Role: {self.npc_role}, Aggressive: {self.aggressive}"
448
-
449
-
450
401
  class PC_action:
451
402
  def __init__(self, value) -> None:
452
403
  if not value in ValidActions:
@@ -508,10 +459,10 @@ class NPC(Guard):
508
459
  self.asked_about = set()
509
460
  self.generic_response = generic_response
510
461
 
511
- def talk(self):
462
+ def talk(self, text_area):
512
463
  while True:
513
464
  player_input = loop_til_valid_input(
514
- f"What do you want to say to %*BROWN*%{self.name}%*RESET*%?",
465
+ f"What do you want to say to {self.name}?",
515
466
  "",
516
467
  str,
517
468
  )
@@ -521,18 +472,18 @@ class NPC(Guard):
521
472
 
522
473
  # Exit the loop if the player says "goodbye"
523
474
  if player_input == "goodbye":
524
- type_text(f"Goodbye then. Don't get lost!")
475
+ add_text_to_textbox(text_area, f"Goodbye then. Don't get lost!")
525
476
  break
526
477
 
527
478
  # Check for keywords and map to corresponding response
528
479
  for topic, variations in self.keyword_variations.items():
529
480
  if any(variation in player_input for variation in variations):
530
481
  self.asked_about.add(topic)
531
- type_text(self._get_response(topic))
482
+ add_text_to_textbox(text_area, self._get_response(topic))
532
483
  break # Stop further keyword checks and wait for the next input
533
484
  else:
534
485
  # If no keywords found, return a generic response
535
- type_text(self._generic_response())
486
+ add_text_to_textbox(text_area, self._generic_response())
536
487
 
537
488
  def _get_response(self, topic):
538
489
  """Return a response from the NPC based on the topic asked."""
neelthee_mansion/items.py CHANGED
@@ -118,10 +118,10 @@ class ShopItem:
118
118
  def can_buy(self, player) -> bool:
119
119
  return player.money >= self.price
120
120
 
121
- def buy(self, player) -> bool:
121
+ def buy(self, player, text_area) -> bool:
122
122
  if self.can_buy(player):
123
123
  player.money -= self.price
124
- player.inventory_add(self.item)
124
+ player.inventory_add(self.item, text_area)
125
125
  return True
126
126
  else:
127
127
  return False
@@ -181,7 +181,7 @@ class container:
181
181
 
182
182
  try:
183
183
  for Item in self.contents:
184
- geter.inventory_add(Item)
184
+ geter.inventory_add(Item, text_area)
185
185
  except:
186
186
  pass
187
187
  finally:
neelthee_mansion/utils.py CHANGED
@@ -51,7 +51,7 @@ These utilities aim to simplify development processes, promote code reuse, and i
51
51
  def add_text_to_textbox(text_area: scrolledtext.ScrolledText, text, newline=True):
52
52
  # Enable the text box to insert text
53
53
  text_area.config(state=tk.NORMAL)
54
- text_area.insert(tk.END, text + r"\n"if newline else "")
54
+ text_area.insert(tk.END, text + "\n" if newline else "")
55
55
  text_area.see(tk.END)
56
56
  text_area.update_idletasks()
57
57
  # Set the text box back to read-only
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: neelthee-mansion
3
- Version: 3.23.4
3
+ Version: 3.23.6
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
@@ -0,0 +1,16 @@
1
+ neelthee_mansion/Books.py,sha256=Zs6GOi12vrikne-E37LdrLNRb6CyUogOCDApDGFj6Ls,26168
2
+ neelthee_mansion/Mansion_of_Amnesia.py,sha256=lBSuZZvAUK31gMoLnERP_UTK-feq-fYGarnhSRlD7Rk,53950
3
+ neelthee_mansion/Quests.py,sha256=pUlru2RugP57MACQORZaF_X9lsbefTdPYTSO474phgo,2791
4
+ neelthee_mansion/Rooms.py,sha256=AOhD5EDmmid5vfow_EBT8qB4jLtvsdBG5OXHAFQ-YJA,79220
5
+ neelthee_mansion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ neelthee_mansion/__main__.py,sha256=OIAWZ04le70DyjtR4hlmK9csHej7EHxeUrMoNnM-Vjc,95
7
+ neelthee_mansion/all_game_utils.py,sha256=AasunTkFmgAqt9ZIoYmymi4R7leBe4ubW-C1ts0Qclo,351
8
+ neelthee_mansion/creatures.py,sha256=XdRM5DJSnjAKXn4QskXKBf_YGvov26fX3XU1E2ww0zg,19722
9
+ neelthee_mansion/items.py,sha256=aGEkNUROf4WuLdsmoFYD-0BbJ984SODt73-8-_F1Z9Y,6672
10
+ neelthee_mansion/utils.py,sha256=uTBmCWz1TRLpKSwAJHlcN_pJZDMvYdLVyUfkTV0gFdw,14225
11
+ neelthee_mansion-3.23.6.dist-info/LICENSE.md,sha256=CV8XGZaCyyAMdbkYFQUjb8AjBq9vkoyqdZCq1_hetms,1105
12
+ neelthee_mansion-3.23.6.dist-info/METADATA,sha256=f5x-IgiR-mSSrWhWbymISI7fX_h9hDysA9mUsDMIWY8,1756
13
+ neelthee_mansion-3.23.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
14
+ neelthee_mansion-3.23.6.dist-info/entry_points.txt,sha256=j5ScTTyIidFhmT3F6hcX9pnlom4cJdDmfe26BmM6Igo,56
15
+ neelthee_mansion-3.23.6.dist-info/top_level.txt,sha256=woQImQewylhly5Rb24HwPEGMxPY6do_PaUwGd5BNLOM,17
16
+ neelthee_mansion-3.23.6.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- neelthee_mansion/Books.py,sha256=Zs6GOi12vrikne-E37LdrLNRb6CyUogOCDApDGFj6Ls,26168
2
- neelthee_mansion/Mansion_of_Amnesia.py,sha256=UtbOcolEfvop-vomM2DCj87rSRwlqGrIPEbWy1yY7Ng,52815
3
- neelthee_mansion/Quests.py,sha256=pUlru2RugP57MACQORZaF_X9lsbefTdPYTSO474phgo,2791
4
- neelthee_mansion/Rooms.py,sha256=CgenMX9ssTCWbDFopX6GHhNDnRYF5MpaDufWvt5fPwU,86025
5
- neelthee_mansion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- neelthee_mansion/__main__.py,sha256=OIAWZ04le70DyjtR4hlmK9csHej7EHxeUrMoNnM-Vjc,95
7
- neelthee_mansion/all_game_utils.py,sha256=AasunTkFmgAqt9ZIoYmymi4R7leBe4ubW-C1ts0Qclo,351
8
- neelthee_mansion/creatures.py,sha256=vUR8PmdiftCFBCGJbHkCT4AMUPvqwouDGQ4ye2fiPCw,20910
9
- neelthee_mansion/items.py,sha256=tSWWRzTIJja6I_BOz4hNz58MxVLRw9SKsdnavHWQPZs,6639
10
- neelthee_mansion/utils.py,sha256=nVWzqARScBkbUEyt2yZRsxxFVGquP6gs2O2wQSbreKc,14225
11
- neelthee_mansion-3.23.4.dist-info/LICENSE.md,sha256=CV8XGZaCyyAMdbkYFQUjb8AjBq9vkoyqdZCq1_hetms,1105
12
- neelthee_mansion-3.23.4.dist-info/METADATA,sha256=rd_8kIXVcHF0KDhlX1U1tzqvRLmISH-lgIcE7o58j4Q,1756
13
- neelthee_mansion-3.23.4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
14
- neelthee_mansion-3.23.4.dist-info/entry_points.txt,sha256=j5ScTTyIidFhmT3F6hcX9pnlom4cJdDmfe26BmM6Igo,56
15
- neelthee_mansion-3.23.4.dist-info/top_level.txt,sha256=woQImQewylhly5Rb24HwPEGMxPY6do_PaUwGd5BNLOM,17
16
- neelthee_mansion-3.23.4.dist-info/RECORD,,