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