Skip to content

Commit

Permalink
New feature
Browse files Browse the repository at this point in the history
-Adds option for early lightning
  • Loading branch information
GodlFire committed Oct 26, 2023
1 parent 54899a6 commit eb44a0e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 12 deletions.
7 changes: 6 additions & 1 deletion worlds/shivers/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
15 changes: 11 additions & 4 deletions worlds/shivers/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand All @@ -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) \
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions worlds/shivers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions worlds/shivers/data/excluded_locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,8 @@
"Puzzle Solved Underground Elevator",
"Puzzle Solved Bedroom Elevator",
"Puzzle Solved Three Floor Elevator"
],
"lightning": [
"Ixupi Captured Lightning"
]
}
9 changes: 4 additions & 5 deletions worlds/shivers/data/locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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",
Expand Down Expand Up @@ -319,8 +321,5 @@
"Accessible: Storage: Skull Bridge",
"Puzzle Solved Skull Dial Door"
]
},
"future locations": [
"Ixupi Captured Lightning"
]
}
}

0 comments on commit eb44a0e

Please sign in to comment.