From eb44a0e2a153bdc892e8acdbcf247661dddcbf09 Mon Sep 17 00:00:00 2001 From: GodlFire <46984098+GodlFire@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:40:20 -0600 Subject: [PATCH] New feature -Adds option for early lightning --- worlds/shivers/Options.py | 7 ++++++- worlds/shivers/Rules.py | 15 +++++++++++---- worlds/shivers/__init__.py | 8 ++++++-- worlds/shivers/data/excluded_locations.json | 3 +++ worlds/shivers/data/locations.json | 9 ++++----- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/worlds/shivers/Options.py b/worlds/shivers/Options.py index 88f0c90c7cd1..f4544f2afcc0 100644 --- a/worlds/shivers/Options.py +++ b/worlds/shivers/Options.py @@ -35,13 +35,18 @@ class EarlyBeth(DefaultOnToggle): """Beth's body is open at the start of the game. This allows any pot piece to be placed in the slide and early checks on the second half of the final riddle.""" display_name = "Early Beth" +class EarlyLightning(Toggle): + """Allows lightning to be captured at any point in the game. You will still need to capture all ten Ixupi for victory.""" + display_name = "Early Lightning" + Shivers_options: Dict[str, Option] = { "lobby_access": LobbyAccess, "puzzle_hints_required": PuzzleHintsRequired, "include_information_plaques": InformationPlaques, "front_door_usable": FrontDoorUsable, "elevators_stay_solved": ElevatorsStaySolved, - "early_beth": EarlyBeth + "early_beth": EarlyBeth, + "early_lightning": EarlyLightning } def get_option_value(multiworld: MultiWorld, player: int, name: str) -> Union[int, FrozenSet]: diff --git a/worlds/shivers/Rules.py b/worlds/shivers/Rules.py index 6953a60a297b..52226f045fcd 100644 --- a/worlds/shivers/Rules.py +++ b/worlds/shivers/Rules.py @@ -79,7 +79,7 @@ def metal_capturable(state: CollectionState, player: int) -> bool: def lightning_capturable(state: CollectionState, player: int) -> bool: - return first_nine_ixupi_capturable \ + return (first_nine_ixupi_capturable or get_option_value(state.multiworld, player, "early_lightning")) \ and state.can_reach("Generator", "Region", player) \ and state.has("Lightning Pot Bottom", player) \ and state.has("Lightning Pot Top", player) \ @@ -91,6 +91,7 @@ def beths_body_available(state: CollectionState, player: int) -> bool: return (first_nine_ixupi_capturable(state, player) or get_option_value(state.multiworld, player, "early_beth")) \ and state.can_reach("Generator", "Region", player) + def first_nine_ixupi_capturable(state: CollectionState, player: int) -> bool: return (water_capturable(state, player) and wax_capturable(state, player) \ and ash_capturable(state, player) and oil_capturable(state, player) \ @@ -185,6 +186,9 @@ def get_rules_lookup(player: int): state.has("Crawling", player)), "Puzzle Solved Three Floor Elevator": lambda state: ((state.can_reach("Maintenance Tunnels", "Region", player) or state.can_reach("Blue Maze", "Region", player) and state.has("Key for Three Floor Elevator", player))) + }, + "lightning": { + "Ixupi Captured Lightning": lambda state: lightning_capturable(state, player) } } return rules_lookup @@ -205,12 +209,15 @@ def set_rules(Shivers: World) -> None: multiworld.get_location(location_name, player).access_rule = rule #Set option location rules - if get_option_value(multiworld, player, "puzzle_hints_required") == True: + if get_option_value(multiworld, player, "puzzle_hints_required"): for location_name, rule in rules_lookup["locations_puzzle_hints"].items(): multiworld.get_location(location_name, player).access_rule = rule - if get_option_value(multiworld, player, "elevators_stay_solved") == True: + if get_option_value(multiworld, player, "elevators_stay_solved"): for location_name, rule in rules_lookup["elevators"].items(): multiworld.get_location(location_name, player).access_rule = rule + if get_option_value(multiworld, player, "early_lightning"): + for location_name, rule in rules_lookup["lightning"].items(): + multiworld.get_location(location_name, player).access_rule = rule #forbid cloth in janitor closet and oil in tar river forbid_item(multiworld.get_location("Accessible: Storage: Janitor Closet", player), "Cloth Pot Bottom DUPE", player) @@ -224,7 +231,7 @@ def set_rules(Shivers: World) -> None: forbid_item(multiworld.get_location("Ixupi Captured Wax", player), "Wax Always Available in Library", player) forbid_item(multiworld.get_location("Ixupi Captured Wax", player), "Wax Always Available in Anansi Room", player) forbid_item(multiworld.get_location("Ixupi Captured Wax", player), "Wax Always Available in Tiki Room", player) - forbid_item(multiworld.get_location("Ixupi Captured Ash", player), "Ash Always Availalbe in Office", player) + forbid_item(multiworld.get_location("Ixupi Captured Ash", player), "Ash Always Available in Office", player) forbid_item(multiworld.get_location("Ixupi Captured Ash", player), "Ash Always Available in Burial Room", player) forbid_item(multiworld.get_location("Ixupi Captured Oil", player), "Oil Always Available in Prehistoric Room", player) forbid_item(multiworld.get_location("Ixupi Captured Cloth", player), "Cloth Always Available in Egypt", player) diff --git a/worlds/shivers/__init__.py b/worlds/shivers/__init__.py index 8102bd8d3638..8aff562e666e 100644 --- a/worlds/shivers/__init__.py +++ b/worlds/shivers/__init__.py @@ -61,12 +61,15 @@ def create_regions(self) -> None: # Build exclusion list include_information_plaques: bool = getattr(self.multiworld, "include_information_plaques")[self.player].value elevators_stay_solved: bool = getattr(self.multiworld, "elevators_stay_solved")[self.player].value + early_lightning: bool = getattr(self.multiworld, "early_lightning")[self.player].value self.removed_locations = set() if not include_information_plaques: self.removed_locations.update(Constants.exclusion_info["plaques"]) if not elevators_stay_solved: self.removed_locations.update(Constants.exclusion_info["elevators"]) + if not early_lightning: + self.removed_locations.update(Constants.exclusion_info["lightning"]) # Add locations for region_name, locations in Constants.location_info["locations_by_region"].items(): @@ -91,7 +94,7 @@ def create_items(self) -> None: filler = [] filler += [self.create_item("Easier Lyre") for i in range(10)] filler += [self.create_item(name) for name, data in item_table.items() if data.type == 'filler2'] - filler += [self.create_item("Heal") for i in range(42 - len(self.removed_locations))] + filler += [self.create_item("Heal") for i in range(43 - len(self.removed_locations))] #Place library escape items. Choose a location to place the escape item library_region = self.multiworld.get_region("Library", self.player) @@ -182,7 +185,8 @@ def _get_slot_data(self): 'storageplacements': self.storage_placements, 'excludedlocations': {str(excluded_location).replace('ExcludeLocations(', '').replace(')', '') for excluded_location in self.multiworld.exclude_locations.values()}, 'elevatorsstaysolved': {self.multiworld.elevators_stay_solved[self.player].value}, - 'earlybeth': {self.multiworld.early_beth[self.player].value} + 'earlybeth': {self.multiworld.early_beth[self.player].value}, + 'earlylightning': {self.multiworld.early_lightning[self.player].value}, } def fill_slot_data(self) -> dict: diff --git a/worlds/shivers/data/excluded_locations.json b/worlds/shivers/data/excluded_locations.json index 268534e93f25..6ed625077af8 100644 --- a/worlds/shivers/data/excluded_locations.json +++ b/worlds/shivers/data/excluded_locations.json @@ -45,5 +45,8 @@ "Puzzle Solved Underground Elevator", "Puzzle Solved Bedroom Elevator", "Puzzle Solved Three Floor Elevator" + ], + "lightning": [ + "Ixupi Captured Lightning" ] } \ No newline at end of file diff --git a/worlds/shivers/data/locations.json b/worlds/shivers/data/locations.json index be1d2fca6121..7d031b886bff 100644 --- a/worlds/shivers/data/locations.json +++ b/worlds/shivers/data/locations.json @@ -112,7 +112,8 @@ "Information Plaque: Aliens (UFO)", "Puzzle Solved Underground Elevator", "Puzzle Solved Bedroom Elevator", - "Puzzle Solved Three Floor Elevator" + "Puzzle Solved Three Floor Elevator", + "Ixupi Captured Lightning" ], "locations_by_region": { "Outside": [ @@ -127,6 +128,7 @@ "Ixupi Captured Crystal", "Ixupi Captured Sand", "Ixupi Captured Metal", + "Ixupi Captured Lightning", "Puzzle Solved Underground Elevator", "Puzzle Solved Three Floor Elevator", "Puzzle Hint Found: Combo Lock in Mailbox", @@ -319,8 +321,5 @@ "Accessible: Storage: Skull Bridge", "Puzzle Solved Skull Dial Door" ] - }, - "future locations": [ - "Ixupi Captured Lightning" - ] + } }