summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--items.py15
-rw-r--r--player_logic.py31
2 files changed, 29 insertions, 17 deletions
diff --git a/items.py b/items.py index 7b1a650..9f8bf56 100644 --- a/items.py +++ b/items.py
@@ -24,14 +24,6 @@ class ItemData(NamedTuple):
24 return world.options.shuffle_colors > 0 24 return world.options.shuffle_colors > 0
25 elif self.mode == "doors": 25 elif self.mode == "doors":
26 return world.options.shuffle_doors != ShuffleDoors.option_none 26 return world.options.shuffle_doors != ShuffleDoors.option_none
27 elif self.mode == "orange tower":
28 # door shuffle is on and tower isn't progressive
29 return world.options.shuffle_doors != ShuffleDoors.option_none \
30 and not world.options.progressive_orange_tower
31 elif self.mode == "the colorful":
32 # complex door shuffle is on and colorful isn't progressive
33 return world.options.shuffle_doors == ShuffleDoors.option_complex \
34 and not world.options.progressive_colorful
35 elif self.mode == "complex door": 27 elif self.mode == "complex door":
36 return world.options.shuffle_doors == ShuffleDoors.option_complex 28 return world.options.shuffle_doors == ShuffleDoors.option_complex
37 elif self.mode == "door group": 29 elif self.mode == "door group":
@@ -72,12 +64,7 @@ def load_item_data():
72 door_groups.setdefault(door.group, []).extend(door.door_ids) 64 door_groups.setdefault(door.group, []).extend(door.door_ids)
73 65
74 if room_name in PROGRESSION_BY_ROOM and door_name in PROGRESSION_BY_ROOM[room_name]: 66 if room_name in PROGRESSION_BY_ROOM and door_name in PROGRESSION_BY_ROOM[room_name]:
75 if room_name == "Orange Tower": 67 door_mode = "special"
76 door_mode = "orange tower"
77 elif room_name == "The Colorful":
78 door_mode = "the colorful"
79 else:
80 door_mode = "special"
81 68
82 ALL_ITEM_TABLE[door.item_name] = \ 69 ALL_ITEM_TABLE[door.item_name] = \
83 ItemData(get_door_item_id(room_name, door_name), 70 ItemData(get_door_item_id(room_name, door_name),
diff --git a/player_logic.py b/player_logic.py index b2e5f77..0ae3035 100644 --- a/player_logic.py +++ b/player_logic.py
@@ -1,3 +1,4 @@
1from enum import Enum
1from typing import Dict, List, NamedTuple, Optional, Set, Tuple, TYPE_CHECKING 2from typing import Dict, List, NamedTuple, Optional, Set, Tuple, TYPE_CHECKING
2 3
3from .items import ALL_ITEM_TABLE 4from .items import ALL_ITEM_TABLE
@@ -36,6 +37,27 @@ class PlayerLocation(NamedTuple):
36 access: AccessRequirements 37 access: AccessRequirements
37 38
38 39
40class ProgressiveItemBehavior(Enum):
41 DISABLE = 1
42 SPLIT = 2
43 PROGRESSIVE = 3
44
45
46def should_split_progression(progression_name: str, world: "LingoWorld") -> ProgressiveItemBehavior:
47 if progression_name == "Progressive Orange Tower":
48 if world.options.progressive_orange_tower:
49 return ProgressiveItemBehavior.PROGRESSIVE
50 else:
51 return ProgressiveItemBehavior.SPLIT
52 elif progression_name == "Progressive Colorful":
53 if world.options.progressive_colorful:
54 return ProgressiveItemBehavior.PROGRESSIVE
55 else:
56 return ProgressiveItemBehavior.SPLIT
57
58 return ProgressiveItemBehavior.PROGRESSIVE
59
60
39class LingoPlayerLogic: 61class LingoPlayerLogic:
40 """ 62 """
41 Defines logic after a player's options have been applied 63 Defines logic after a player's options have been applied
@@ -83,10 +105,13 @@ class LingoPlayerLogic:
83 105
84 def handle_non_grouped_door(self, room_name: str, door_data: Door, world: "LingoWorld"): 106 def handle_non_grouped_door(self, room_name: str, door_data: Door, world: "LingoWorld"):
85 if room_name in PROGRESSION_BY_ROOM and door_data.name in PROGRESSION_BY_ROOM[room_name]: 107 if room_name in PROGRESSION_BY_ROOM and door_data.name in PROGRESSION_BY_ROOM[room_name]:
86 if (room_name == "Orange Tower" and not world.options.progressive_orange_tower)\ 108 progression_name = PROGRESSION_BY_ROOM[room_name][door_data.name].item_name
87 or (room_name == "The Colorful" and not world.options.progressive_colorful): 109 progression_handling = should_split_progression(progression_name, world)
110
111 if progression_handling == ProgressiveItemBehavior.SPLIT:
88 self.set_door_item(room_name, door_data.name, door_data.item_name) 112 self.set_door_item(room_name, door_data.name, door_data.item_name)
89 else: 113 self.real_items.append(door_data.item_name)
114 elif progression_handling == ProgressiveItemBehavior.PROGRESSIVE:
90 progressive_item_name = PROGRESSION_BY_ROOM[room_name][door_data.name].item_name 115 progressive_item_name = PROGRESSION_BY_ROOM[room_name][door_data.name].item_name
91 self.set_door_item(room_name, door_data.name, progressive_item_name) 116 self.set_door_item(room_name, door_data.name, progressive_item_name)
92 self.real_items.append(progressive_item_name) 117 self.real_items.append(progressive_item_name)