Skip to content

Commit

Permalink
OoS: Fixed Lost Woods season sequence checking being incorrectly impl…
Browse files Browse the repository at this point in the history
…emented
  • Loading branch information
Dinopony committed Nov 4, 2024
1 parent b3152e2 commit b5771da
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions worlds/tloz_oos/data/logic/LogicPredicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def oos_has_flippers(state: CollectionState, player: int):
return state.has("Flippers", player)


def oos_has_season(state: CollectionState, player: int, season: str):
def oos_has_season(state: CollectionState, player: int, season: int):
return state.has(SEASON_ITEMS[season], player)


Expand Down Expand Up @@ -173,7 +173,7 @@ def oos_get_default_season(state: CollectionState, player: int, area_name: str):
return state.multiworld.worlds[player].default_seasons[area_name]


def oos_can_remove_season(state: CollectionState, player: int, season: str):
def oos_can_remove_season(state: CollectionState, player: int, season: int):
# Test if player has any other season than the one we want to remove
return any(
[state.has(item_name, player) for season_name, item_name in SEASON_ITEMS.items() if season_name != season])
Expand All @@ -200,25 +200,39 @@ def oos_has_required_jewels(state: CollectionState, player: int):

def oos_can_reach_lost_woods_pedestal(state: CollectionState, player: int):
world = state.multiworld.worlds[player]
seasons_in_pedestal_sequence = [season for [_, season] in world.lost_woods_item_sequence]

return all([
oos_can_use_ember_seeds(state, player, False),
state.has("Phonograph", player),
SEASON_WINTER not in world.lost_woods_item_sequence or oos_has_winter(state, player),
SEASON_SPRING not in world.lost_woods_item_sequence or oos_has_spring(state, player),
SEASON_SUMMER not in world.lost_woods_item_sequence or oos_has_summer(state, player),
SEASON_AUTUMN not in world.lost_woods_item_sequence or oos_has_autumn(state, player)
oos_can_complete_season_sequence(state, player, seasons_in_pedestal_sequence)
])


def oos_can_complete_lost_woods_main_sequence(state: CollectionState, player: int):
world = state.multiworld.worlds[player]
seasons_in_main_sequence = [season for [_, season] in world.lost_woods_main_sequence]

return all([
oos_can_break_mushroom(state, player, False),
oos_has_shield(state, player),
SEASON_WINTER not in world.lost_woods_main_sequence or oos_has_winter(state, player),
SEASON_SPRING not in world.lost_woods_main_sequence or oos_has_spring(state, player),
SEASON_SUMMER not in world.lost_woods_main_sequence or oos_has_summer(state, player),
SEASON_AUTUMN not in world.lost_woods_main_sequence or oos_has_autumn(state, player)
oos_can_complete_season_sequence(state, player, seasons_in_main_sequence)
])


def oos_can_complete_season_sequence(state: CollectionState, player: int, season_sequence: list[int]):
# In medium logic and above, it is assumed the player can exploit the default season from Lost Woods to cheese
# the first few seasons of the sequence even if they don't own the matching rod.
if oos_option_medium_logic(state, player):
default_season = oos_get_default_season(state, player, "LOST_WOODS")
while len(season_sequence) > 0 and season_sequence[0] == default_season:
del season_sequence[0]

return all([
(SEASON_WINTER not in season_sequence) or oos_has_winter(state, player),
(SEASON_SPRING not in season_sequence) or oos_has_spring(state, player),
(SEASON_SUMMER not in season_sequence) or oos_has_summer(state, player),
(SEASON_AUTUMN not in season_sequence) or oos_has_autumn(state, player)
])


Expand Down Expand Up @@ -918,76 +932,76 @@ def oos_can_meet_maple(state: CollectionState, player: int):

# Season in region predicates ##########################################

def oos_season_in_spool_swamp(state: CollectionState, player: int, season: str):
def oos_season_in_spool_swamp(state: CollectionState, player: int, season: int):
if oos_get_default_season(state, player, "SPOOL_SWAMP") == season:
return True
return oos_has_season(state, player, season) and state.has("_reached_spool_stump", player)


def oos_season_in_eyeglass_lake(state: CollectionState, player: int, season: str):
def oos_season_in_eyeglass_lake(state: CollectionState, player: int, season: int):
if oos_get_default_season(state, player, "EYEGLASS_LAKE") == season:
return True
return oos_has_season(state, player, season) and state.has("_reached_eyeglass_stump", player)


def oos_season_in_temple_remains(state: CollectionState, player: int, season: str):
def oos_season_in_temple_remains(state: CollectionState, player: int, season: int):
if oos_get_default_season(state, player, "TEMPLE_REMAINS") == season:
return True
return oos_has_season(state, player, season) and state.has("_reached_remains_stump", player)


def oos_season_in_holodrum_plain(state: CollectionState, player: int, season: str):
def oos_season_in_holodrum_plain(state: CollectionState, player: int, season: int):
if oos_get_default_season(state, player, "HOLODRUM_PLAIN") == season:
return True
return oos_has_season(state, player, season) and state.has("_reached_ghastly_stump", player)


def oos_season_in_western_coast(state: CollectionState, player: int, season: str):
def oos_season_in_western_coast(state: CollectionState, player: int, season: int):
if oos_get_default_season(state, player, "WESTERN_COAST") == season:
return True
return oos_has_season(state, player, season) and state.has("_reached_coast_stump", player)


def oos_season_in_eastern_suburbs(state: CollectionState, player: int, season: str):
def oos_season_in_eastern_suburbs(state: CollectionState, player: int, season: int):
return (oos_get_default_season(state, player, "EASTERN_SUBURBS") == season
or oos_has_season(state, player, season))


def oos_season_in_sunken_city(state: CollectionState, player: int, season: str):
def oos_season_in_sunken_city(state: CollectionState, player: int, season: int):
return (oos_get_default_season(state, player, "SUNKEN_CITY") == season
or oos_has_season(state, player, season))


def oos_season_in_woods_of_winter(state: CollectionState, player: int, season: str):
def oos_season_in_woods_of_winter(state: CollectionState, player: int, season: int):
return (oos_get_default_season(state, player, "WOODS_OF_WINTER") == season
or oos_has_season(state, player, season))


def oos_season_in_central_woods_of_winter(state: CollectionState, player: int, season: str):
def oos_season_in_central_woods_of_winter(state: CollectionState, player: int, season: int):
if oos_get_default_season(state, player, "WOODS_OF_WINTER") == season:
return True
return oos_has_season(state, player, season) and state.has("_reached_d2_stump", player)


def oos_season_in_mt_cucco(state: CollectionState, player: int, season: str):
def oos_season_in_mt_cucco(state: CollectionState, player: int, season: int):
if oos_get_default_season(state, player, "SUNKEN_CITY") == season:
return True
return oos_has_season(state, player, season)


def oos_season_in_lost_woods(state: CollectionState, player: int, season: str):
def oos_season_in_lost_woods(state: CollectionState, player: int, season: int):
if oos_get_default_season(state, player, "LOST_WOODS") == season:
return True
return oos_has_season(state, player, season)


def oos_season_in_tarm_ruins(state: CollectionState, player: int, season: str):
def oos_season_in_tarm_ruins(state: CollectionState, player: int, season: int):
if oos_get_default_season(state, player, "TARM_RUINS") == season:
return True
return oos_has_season(state, player, season)


def oos_season_in_horon_village(state: CollectionState, player: int, season: str):
def oos_season_in_horon_village(state: CollectionState, player: int, season: int):
# With vanilla behavior, you can randomly have any season inside Horon, making any season virtually accessible
if not state.multiworld.worlds[player].options.normalize_horon_village_season:
return True
Expand Down

0 comments on commit b5771da

Please sign in to comment.