neelthee-mansion 2.2.4__py3-none-any.whl → 2.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 +140 -101
- neelthee_mansion/Rooms.py +1 -8
- neelthee_mansion/creatures.py +20 -4
- neelthee_mansion/utils.py +1 -1
- {neelthee_mansion-2.2.4.dist-info → neelthee_mansion-2.3.0.dist-info}/METADATA +1 -1
- neelthee_mansion-2.3.0.dist-info/RECORD +14 -0
- neelthee_mansion-2.2.4.dist-info/RECORD +0 -14
- {neelthee_mansion-2.2.4.dist-info → neelthee_mansion-2.3.0.dist-info}/WHEEL +0 -0
- {neelthee_mansion-2.2.4.dist-info → neelthee_mansion-2.3.0.dist-info}/entry_points.txt +0 -0
- {neelthee_mansion-2.2.4.dist-info → neelthee_mansion-2.3.0.dist-info}/top_level.txt +0 -0
@@ -15,7 +15,7 @@ GameState = {
|
|
15
15
|
Neel-thee's Mansion of Amnesia
|
16
16
|
'''
|
17
17
|
|
18
|
-
global player, evil_mage, commands, NOTE_NUM,
|
18
|
+
global player, evil_mage, commands, NOTE_NUM, credits, characters, color_coding, quest_manager
|
19
19
|
|
20
20
|
quest_manager = QuestManager()
|
21
21
|
|
@@ -24,10 +24,6 @@ color_coding = False
|
|
24
24
|
credits = '''
|
25
25
|
Made by: Alexander.E.F'''
|
26
26
|
|
27
|
-
# start the player in the Hall
|
28
|
-
CURRENTROOM = 'Hall'
|
29
|
-
|
30
|
-
LAST_ROOM = CURRENTROOM
|
31
27
|
|
32
28
|
name = ''
|
33
29
|
age = 0
|
@@ -130,9 +126,9 @@ map - Display the map of places you have been to
|
|
130
126
|
|
131
127
|
def showHint():
|
132
128
|
global player
|
133
|
-
if 'Hints' in ROOMS[CURRENTROOM]:
|
129
|
+
if 'Hints' in ROOMS[player.CURRENTROOM]:
|
134
130
|
type_text("You think:", colorTrue=color_coding)
|
135
|
-
hint = choice(ROOMS[CURRENTROOM]['Hints'])
|
131
|
+
hint = choice(ROOMS[player.CURRENTROOM]['Hints'])
|
136
132
|
type_text(hint, colorTrue=color_coding)
|
137
133
|
else:
|
138
134
|
type_text("You can't think of anything", colorTrue=color_coding)
|
@@ -201,9 +197,9 @@ def Use_grappling_hook():
|
|
201
197
|
else:
|
202
198
|
type_text("You flick the rope and it unhooks. You continue exploring the forest", colorTrue=color_coding)
|
203
199
|
|
204
|
-
if CURRENTROOM == 'Balcony' and 'grappling-hook' in player.inventory:
|
200
|
+
if player.CURRENTROOM == 'Balcony' and 'grappling-hook' in player.inventory:
|
205
201
|
swing_into_forest()
|
206
|
-
elif CURRENTROOM == 'Forest Clearing' and 'grappling-hook' in player.inventory:
|
202
|
+
elif player.CURRENTROOM == 'Forest Clearing' and 'grappling-hook' in player.inventory:
|
207
203
|
climb_into_house()
|
208
204
|
|
209
205
|
|
@@ -258,7 +254,6 @@ def Use(moveone, movetwo=None):
|
|
258
254
|
|
259
255
|
def Move(move):
|
260
256
|
global player
|
261
|
-
global CURRENTROOM, LAST_ROOM
|
262
257
|
|
263
258
|
|
264
259
|
def attempt_charter():
|
@@ -267,10 +262,10 @@ def Move(move):
|
|
267
262
|
player.money -= 10
|
268
263
|
if 'descovered' in ROOMS[newRoom] and not ROOMS[newRoom]['descovered']:
|
269
264
|
ROOMS[newRoom]['descovered'] = True
|
270
|
-
return ROOMS[CURRENTROOM]['directions'][move]
|
265
|
+
return ROOMS[player.CURRENTROOM]['directions'][move]
|
271
266
|
else:
|
272
267
|
type_text("You don't have enough money to charter a ship.", colorTrue=color_coding)
|
273
|
-
return CURRENTROOM
|
268
|
+
return player.CURRENTROOM
|
274
269
|
|
275
270
|
def attempt_move_to_garden():
|
276
271
|
global player
|
@@ -283,8 +278,7 @@ def Move(move):
|
|
283
278
|
|
284
279
|
def move_to_room():
|
285
280
|
global player
|
286
|
-
|
287
|
-
LAST_ROOM = CURRENTROOM
|
281
|
+
player.LASTROOM = player.CURRENTROOM
|
288
282
|
if move == '0':
|
289
283
|
return attempt_charter()
|
290
284
|
elif newRoom == 'Garden':
|
@@ -296,17 +290,17 @@ def Move(move):
|
|
296
290
|
ROOMS[newRoom]['descovered'] = True
|
297
291
|
return newRoom
|
298
292
|
|
299
|
-
if move in ROOMS[CURRENTROOM]['directions']:
|
300
|
-
newRoom = ROOMS[CURRENTROOM]['directions'][move]
|
301
|
-
CURRENTROOM = move_to_room()
|
293
|
+
if move in ROOMS[player.CURRENTROOM]['directions']:
|
294
|
+
newRoom = ROOMS[player.CURRENTROOM]['directions'][move]
|
295
|
+
player.CURRENTROOM = move_to_room()
|
302
296
|
return
|
303
297
|
elif move in ROOMS:
|
304
298
|
newRoom = move
|
305
299
|
if newRoom == 'Garden':
|
306
|
-
CURRENTROOM = attempt_move_to_garden()
|
300
|
+
player.CURRENTROOM = attempt_move_to_garden()
|
307
301
|
else:
|
308
|
-
CURRENTROOM = newRoom
|
309
|
-
|
302
|
+
player.CURRENTROOM = newRoom
|
303
|
+
player.LASTROOM = player.CURRENTROOM
|
310
304
|
return
|
311
305
|
type_text("You can't go that way!", colorTrue=color_coding)
|
312
306
|
|
@@ -332,21 +326,21 @@ def showStatus():
|
|
332
326
|
text = display_directions(text)
|
333
327
|
|
334
328
|
# Display the map if available
|
335
|
-
if 'map' in ROOMS[CURRENTROOM]:
|
329
|
+
if 'map' in ROOMS[player.CURRENTROOM]:
|
336
330
|
text += f'\n\nKey: {"; ".join(KEY)}\n'
|
337
|
-
text += f'\n{ROOMS[CURRENTROOM]["map"]}\n'
|
331
|
+
text += f'\n{ROOMS[player.CURRENTROOM]["map"]}\n'
|
338
332
|
|
339
333
|
# Display the description of the current room
|
340
|
-
text += ('\n' + str(ROOMS[CURRENTROOM]['info']))
|
334
|
+
text += ('\n' + str(ROOMS[player.CURRENTROOM]['info']))
|
341
335
|
|
342
336
|
text += f"\n---------------------------"
|
343
337
|
|
344
338
|
type_text(text, colorTrue=color_coding)
|
345
339
|
|
346
340
|
# Optionally display additional room description
|
347
|
-
if 'description' in ROOMS[CURRENTROOM] and ask_for_consent("Do you want to observe the area"):
|
341
|
+
if 'description' in ROOMS[player.CURRENTROOM] and ask_for_consent("Do you want to observe the area"):
|
348
342
|
type_text("The area:", colorTrue=color_coding)
|
349
|
-
type_text(ROOMS[CURRENTROOM]['description'], colorTrue=color_coding)
|
343
|
+
type_text(ROOMS[player.CURRENTROOM]['description'], colorTrue=color_coding)
|
350
344
|
|
351
345
|
|
352
346
|
def display_directions(text):
|
@@ -371,14 +365,14 @@ def display_directions(text):
|
|
371
365
|
}
|
372
366
|
}
|
373
367
|
|
374
|
-
room_type = ROOMS[CURRENTROOM]['room type']
|
368
|
+
room_type = ROOMS[player.CURRENTROOM]['room type']
|
375
369
|
if room_type in direction_descriptions:
|
376
370
|
for direction in directions:
|
377
|
-
if direction in ROOMS[CURRENTROOM]['directions']:
|
371
|
+
if direction in ROOMS[player.CURRENTROOM]['directions']:
|
378
372
|
if direction != 'teleport':
|
379
373
|
text += f'\n{direction_descriptions[room_type][direction]} %*GREEN*%{direction}%*RESET*%.'
|
380
374
|
|
381
|
-
if 'teleport' in ROOMS[CURRENTROOM]['directions']:
|
375
|
+
if 'teleport' in ROOMS[player.CURRENTROOM]['directions']:
|
382
376
|
text += "\nThere is a %*GREEN*%teleport%*RESET*%ation circle on the ground"
|
383
377
|
|
384
378
|
return text
|
@@ -601,9 +595,9 @@ def handle_go_command(direction):
|
|
601
595
|
Move(direction)
|
602
596
|
|
603
597
|
def handle_get_command(player: PC, item_name):
|
604
|
-
if "item" in ROOMS[CURRENTROOM] and item_name == ROOMS[CURRENTROOM]['item'].name:
|
605
|
-
player.inventory_add([ROOMS[CURRENTROOM]['item']])
|
606
|
-
del ROOMS[CURRENTROOM]['item']
|
598
|
+
if "item" in ROOMS[player.CURRENTROOM] and item_name == ROOMS[player.CURRENTROOM]['item'].name:
|
599
|
+
player.inventory_add([ROOMS[player.CURRENTROOM]['item']])
|
600
|
+
del ROOMS[player.CURRENTROOM]['item']
|
607
601
|
type_text(f'%*BLUE*%{item_name}%*RESET*% got!', colorTrue=color_coding)
|
608
602
|
else:
|
609
603
|
type_text(f"Can't get {item_name}!", colorTrue=color_coding)
|
@@ -611,11 +605,11 @@ def handle_get_command(player: PC, item_name):
|
|
611
605
|
def handle_look_command():
|
612
606
|
global player
|
613
607
|
return_ = False
|
614
|
-
if 'item' in ROOMS[CURRENTROOM]:
|
615
|
-
type_text(f'The item in the room: %*BLUE*%{ROOMS[CURRENTROOM]["item"].name}%*RESET*%.', colorTrue=color_coding)
|
608
|
+
if 'item' in ROOMS[player.CURRENTROOM]:
|
609
|
+
type_text(f'The item in the room: %*BLUE*%{ROOMS[player.CURRENTROOM]["item"].name}%*RESET*%.', colorTrue=color_coding)
|
616
610
|
return_ = True
|
617
|
-
if 'containers' in ROOMS[CURRENTROOM]:
|
618
|
-
type_text(f"The containers here are: %*RED*%{', '.join(ROOMS[CURRENTROOM]['containers'].keys())}%*RESET*%", colorTrue=color_coding)
|
611
|
+
if 'containers' in ROOMS[player.CURRENTROOM]:
|
612
|
+
type_text(f"The containers here are: %*RED*%{', '.join(ROOMS[player.CURRENTROOM]['containers'].keys())}%*RESET*%", colorTrue=color_coding)
|
619
613
|
return_ = True
|
620
614
|
if return_:
|
621
615
|
return
|
@@ -626,32 +620,32 @@ def handle_use_command(item = None, sub_item = None):
|
|
626
620
|
Use(item, sub_item)
|
627
621
|
|
628
622
|
def handle_search_command(player, container = None, sub_container = None):
|
629
|
-
if 'containers' in ROOMS[CURRENTROOM]:
|
630
|
-
if container == 'the' and sub_container in ROOMS[CURRENTROOM]['containers'] and not all_same_value(ROOMS[CURRENTROOM]['containers'][sub_container].contents, None):
|
623
|
+
if 'containers' in ROOMS[player.CURRENTROOM]:
|
624
|
+
if container == 'the' and sub_container in ROOMS[player.CURRENTROOM]['containers'] and not all_same_value(ROOMS[player.CURRENTROOM]['containers'][sub_container].contents, None):
|
631
625
|
search_container(player, sub_container)
|
632
|
-
elif container in ROOMS[CURRENTROOM]['containers'] and not all_same_value(ROOMS[CURRENTROOM]['containers'][container].contents, None):
|
626
|
+
elif container in ROOMS[player.CURRENTROOM]['containers'] and not all_same_value(ROOMS[player.CURRENTROOM]['containers'][container].contents, None):
|
633
627
|
search_container(player, container)
|
634
628
|
else:
|
635
629
|
type_text(f"You cannot search the {container}", colorTrue=color_coding)
|
636
630
|
|
637
631
|
def search_container(player: PC, container):
|
638
|
-
player.inventory_add(ROOMS[CURRENTROOM]['containers'][container].contents)
|
639
|
-
type_text(f"You search the{' secret' if ROOMS[CURRENTROOM]['containers'][container].secret else ''} %*RED*%{container}%*RESET*% and find a ", newline=False, colorTrue=color_coding)
|
640
|
-
for searchitem in ROOMS[CURRENTROOM]['containers'][container].contents:
|
632
|
+
player.inventory_add(ROOMS[player.CURRENTROOM]['containers'][container].contents)
|
633
|
+
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)
|
634
|
+
for searchitem in ROOMS[player.CURRENTROOM]['containers'][container].contents:
|
641
635
|
if searchitem:
|
642
636
|
if isinstance(searchitem, item):
|
643
|
-
end_str = ' and a ' if ROOMS[CURRENTROOM]['containers'][container].contents.index(searchitem) < last_index(ROOMS[CURRENTROOM]['containers'][container].contents) else '\n'
|
637
|
+
end_str = ' and a ' if ROOMS[player.CURRENTROOM]['containers'][container].contents.index(searchitem) < last_index(ROOMS[player.CURRENTROOM]['containers'][container].contents) else '\n'
|
644
638
|
type_text(f"%*BLUE*%{searchitem.name}%*RESET*%{end_str}", newline=False, colorTrue=color_coding)
|
645
|
-
ROOMS[CURRENTROOM]['containers'][container].contents = []
|
639
|
+
ROOMS[player.CURRENTROOM]['containers'][container].contents = []
|
646
640
|
|
647
641
|
|
648
642
|
def handle_put_command(player: PC, PutItem: item = None, container = None, sub_container = None):
|
649
643
|
if PutItem in player.inventory:
|
650
|
-
if 'containers' in ROOMS[CURRENTROOM]:
|
651
|
-
if container == 'the' and sub_container in ROOMS[CURRENTROOM]['containers']:
|
644
|
+
if 'containers' in ROOMS[player.CURRENTROOM]:
|
645
|
+
if container == 'the' and sub_container in ROOMS[player.CURRENTROOM]['containers']:
|
652
646
|
put_in_container(player, player.inventory[player.inventory.index(PutItem)], sub_container)
|
653
647
|
return
|
654
|
-
elif container in ROOMS[CURRENTROOM]['containers']:
|
648
|
+
elif container in ROOMS[player.CURRENTROOM]['containers']:
|
655
649
|
put_in_container(player, player.inventory[player.inventory.index(PutItem)], container)
|
656
650
|
return
|
657
651
|
type_text(f"You cannot put the {PutItem.name} in the {container}", colorTrue=color_coding)
|
@@ -659,22 +653,22 @@ def handle_put_command(player: PC, PutItem: item = None, container = None, sub_c
|
|
659
653
|
|
660
654
|
def put_in_container(player: PC, PutItem = None, container = None):
|
661
655
|
player.inventory.remove(PutItem.name)
|
662
|
-
if not ROOMS[CURRENTROOM]['containers'][container].contents:
|
663
|
-
ROOMS[CURRENTROOM][container].contents = []
|
664
|
-
if not isinstance(ROOMS[CURRENTROOM][container].contents, list):
|
665
|
-
ROOMS[CURRENTROOM]['containers'][container].contents = [ROOMS[CURRENTROOM]['containers'][container].contents]
|
666
|
-
ROOMS[CURRENTROOM]['containers'][container].contents += [PutItem]
|
656
|
+
if not ROOMS[player.CURRENTROOM]['containers'][container].contents:
|
657
|
+
ROOMS[player.CURRENTROOM][container].contents = []
|
658
|
+
if not isinstance(ROOMS[player.CURRENTROOM][container].contents, list):
|
659
|
+
ROOMS[player.CURRENTROOM]['containers'][container].contents = [ROOMS[player.CURRENTROOM]['containers'][container].contents]
|
660
|
+
ROOMS[player.CURRENTROOM]['containers'][container].contents += [PutItem]
|
667
661
|
type_text(f"You put you're %*BLUE*%{PutItem.name}%*RESET*% into the %*RED*%{container}%*RESET*%", colorTrue=color_coding)
|
668
662
|
|
669
663
|
|
670
664
|
|
671
665
|
def handle_get_quest_command(questnum):
|
672
666
|
global player
|
673
|
-
if 'quests' in ROOMS[CURRENTROOM]:
|
674
|
-
if questnum in ROOMS[CURRENTROOM]['quests']:
|
675
|
-
quest_manager.add_quest(ROOMS[CURRENTROOM]['quests'][questnum])
|
676
|
-
quest_manager.start_quest(ROOMS[CURRENTROOM]['quests'][questnum])
|
677
|
-
del ROOMS[CURRENTROOM]['quests'][questnum]
|
667
|
+
if 'quests' in ROOMS[player.CURRENTROOM]:
|
668
|
+
if questnum in ROOMS[player.CURRENTROOM]['quests']:
|
669
|
+
quest_manager.add_quest(ROOMS[player.CURRENTROOM]['quests'][questnum])
|
670
|
+
quest_manager.start_quest(ROOMS[player.CURRENTROOM]['quests'][questnum])
|
671
|
+
del ROOMS[player.CURRENTROOM]['quests'][questnum]
|
678
672
|
|
679
673
|
|
680
674
|
def PrintMap():
|
@@ -691,7 +685,7 @@ def handle_hungry_bear(player: PC, enemy: creature):
|
|
691
685
|
del player.inventory[player.inventory.index('potion')]
|
692
686
|
type_text(f'You throw the potion at the bear and it explodes into a puff of magic smoke that stuns the bear!', colorTrue=color_coding)
|
693
687
|
if enemy_reacting:
|
694
|
-
return battle(player, enemy,
|
688
|
+
return battle(player, enemy, player.LASTROOM)
|
695
689
|
|
696
690
|
def handle_grumpy_pig(player: PC, enemy: creature):
|
697
691
|
enemy_reacting = True
|
@@ -699,7 +693,7 @@ def handle_grumpy_pig(player: PC, enemy: creature):
|
|
699
693
|
if ask_for_consent("Do you want to use your saddle and pig-rod on the pig"):
|
700
694
|
enemy_reacting = False
|
701
695
|
type_text(f'You throw a saddle onto the pig and leap on steering it about with a pig fishing rod!', colorTrue=color_coding)
|
702
|
-
del ROOMS[CURRENTROOM]['creatures stats']
|
696
|
+
del ROOMS[player.CURRENTROOM]['creatures stats']
|
703
697
|
del player.inventory[player.inventory.index('saddle')]
|
704
698
|
del player.inventory[player.inventory.index('pig-rod')]
|
705
699
|
player.inventory_add(item['pig-steed'])
|
@@ -708,17 +702,17 @@ def handle_grumpy_pig(player: PC, enemy: creature):
|
|
708
702
|
if ask_for_consent("Do you want to use your torch to scare the pig away"):
|
709
703
|
enemy_reacting = False
|
710
704
|
type_text(f'You wave your torch at the pig and it runs away through a tiny open window.', colorTrue=color_coding)
|
711
|
-
del ROOMS[CURRENTROOM]['creatures stats']
|
705
|
+
del ROOMS[player.CURRENTROOM]['creatures stats']
|
712
706
|
player.xp += 5
|
713
|
-
if '
|
707
|
+
if 'rations' in player.inventory:
|
714
708
|
if ask_for_consent("Do you want to throw your ration at the pig"):
|
715
709
|
enemy_reacting = False
|
716
710
|
type_text(f"You quickly throw rations at the pig. It still doesn't look happy though.", colorTrue=color_coding)
|
717
|
-
del player.inventory[player.inventory.index('
|
711
|
+
del player.inventory[player.inventory.index('rations')]
|
718
712
|
player.xp += 15
|
719
713
|
|
720
714
|
if enemy_reacting:
|
721
|
-
return battle(player, enemy,
|
715
|
+
return battle(player, enemy, player.LASTROOM)
|
722
716
|
|
723
717
|
def handle_greedy_goblin(player: PC, enemy: creature):
|
724
718
|
enemy_reacting = True
|
@@ -729,7 +723,7 @@ def handle_greedy_goblin(player: PC, enemy: creature):
|
|
729
723
|
player.money -= 15
|
730
724
|
enemy.dropped_items[1].value += 15
|
731
725
|
if enemy_reacting:
|
732
|
-
return battle(player, enemy,
|
726
|
+
return battle(player, enemy, player.LASTROOM)
|
733
727
|
|
734
728
|
commands = {
|
735
729
|
'go': handle_go_command,
|
@@ -750,28 +744,61 @@ commands = {
|
|
750
744
|
def quit():
|
751
745
|
exit()
|
752
746
|
|
753
|
-
def do_random_event():
|
754
|
-
if 'Random events' in ROOMS[CURRENTROOM] and 'Event chance' in ROOMS[CURRENTROOM]:
|
755
|
-
if random() <= ROOMS[CURRENTROOM]['Event chance']:
|
756
|
-
if is_executable(Event['Event code']):
|
757
|
-
Event = choice(ROOMS[CURRENTROOM]['Random events'])
|
758
|
-
type_text(Event['Output text'])
|
759
|
-
exec(Event['Event code'])
|
760
|
-
|
761
747
|
guards = [
|
762
748
|
Guard(
|
763
749
|
name="Guard",
|
764
750
|
hp=10,
|
765
751
|
atpw=4,
|
766
|
-
description="A
|
767
|
-
flavor_text="A human guard spots you and says: 'You shouldn't be here'",
|
768
|
-
type
|
752
|
+
description="A 5'8\" human guard who looks like he doesn't belong here.",
|
753
|
+
flavor_text="A human guard spots you and says: 'You shouldn't be here.'",
|
754
|
+
type=creature_type('humanoid', 'human'),
|
769
755
|
current_room="Bedroom",
|
770
756
|
patrol_route=["Bedroom", "Office", "Tower Bottom", "Landing", "Bedroom"],
|
771
|
-
patrol_type='
|
772
|
-
|
757
|
+
patrol_type='normal'
|
758
|
+
),
|
759
|
+
Guard(
|
760
|
+
name="Wolf",
|
761
|
+
hp=10,
|
762
|
+
atpw=4,
|
763
|
+
description="A large wolf with blood covering its face.",
|
764
|
+
flavor_text="A wolf spots you and growls.",
|
765
|
+
type=creature_type('beast', 'wolf'),
|
766
|
+
current_room="Balcony",
|
767
|
+
patrol_type='random',
|
768
|
+
frendly_text="The wolf nuzzles you"
|
769
|
+
),
|
773
770
|
]
|
774
771
|
|
772
|
+
def handle_wolf(player: PC, wolf: Guard):
|
773
|
+
enemy_reacting = True
|
774
|
+
if 'rations' in player.inventory:
|
775
|
+
if ask_for_consent("Do you want to give your ration to the wolf"):
|
776
|
+
enemy_reacting = False
|
777
|
+
type_text(
|
778
|
+
"You quickly give your rations to the wolf. It looks happy, walks up to you, and nuzzles you.",
|
779
|
+
colorTrue=color_coding
|
780
|
+
)
|
781
|
+
player.inventory.remove('rations')
|
782
|
+
wolf.patrol_type = "follow"
|
783
|
+
wolf.frendly = True
|
784
|
+
return wolf
|
785
|
+
if enemy_reacting:
|
786
|
+
return battle(player, wolf, player.LASTROOM)
|
787
|
+
|
788
|
+
def handle_guard_action(guard):
|
789
|
+
# Dynamically build the function name
|
790
|
+
function_name = f"handle_{guard.name.lower()}"
|
791
|
+
|
792
|
+
# Use globals() to retrieve the function by name
|
793
|
+
function_to_call = globals().get(function_name)
|
794
|
+
|
795
|
+
if function_to_call:
|
796
|
+
# Call the found function
|
797
|
+
guard = function_to_call(player, guard)
|
798
|
+
return [True, guard] # Function was found and called
|
799
|
+
else:
|
800
|
+
return [False, guard] # Function was not found
|
801
|
+
|
775
802
|
def main():
|
776
803
|
global player, color_coding
|
777
804
|
global charactersList
|
@@ -813,6 +840,8 @@ def main():
|
|
813
840
|
|
814
841
|
color_coding = loop_til_valid_input("Do you want color coding (Y/N)?", "you didn't answer Y or N.", Y_N).value
|
815
842
|
|
843
|
+
|
844
|
+
# start the player in the Hall and sets up everything else
|
816
845
|
player = PC(
|
817
846
|
name,
|
818
847
|
age,
|
@@ -835,20 +864,21 @@ def main():
|
|
835
864
|
f"Your favorite weapon is a bow; however, the scimitar is a close second.",
|
836
865
|
],
|
837
866
|
backstory=f"""
|
838
|
-
|
839
|
-
|
867
|
+
You were born into a life of solitude as an only child. Your father was always away on grand adventures and passed away when you were just {7 if age >= 7 else age}. Your mother, a dedicated
|
868
|
+
baker, raised you alone. Although she did her best, you spent most of your time helping her in the bakery rather than attending school, which left you feeling quite isolated.
|
840
869
|
|
841
|
-
|
842
|
-
|
843
|
-
|
870
|
+
At the age of {14 if age >= 14 else age}, driven by a desire for glory and a wish to end the war, you left home to join the army. You spent your first year in rigorous training, followed by a
|
871
|
+
harsh life on the front lines. Against all odds, you survived, forging bonds with three close friends—though one of them tragically died in battle. Your journey took you from the heights of
|
872
|
+
mountains to the vast expanses of the ocean, each experience shaping who you are.
|
844
873
|
|
845
|
-
|
846
|
-
|
847
|
-
|
874
|
+
You were deeply influenced by the heroes of your childhood—Sam and Aragorn from %*ITALIC*%Lord of the Rings%*RESET*%, which you read as a child, and the characters from %*ITALIC*%The Hunger
|
875
|
+
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
|
876
|
+
fondness for the scimitar.
|
848
877
|
|
849
|
-
|
850
|
-
|
851
|
-
|
878
|
+
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
|
879
|
+
must navigate the mansion and uncover the truth behind your captivity, all while drawing strength from the remnants of your past.
|
880
|
+
""",
|
881
|
+
CURRENTROOM='Hall'
|
852
882
|
)
|
853
883
|
|
854
884
|
# shows the instructions
|
@@ -861,18 +891,28 @@ def main():
|
|
861
891
|
# Move guards
|
862
892
|
for guard in guards:
|
863
893
|
if isinstance(guard, Guard):
|
864
|
-
guard.move(ROOMS)
|
894
|
+
guard.move(ROOMS, player)
|
865
895
|
|
866
896
|
# Check for detection
|
867
897
|
for guard in guards:
|
868
|
-
|
869
|
-
if guard
|
870
|
-
guard.
|
871
|
-
|
898
|
+
#try:
|
899
|
+
if isinstance(guard, Guard):
|
900
|
+
if guard.check_detection(player.CURRENTROOM):
|
901
|
+
guard_handled = handle_guard_action(guard)
|
902
|
+
if not isinstance(guard_handled, list):
|
903
|
+
guard_handled = [guard_handled]
|
904
|
+
if not guard_handled[0]:
|
905
|
+
guard.type_text_flavor_text()
|
906
|
+
guards[guards.index(guard)] = battle(player, guard, player.LASTROOM)
|
907
|
+
else:
|
908
|
+
guards[guards.index(guard)] = guard_handled[1]
|
909
|
+
#except:
|
910
|
+
# guard.type_text_flavor_text()
|
911
|
+
# guards[guards.index(guard)] = battle(player, guard, player.LASTROOM)
|
872
912
|
|
873
913
|
# player loses if they enter a room with a monster, unless they can fight it.
|
874
|
-
if 'creatures stats' in ROOMS[CURRENTROOM]:
|
875
|
-
enemies = ROOMS[CURRENTROOM]['creatures stats']
|
914
|
+
if 'creatures stats' in ROOMS[player.CURRENTROOM]:
|
915
|
+
enemies = ROOMS[player.CURRENTROOM]['creatures stats']
|
876
916
|
if not isinstance(enemies, list):
|
877
917
|
enemies = [enemies] # Ensure enemies is a list even if there's only one creature
|
878
918
|
|
@@ -891,27 +931,26 @@ def main():
|
|
891
931
|
enemy_REF = handle_greedy_goblin(player, enemy)
|
892
932
|
enemies[enemies.index(enemy)] = enemy_REF
|
893
933
|
else:
|
894
|
-
enemy_REF = battle(player, enemy,
|
934
|
+
enemy_REF = battle(player, enemy, player.LASTROOM)
|
895
935
|
enemies[enemies.index(enemy)] = enemy_REF
|
896
936
|
|
897
937
|
if all_same_value(enemies, False):
|
898
|
-
del ROOMS[CURRENTROOM]['creatures stats']
|
938
|
+
del ROOMS[player.CURRENTROOM]['creatures stats']
|
899
939
|
else:
|
900
|
-
ROOMS[CURRENTROOM]['creatures stats'] = enemies
|
940
|
+
ROOMS[player.CURRENTROOM]['creatures stats'] = enemies
|
901
941
|
|
902
|
-
if 'NPCs' in ROOMS[CURRENTROOM]:
|
903
|
-
for npcname, npcstats in ROOMS[CURRENTROOM]['NPCs'].items():
|
942
|
+
if 'NPCs' in ROOMS[player.CURRENTROOM]:
|
943
|
+
for npcname, npcstats in ROOMS[player.CURRENTROOM]['NPCs'].items():
|
904
944
|
if ask_for_consent("Do you want to interact with this NPC") or npcstats.aggressive:
|
905
945
|
npcstats.interact
|
906
946
|
if npcstats.aggressive:
|
907
|
-
ROOMS[CURRENTROOM]['NPCs'][npcname] = battle(player, npcstats)
|
947
|
+
ROOMS[player.CURRENTROOM]['NPCs'][npcname] = battle(player, npcstats)
|
908
948
|
|
909
949
|
player.special_ability.Tick()
|
910
950
|
quest_manager.update_objective(f"Kill {GameState['Enemys killed']} creatures")
|
911
951
|
for ___ in GameState['collected items']:
|
912
952
|
if isinstance(___, item):
|
913
953
|
quest_manager.update_objective(f"Colect {___.name}")
|
914
|
-
do_random_event()
|
915
954
|
|
916
955
|
|
917
956
|
|
neelthee_mansion/Rooms.py
CHANGED
@@ -176,13 +176,6 @@ ROOMS = {
|
|
176
176
|
'I wonder if there is anything salvageable in the %*RED*%cupboards%*RESET*%',
|
177
177
|
'I should probably look around',
|
178
178
|
],
|
179
|
-
'Event chance': 0.1,
|
180
|
-
'Random events': [
|
181
|
-
{
|
182
|
-
'Output text': "You hear a bang and the cupboard door swings open slowly and the cord is gone",
|
183
|
-
'Event code': "ROOMS['Kitchen']['containers']['cupboards'].take_contents()"
|
184
|
-
},
|
185
|
-
],
|
186
179
|
},
|
187
180
|
|
188
181
|
'Dining Room': {
|
@@ -457,7 +450,7 @@ You notice a ''%*RED*%storage%*RESET*% device in one corner. You hear a %*YELLOW
|
|
457
450
|
'up': 'Tower Top',
|
458
451
|
},
|
459
452
|
'containers': {
|
460
|
-
'
|
453
|
+
'stone': container([item('money-pouch', 'valuable', 25)], True),
|
461
454
|
},
|
462
455
|
'item': item('tome'),
|
463
456
|
'info': 'You are in the middle of a stone tower. The only light comes from above, through the cracks around the hatch to above.',
|
neelthee_mansion/creatures.py
CHANGED
@@ -152,7 +152,7 @@ class Guard(creature):
|
|
152
152
|
patrol_route (list[str]): The list of rooms the guard patrols through.
|
153
153
|
"""
|
154
154
|
|
155
|
-
def __init__(self, name: str, hp: int, atpw: int, dropped_items: list[str] = [], description: str = None, flavor_text: str = None, type: creature_type = creature_type('humanoid'), crit_chance: float = 0.05, current_room: str = None, patrol_route: list[str] = None, patrol_type: str = 'normal'):
|
155
|
+
def __init__(self, name: str, hp: int, atpw: int, dropped_items: list[str] = [], description: str = None, flavor_text: str = None, type: creature_type = creature_type('humanoid'), crit_chance: float = 0.05, current_room: str = None, patrol_route: list[str] = None, patrol_type: str = 'normal', frendly_text: str = ""):
|
156
156
|
"""
|
157
157
|
Initializes a new guard instance.
|
158
158
|
|
@@ -167,14 +167,16 @@ class Guard(creature):
|
|
167
167
|
crit_chance (float, optional): The chance of the guard landing a critical hit. Defaults to 0.05.
|
168
168
|
current_room (str, optional): The current room where the guard is located. Defaults to None.
|
169
169
|
patrol_route (list[str], optional): The list of rooms the guard patrols through. Defaults to None.
|
170
|
-
patrol_type (str): The type of patrol the guard is doing. Defaults to
|
170
|
+
patrol_type (str): The type of patrol the guard is doing. Defaults to normal.
|
171
171
|
"""
|
172
172
|
super().__init__(name, hp, atpw, dropped_items, description, flavor_text, type, crit_chance)
|
173
173
|
self.current_room = current_room
|
174
174
|
self.patrol_route = patrol_route or []
|
175
175
|
self.patrol_type = patrol_type
|
176
|
+
self.frendly = False
|
177
|
+
self.frendly_text = frendly_text
|
176
178
|
|
177
|
-
def move(self, ROOMS):
|
179
|
+
def move(self, ROOMS, player):
|
178
180
|
"""
|
179
181
|
Moves the guard depending on his patrol type.
|
180
182
|
"""
|
@@ -189,6 +191,11 @@ class Guard(creature):
|
|
189
191
|
for direction, room in ROOMS[self.current_room]['directions'].items():
|
190
192
|
rooms.append(room)
|
191
193
|
self.current_room = choice(rooms)
|
194
|
+
elif self.patrol_type == 'follow':
|
195
|
+
for direction, room in ROOMS[self.current_room]['directions'].items():
|
196
|
+
if room == player.CURRENTROOM:
|
197
|
+
self.current_room = room
|
198
|
+
return
|
192
199
|
|
193
200
|
def check_detection(self, player_room):
|
194
201
|
"""
|
@@ -200,9 +207,12 @@ class Guard(creature):
|
|
200
207
|
Returns:
|
201
208
|
bool: True if the player is detected, False otherwise.
|
202
209
|
"""
|
203
|
-
if self.current_room == player_room:
|
210
|
+
if self.current_room == player_room and not self.frendly:
|
204
211
|
type_text(f"You have been caught by {self.name} in the {self.current_room}!")
|
205
212
|
return True
|
213
|
+
elif self.current_room == player_room and self.frendly:
|
214
|
+
if random() <= 0.015:
|
215
|
+
type_text(self.frendly_text)
|
206
216
|
return False
|
207
217
|
|
208
218
|
class base_ability:
|
@@ -253,12 +263,16 @@ class PC(base_character):
|
|
253
263
|
money: int = 0,
|
254
264
|
weapons_atpws: list = [],
|
255
265
|
backstory: str = "",
|
266
|
+
CURRENTROOM: str = "",
|
267
|
+
LASTROOM: str = None,
|
256
268
|
):
|
257
269
|
if not xp:
|
258
270
|
if Level == 1:
|
259
271
|
xp = 0
|
260
272
|
else:
|
261
273
|
xp = Level*25
|
274
|
+
if not LASTROOM:
|
275
|
+
LASTROOM = CURRENTROOM
|
262
276
|
self.name = Name
|
263
277
|
self.Age = Age
|
264
278
|
self.Class = Class
|
@@ -279,6 +293,8 @@ class PC(base_character):
|
|
279
293
|
self.defending = False
|
280
294
|
self.special_ability = special_ability
|
281
295
|
self.backstory = backstory
|
296
|
+
self.CURRENTROOM = CURRENTROOM
|
297
|
+
self.LASTROOM = LASTROOM
|
282
298
|
|
283
299
|
def get_change_weapon(self, weapon_atpw: int = 0, weapon_index: int = -1):
|
284
300
|
if weapon_atpw > 0:
|
neelthee_mansion/utils.py
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
neelthee_mansion/Mansion_of_Amnesia.py,sha256=JCSdsmTrXrw98qkqIh7Qm8KAVFlXb1u_MH6fF2gZwy0,39888
|
2
|
+
neelthee_mansion/Quests.py,sha256=q6VzR3mt9AYe29ACWZuf-suz4yOKrL946aJ493eQRS0,2611
|
3
|
+
neelthee_mansion/Rooms.py,sha256=cghI0JMfBakNub5UWtMz2MWr6ezgYbVtZnNJ9BGzOok,81148
|
4
|
+
neelthee_mansion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
neelthee_mansion/__main__.py,sha256=OIAWZ04le70DyjtR4hlmK9csHej7EHxeUrMoNnM-Vjc,95
|
6
|
+
neelthee_mansion/all_game_utils.py,sha256=Xfty9uXiYAfmA6iVzJurq852ZBPn7a4gQUcUcaV9yEU,341
|
7
|
+
neelthee_mansion/creatures.py,sha256=xcOWjMapXXMes6YqpZFjc4BvWnSakx8neMn7OPN6WaM,14786
|
8
|
+
neelthee_mansion/items.py,sha256=uzZ9fq6_YK3oQ2lkAsyidWwM6trasVsjdQi2V0JTPfw,2097
|
9
|
+
neelthee_mansion/utils.py,sha256=7JkgDw4Tq3EG11DqX05tjisoGxE0L_Sd7VkqkU8x-jQ,11486
|
10
|
+
neelthee_mansion-2.3.0.dist-info/METADATA,sha256=2QU5vA_uF-BTOMJoVVt6OOdvgGSrW3tCct724mHaYGo,1680
|
11
|
+
neelthee_mansion-2.3.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
12
|
+
neelthee_mansion-2.3.0.dist-info/entry_points.txt,sha256=j5ScTTyIidFhmT3F6hcX9pnlom4cJdDmfe26BmM6Igo,56
|
13
|
+
neelthee_mansion-2.3.0.dist-info/top_level.txt,sha256=woQImQewylhly5Rb24HwPEGMxPY6do_PaUwGd5BNLOM,17
|
14
|
+
neelthee_mansion-2.3.0.dist-info/RECORD,,
|
@@ -1,14 +0,0 @@
|
|
1
|
-
neelthee_mansion/Mansion_of_Amnesia.py,sha256=4jMfqF_eBOpThpG7mKYkO_fUqk_qbJi7q8ftKiL1xGU,37893
|
2
|
-
neelthee_mansion/Quests.py,sha256=q6VzR3mt9AYe29ACWZuf-suz4yOKrL946aJ493eQRS0,2611
|
3
|
-
neelthee_mansion/Rooms.py,sha256=gsuHlQWclcEExt9c59-D-ElEk0uOMZpZogFjSYjetUc,81539
|
4
|
-
neelthee_mansion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
neelthee_mansion/__main__.py,sha256=OIAWZ04le70DyjtR4hlmK9csHej7EHxeUrMoNnM-Vjc,95
|
6
|
-
neelthee_mansion/all_game_utils.py,sha256=Xfty9uXiYAfmA6iVzJurq852ZBPn7a4gQUcUcaV9yEU,341
|
7
|
-
neelthee_mansion/creatures.py,sha256=AwK38v_aLxV26mZtAZeSSeAQpZd66bL8zW7Hd7U4qR8,14058
|
8
|
-
neelthee_mansion/items.py,sha256=uzZ9fq6_YK3oQ2lkAsyidWwM6trasVsjdQi2V0JTPfw,2097
|
9
|
-
neelthee_mansion/utils.py,sha256=IfaFlIDPGMxW5eBNDTuRi-wFpPwPKSThdjYGpOZphYs,11494
|
10
|
-
neelthee_mansion-2.2.4.dist-info/METADATA,sha256=gnC-yRmQe7iVLlmc8KmjG1fndofBaAU9M2A5kGLGYw8,1680
|
11
|
-
neelthee_mansion-2.2.4.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
12
|
-
neelthee_mansion-2.2.4.dist-info/entry_points.txt,sha256=j5ScTTyIidFhmT3F6hcX9pnlom4cJdDmfe26BmM6Igo,56
|
13
|
-
neelthee_mansion-2.2.4.dist-info/top_level.txt,sha256=woQImQewylhly5Rb24HwPEGMxPY6do_PaUwGd5BNLOM,17
|
14
|
-
neelthee_mansion-2.2.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|