Skip to content

Commit

Permalink
alwaysintreble review comments addressed
Browse files Browse the repository at this point in the history
-Review comments addressed.
-Updated en_Shivers.md to note who to contact if a bug is encountered
  • Loading branch information
GodlFire committed Nov 2, 2023
1 parent 309c391 commit 93bbd39
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 120 deletions.
30 changes: 11 additions & 19 deletions worlds/shivers/Options.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Dict, FrozenSet, Union
from Options import Choice, Option, DefaultOnToggle, Toggle
from BaseClasses import MultiWorld
from Options import Choice, DefaultOnToggle, Toggle, PerGameCommonOptions
from dataclasses import dataclass


class LobbyAccess(Choice):
Expand Down Expand Up @@ -39,20 +38,13 @@ 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_lightning": EarlyLightning
}

def get_option_value(multiworld: MultiWorld, player: int, name: str) -> Union[int, FrozenSet]:
if multiworld is None:
return Shivers_options[name].default

player_option = getattr(multiworld, name)[player]

return player_option.value
@dataclass
class ShiversOptions(PerGameCommonOptions):
lobby_access: LobbyAccess
puzzle_hints_required: PuzzleHintsRequired
include_information_plaques: InformationPlaques
front_door_usable: FrontDoorUsable
elevators_stay_solved: ElevatorsStaySolved
early_beth: EarlyBeth
early_lightning: EarlyLightning
72 changes: 20 additions & 52 deletions worlds/shivers/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,110 +3,79 @@
from BaseClasses import CollectionState
from worlds.AutoWorld import World
from worlds.generic.Rules import forbid_item
from .Options import get_option_value


def water_capturable(state: CollectionState, player: int) -> bool:
return (state.can_reach("Lobby", "Region", player) or (state.can_reach("Janitor Closet", "Region", player) and cloth_capturable(state, player))) \
and state.has("Water Pot Bottom", player) \
and state.has("Water Pot Top", player) \
and state.has("Water Pot Bottom DUPE", player) \
and state.has("Water Pot Top DUPE", player)
and state.has_all({"Water Pot Bottom", "Water Pot Top", "Water Pot Bottom DUPE", "Water Pot Top DUPE"}, player)


def wax_capturable(state: CollectionState, player: int) -> bool:
return (state.can_reach("Library", "Region", player) or state.can_reach("Anansi", "Region", player)) \
and state.has("Wax Pot Bottom", player) \
and state.has("Wax Pot Top", player) \
and state.has("Wax Pot Bottom DUPE", player) \
and state.has("Wax Pot Top DUPE", player)
and state.has_all({"Wax Pot Bottom", "Wax Pot Top", "Wax Pot Bottom DUPE", "Wax Pot Top DUPE"}, player)


def ash_capturable(state: CollectionState, player: int) -> bool:
return (state.can_reach("Office", "Region", player) or state.can_reach("Burial", "Region", player)) \
and state.has("Ash Pot Bottom", player) \
and state.has("Ash Pot Top", player) \
and state.has("Ash Pot Bottom DUPE", player) \
and state.has("Ash Pot Top DUPE", player)
and state.has_all({"Ash Pot Bottom", "Ash Pot Top", "Ash Pot Bottom DUPE", "Ash Pot Top DUPE"}, player)


def oil_capturable(state: CollectionState, player: int) -> bool:
return (state.can_reach("Prehistoric", "Region", player) or state.can_reach("Tar River", "Region", player)) \
and state.has("Oil Pot Bottom", player) \
and state.has("Oil Pot Top", player) \
and state.has("Oil Pot Bottom DUPE", player) \
and state.has("Oil Pot Top DUPE", player)
and state.has_all({"Oil Pot Bottom", "Oil Pot Top", "Oil Pot Bottom DUPE", "Oil Pot Top DUPE"}, player)


def cloth_capturable(state: CollectionState, player: int) -> bool:
return (state.can_reach("Egypt", "Region", player) or state.can_reach("Burial", "Region", player) or state.can_reach("Janitor Closet", "Region", player)) \
and state.has("Cloth Pot Bottom", player) \
and state.has("Cloth Pot Top", player) \
and state.has("Cloth Pot Bottom DUPE", player) \
and state.has("Cloth Pot Top DUPE", player)
and state.has_all({"Cloth Pot Bottom", "Cloth Pot Top", "Cloth Pot Bottom DUPE", "Cloth Pot Top DUPE"}, player)


def wood_capturable(state: CollectionState, player: int) -> bool:
return (state.can_reach("Workshop", "Region", player) or state.can_reach("Blue Maze", "Region", player) or state.can_reach("Gods Room", "Region", player) or state.can_reach("Anansi", "Region", player)) \
and state.has("Wood Pot Bottom", player) \
and state.has("Wood Pot Top", player) \
and state.has("Wood Pot Bottom DUPE", player) \
and state.has("Wood Pot Top DUPE", player)
and state.has_all({"Wood Pot Bottom", "Wood Pot Top", "Wood Pot Bottom DUPE", "Wood Pot Top DUPE"}, player)


def crystal_capturable(state: CollectionState, player: int) -> bool:
return (state.can_reach("Lobby", "Region", player) or state.can_reach("Ocean", "Region", player)) \
and state.has("Crystal Pot Bottom", player) \
and state.has("Crystal Pot Top", player) \
and state.has("Crystal Pot Bottom DUPE", player) \
and state.has("Crystal Pot Top DUPE", player)
and state.has_all({"Crystal Pot Bottom", "Crystal Pot Top", "Crystal Pot Bottom DUPE", "Crystal Pot Top DUPE"}, player)


def sand_capturable(state: CollectionState, player: int) -> bool:
return (state.can_reach("Greenhouse", "Region", player) or state.can_reach("Ocean", "Region", player)) \
and state.has("Sand Pot Bottom", player) \
and state.has("Sand Pot Top", player) \
and state.has("Sand Pot Bottom DUPE", player) \
and state.has("Sand Pot Top DUPE", player)
and state.has_all({"Sand Pot Bottom", "Sand Pot Top", "Sand Pot Bottom DUPE", "Sand Pot Top DUPE"}, player)


def metal_capturable(state: CollectionState, player: int) -> bool:
return (state.can_reach("Projector Room", "Region", player) or state.can_reach("Prehistoric", "Region", player) or state.can_reach("Bedroom", "Region", player)) \
and state.has("Metal Pot Bottom", player) \
and state.has("Metal Pot Top", player) \
and state.has("Metal Pot Bottom DUPE", player) \
and state.has("Metal Pot Top DUPE", player)
and state.has_all({"Metal Pot Bottom", "Metal Pot Top", "Metal Pot Bottom DUPE", "Metal Pot Top DUPE"}, player)


def lightning_capturable(state: CollectionState, player: int) -> bool:
return (first_nine_ixupi_capturable or get_option_value(state.multiworld, player, "early_lightning")) \
return (first_nine_ixupi_capturable or state.multiworld.early_lightning[player].value) \
and state.can_reach("Generator", "Region", player) \
and state.has("Lightning Pot Bottom", player) \
and state.has("Lightning Pot Top", player) \
and state.has("Lightning Pot Bottom DUPE", player) \
and state.has("Lightning Pot Top DUPE", player)
and state.has_all({"Lightning Pot Bottom", "Lightning Pot Top", "Lightning Pot Bottom DUPE", "Lightning Pot Top DUPE"}, player)


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")) \
return (first_nine_ixupi_capturable(state, player) or state.multiworld.early_beth[player].value) \
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) \
return water_capturable(state, player) and wax_capturable(state, player) \
and ash_capturable(state, player) and oil_capturable(state, player) \
and cloth_capturable(state, player) and wood_capturable(state, player) \
and crystal_capturable(state, player) and sand_capturable(state, player) \
and metal_capturable(state, player))
and metal_capturable(state, player)


def get_rules_lookup(player: int):
rules_lookup: typing.Dict[str, typing.List[Callable[[CollectionState], bool]]] = {
"entrances": {
"To Office Elevator From Underground Blue Tunnels": lambda state: state.has("Key for Office Elevator", player),
"To Office Elevator From Office": lambda state: state.has("Key for Office Elevator", player),
"To Bedroom Elevator From Office": lambda state: state.has("Key for Bedroom Elevator", player) and state.has("Crawling", player),
"To Office From Bedroom Elevator": lambda state: state.has("Key for Bedroom Elevator", player) and state.has("Crawling", player),
"To Bedroom Elevator From Office": lambda state: state.has_all({"Key for Bedroom Elevator", "Crawling"}, player),
"To Office From Bedroom Elevator": lambda state: state.has_all({"Key for Bedroom Elevator", "Crawling"}, player),
"To Three Floor Elevator From Maintenance Tunnels": lambda state: state.has("Key for Three Floor Elevator", player),
"To Three Floor Elevator From Blue Maze Bottom": lambda state: state.has("Key for Three Floor Elevator", player),
"To Three Floor Elevator From Blue Maze Top": lambda state: state.has("Key for Three Floor Elevator", player),
Expand Down Expand Up @@ -182,8 +151,7 @@ def get_rules_lookup(player: int):
"elevators": {
"Puzzle Solved Underground Elevator": lambda state: ((state.can_reach("Underground Lake", "Region", player) or state.can_reach("Office", "Region", player)
and state.has("Key for Office Elevator", player))),
"Puzzle Solved Bedroom Elevator": lambda state: (state.can_reach("Office", "Region", player) and state.has("Key for Bedroom Elevator", player) and
state.has("Crawling", player)),
"Puzzle Solved Bedroom Elevator": lambda state: (state.can_reach("Office", "Region", player) and state.has_all({"Key for Bedroom Elevator","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)))
},
Expand All @@ -209,13 +177,13 @@ 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"):
if Shivers.options.puzzle_hints_required.value:
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"):
if Shivers.options.elevators_stay_solved.value:
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"):
if Shivers.options.early_lightning.value:
for location_name, rule in rules_lookup["lightning"].items():
multiworld.get_location(location_name, player).access_rule = rule

Expand Down
Loading

0 comments on commit 93bbd39

Please sign in to comment.