| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  | """
 | 
					
						
							|  |  |  | Defines constants for different types of locations in the game | 
					
						
							|  |  |  | """
 | 
					
						
							| 
									
										
										
										
											2023-11-24 06:27:03 +01:00
										 |  |  | from typing import TYPE_CHECKING | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  | from .data import static_locations as static_witness_locations | 
					
						
							|  |  |  | from .data import static_logic as static_witness_logic | 
					
						
							| 
									
										
										
										
											2022-10-09 04:13:52 +02:00
										 |  |  | from .player_logic import WitnessPlayerLogic | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-24 06:27:03 +01:00
										 |  |  | if TYPE_CHECKING: | 
					
						
							|  |  |  |     from . import WitnessWorld | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | class WitnessPlayerLocations: | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  |     Class that defines locations for a single player | 
					
						
							|  |  |  |     """
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  |     def __init__(self, world: "WitnessWorld", player_logic: WitnessPlayerLogic) -> None: | 
					
						
							| 
									
										
										
										
											2022-07-17 12:56:22 +02:00
										 |  |  |         """Defines locations AFTER logic changes due to options""" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-24 02:08:04 +02:00
										 |  |  |         self.PANEL_TYPES_TO_SHUFFLE = {"General", "Good Boi"} | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  |         self.CHECK_LOCATIONS = static_witness_locations.GENERAL_LOCATIONS.copy() | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-24 06:27:03 +01:00
										 |  |  |         if world.options.shuffle_discarded_panels: | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  |             self.PANEL_TYPES_TO_SHUFFLE.add("Discard") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-24 06:27:03 +01:00
										 |  |  |         if world.options.shuffle_vault_boxes: | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  |             self.PANEL_TYPES_TO_SHUFFLE.add("Vault") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-11 02:25:03 +01:00
										 |  |  |         if world.options.shuffle_EPs == "individual": | 
					
						
							| 
									
										
										
										
											2023-02-01 21:18:07 +01:00
										 |  |  |             self.PANEL_TYPES_TO_SHUFFLE.add("EP") | 
					
						
							| 
									
										
										
										
											2024-02-11 02:25:03 +01:00
										 |  |  |         elif world.options.shuffle_EPs == "obelisk_sides": | 
					
						
							| 
									
										
										
										
											2023-02-01 21:18:07 +01:00
										 |  |  |             self.PANEL_TYPES_TO_SHUFFLE.add("Obelisk Side") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  |             for obelisk_loc in static_witness_locations.OBELISK_SIDES: | 
					
						
							|  |  |  |                 obelisk_loc_hex = static_witness_logic.ENTITIES_BY_NAME[obelisk_loc]["entity_hex"] | 
					
						
							| 
									
										
										
										
											2023-02-01 21:18:07 +01:00
										 |  |  |                 if player_logic.REQUIREMENTS_BY_HEX[obelisk_loc_hex] == frozenset({frozenset()}): | 
					
						
							|  |  |  |                     self.CHECK_LOCATIONS.discard(obelisk_loc) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  |         self.CHECK_LOCATIONS = self.CHECK_LOCATIONS | player_logic.ADDED_CHECKS | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  |         self.CHECK_LOCATIONS.discard(static_witness_logic.ENTITIES_BY_HEX[player_logic.VICTORY_LOCATION]["checkName"]) | 
					
						
							| 
									
										
										
										
											2022-08-22 05:50:01 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  |         self.CHECK_LOCATIONS = self.CHECK_LOCATIONS - { | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  |             static_witness_logic.ENTITIES_BY_HEX[entity_hex]["checkName"] | 
					
						
							| 
									
										
										
										
											2024-08-23 00:23:05 +02:00
										 |  |  |             for entity_hex in player_logic.COMPLETELY_DISABLED_ENTITIES | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.CHECK_PANELHEX_TO_ID = { | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  |             static_witness_logic.ENTITIES_BY_NAME[ch]["entity_hex"]: static_witness_locations.ALL_LOCATIONS_TO_ID[ch] | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  |             for ch in self.CHECK_LOCATIONS | 
					
						
							| 
									
										
										
										
											2024-08-20 01:16:35 +02:00
										 |  |  |             if static_witness_logic.ENTITIES_BY_NAME[ch]["locationType"] in self.PANEL_TYPES_TO_SHUFFLE | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.CHECK_PANELHEX_TO_ID = dict( | 
					
						
							|  |  |  |             sorted(self.CHECK_PANELHEX_TO_ID.items(), key=lambda item: item[1]) | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.EVENT_LOCATION_TABLE = { | 
					
						
							| 
									
										
										
										
											2024-08-20 01:16:35 +02:00
										 |  |  |             event_location: None | 
					
						
							|  |  |  |             for event_location in player_logic.EVENT_ITEM_PAIRS | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         check_dict = { | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  |             static_witness_logic.ENTITIES_BY_HEX[location]["checkName"]: | 
					
						
							|  |  |  |             static_witness_locations.get_id(static_witness_logic.ENTITIES_BY_HEX[location]["entity_hex"]) | 
					
						
							| 
									
										
										
										
											2023-02-01 21:18:07 +01:00
										 |  |  |             for location in self.CHECK_PANELHEX_TO_ID | 
					
						
							| 
									
										
										
										
											2022-04-29 00:42:11 +02:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         self.CHECK_LOCATION_TABLE = {**self.EVENT_LOCATION_TABLE, **check_dict} | 
					
						
							| 
									
										
										
										
											2023-11-24 06:27:03 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  |     def add_location_late(self, entity_name: str) -> None: | 
					
						
							|  |  |  |         entity_hex = static_witness_logic.ENTITIES_BY_NAME[entity_name]["entity_hex"] | 
					
						
							| 
									
										
										
										
											2024-07-02 23:59:26 +02:00
										 |  |  |         self.CHECK_LOCATION_TABLE[entity_hex] = static_witness_locations.get_id(entity_hex) | 
					
						
							| 
									
										
										
										
											2024-04-12 00:27:42 +02:00
										 |  |  |         self.CHECK_PANELHEX_TO_ID[entity_hex] = static_witness_locations.get_id(entity_hex) |