diff options
Diffstat (limited to 'apworld/player_logic.py')
-rw-r--r-- | apworld/player_logic.py | 62 |
1 files changed, 52 insertions, 10 deletions
diff --git a/apworld/player_logic.py b/apworld/player_logic.py index 5cb9011..c94b809 100644 --- a/apworld/player_logic.py +++ b/apworld/player_logic.py | |||
@@ -3,7 +3,7 @@ from enum import IntEnum, auto | |||
3 | from .generated import data_pb2 as data_pb2 | 3 | from .generated import data_pb2 as data_pb2 |
4 | from typing import TYPE_CHECKING, NamedTuple | 4 | from typing import TYPE_CHECKING, NamedTuple |
5 | 5 | ||
6 | from .options import VictoryCondition, ShuffleLetters | 6 | from .options import VictoryCondition, ShuffleLetters, CyanDoorBehavior |
7 | 7 | ||
8 | if TYPE_CHECKING: | 8 | if TYPE_CHECKING: |
9 | from . import Lingo2World | 9 | from . import Lingo2World |
@@ -123,16 +123,57 @@ class Lingo2PlayerLogic: | |||
123 | self.item_by_door[progressive.doors[i]] = (progressive.name, i + 1) | 123 | self.item_by_door[progressive.doors[i]] = (progressive.name, i + 1) |
124 | self.real_items.append(progressive.name) | 124 | self.real_items.append(progressive.name) |
125 | 125 | ||
126 | for door_group in world.static_logic.objects.door_groups: | ||
127 | if door_group.type == data_pb2.DoorGroupType.CONNECTOR: | ||
128 | if not self.world.options.shuffle_doors: | ||
129 | continue | ||
130 | elif door_group.type == data_pb2.DoorGroupType.COLOR_CONNECTOR: | ||
131 | if not self.world.options.shuffle_control_center_colors: | ||
132 | continue | ||
133 | elif door_group.type == data_pb2.DoorGroupType.SHUFFLE_GROUP: | ||
134 | if not self.world.options.shuffle_doors: | ||
135 | continue | ||
136 | else: | ||
137 | continue | ||
138 | |||
139 | for door in door_group.doors: | ||
140 | self.item_by_door[door] = (door_group.name, 1) | ||
141 | |||
142 | self.real_items.append(door_group.name) | ||
143 | |||
126 | # We iterate through the doors in two parts because it is essential that we determine which doors are shuffled | 144 | # We iterate through the doors in two parts because it is essential that we determine which doors are shuffled |
127 | # before we calculate any access requirements. | 145 | # before we calculate any access requirements. |
128 | for door in world.static_logic.objects.doors: | 146 | for door in world.static_logic.objects.doors: |
129 | if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.ITEM_ONLY] and self.world.options.shuffle_doors: | 147 | if door.type in [data_pb2.DoorType.EVENT, data_pb2.DoorType.LOCATION_ONLY, data_pb2.DoorType.GRAVESTONE]: |
130 | if door.id in self.item_by_door: | 148 | continue |
149 | |||
150 | if door.id in self.item_by_door: | ||
151 | continue | ||
152 | |||
153 | if (door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.ITEM_ONLY] and | ||
154 | not self.world.options.shuffle_doors): | ||
155 | continue | ||
156 | |||
157 | if (door.type == data_pb2.DoorType.CONTROL_CENTER_COLOR and | ||
158 | not self.world.options.shuffle_control_center_colors): | ||
159 | continue | ||
160 | |||
161 | door_item_name = self.world.static_logic.get_door_item_name(door) | ||
162 | self.item_by_door[door.id] = (door_item_name, 1) | ||
163 | self.real_items.append(door_item_name) | ||
164 | |||
165 | # We handle cyan_door_behavior = Item after door shuffle, because cyan doors that are impacted by door shuffle | ||
166 | # should be exempt from cyan_door_behavior. | ||
167 | if world.options.cyan_door_behavior == CyanDoorBehavior.option_item: | ||
168 | for door_group in world.static_logic.objects.door_groups: | ||
169 | if door_group.type != data_pb2.DoorGroupType.CYAN_DOORS: | ||
131 | continue | 170 | continue |
132 | 171 | ||
133 | door_item_name = self.world.static_logic.get_door_item_name(door) | 172 | for door in door_group.doors: |
134 | self.item_by_door[door.id] = (door_item_name, 1) | 173 | if not door in self.item_by_door: |
135 | self.real_items.append(door_item_name) | 174 | self.item_by_door[door] = (door_group.name, 1) |
175 | |||
176 | self.real_items.append(door_group.name) | ||
136 | 177 | ||
137 | for door in world.static_logic.objects.doors: | 178 | for door in world.static_logic.objects.doors: |
138 | if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.LOCATION_ONLY, data_pb2.DoorType.GRAVESTONE]: | 179 | if door.type in [data_pb2.DoorType.STANDARD, data_pb2.DoorType.LOCATION_ONLY, data_pb2.DoorType.GRAVESTONE]: |
@@ -272,12 +313,13 @@ class Lingo2PlayerLogic: | |||
272 | self.add_solution_reqs(reqs, door.control_center_color) | 313 | self.add_solution_reqs(reqs, door.control_center_color) |
273 | 314 | ||
274 | if door.double_letters: | 315 | if door.double_letters: |
275 | if self.world.options.shuffle_letters in [ShuffleLetters.option_vanilla, | 316 | if self.world.options.cyan_door_behavior == CyanDoorBehavior.option_collect_h2: |
276 | ShuffleLetters.option_vanilla_cyan]: | ||
277 | reqs.rooms.add("The Repetitive - Main Room") | 317 | reqs.rooms.add("The Repetitive - Main Room") |
278 | elif self.world.options.shuffle_letters in [ShuffleLetters.option_progressive, | 318 | elif self.world.options.cyan_door_behavior == CyanDoorBehavior.option_any_double_letter: |
279 | ShuffleLetters.option_item_cyan]: | ||
280 | reqs.cyans = True | 319 | reqs.cyans = True |
320 | elif self.world.options.cyan_door_behavior == CyanDoorBehavior.option_item: | ||
321 | # There shouldn't be any locations that are cyan doors. | ||
322 | pass | ||
281 | 323 | ||
282 | for keyholder_uses in door.keyholders: | 324 | for keyholder_uses in door.keyholders: |
283 | key_name = keyholder_uses.key.upper() | 325 | key_name = keyholder_uses.key.upper() |