Skip to content

Commit

Permalink
MMBN3: Add missing indirect conditions (#3931)
Browse files Browse the repository at this point in the history
Entrances to SciLab_Cyberworld and Yoka_Cyberworld had logic for being
able to reach SciLab_Overworld, but did not register this indirect
condition.

Entrances to Beach_Cyberworld had logic for being able to reach
Yoka_Overworld, but did not register this indirect condition.

Entrances to Undernet and Secret_Area had logic for having a high enough
explore score, but explore score is calculated based on the
accessibility of a number of regions and no indirect conditions were
being registered for these regions.
  • Loading branch information
Mysteryem authored Sep 17, 2024
1 parent ce42e42 commit b8d23ec
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion worlds/mmbn3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,28 @@ def create_regions(self) -> None:
add_item_rule(loc, lambda item: not item.advancement)
region.locations.append(loc)
self.multiworld.regions.append(region)

# Regions which contribute to explore score when accessible.
explore_score_region_names = (
RegionName.WWW_Island,
RegionName.SciLab_Overworld,
RegionName.SciLab_Cyberworld,
RegionName.Yoka_Overworld,
RegionName.Yoka_Cyberworld,
RegionName.Beach_Overworld,
RegionName.Beach_Cyberworld,
RegionName.Undernet,
RegionName.Deep_Undernet,
RegionName.Secret_Area,
)
explore_score_regions = [self.get_region(region_name) for region_name in explore_score_region_names]

# Entrances which use explore score in their logic need to register all the explore score regions as indirect
# conditions.
def register_explore_score_indirect_conditions(entrance):
for explore_score_region in explore_score_regions:
self.multiworld.register_indirect_condition(explore_score_region, entrance)

for region_info in regions:
region = name_to_region[region_info.name]
for connection in region_info.connections:
Expand All @@ -119,23 +141,27 @@ def create_regions(self) -> None:
entrance.access_rule = lambda state: \
state.has(ItemName.CSciPas, self.player) or \
state.can_reach(RegionName.SciLab_Overworld, "Region", self.player)
self.multiworld.register_indirect_condition(self.get_region(RegionName.SciLab_Overworld), entrance)
if connection == RegionName.Yoka_Cyberworld:
entrance.access_rule = lambda state: \
state.has(ItemName.CYokaPas, self.player) or \
(
state.can_reach(RegionName.SciLab_Overworld, "Region", self.player) and
state.has(ItemName.Press, self.player)
)
self.multiworld.register_indirect_condition(self.get_region(RegionName.SciLab_Overworld), entrance)
if connection == RegionName.Beach_Cyberworld:
entrance.access_rule = lambda state: state.has(ItemName.CBeacPas, self.player) and\
state.can_reach(RegionName.Yoka_Overworld, "Region", self.player)

self.multiworld.register_indirect_condition(self.get_region(RegionName.Yoka_Overworld), entrance)
if connection == RegionName.Undernet:
entrance.access_rule = lambda state: self.explore_score(state) > 8 and\
state.has(ItemName.Press, self.player)
register_explore_score_indirect_conditions(entrance)
if connection == RegionName.Secret_Area:
entrance.access_rule = lambda state: self.explore_score(state) > 12 and\
state.has(ItemName.Hammer, self.player)
register_explore_score_indirect_conditions(entrance)
if connection == RegionName.WWW_Island:
entrance.access_rule = lambda state:\
state.has(ItemName.Progressive_Undernet_Rank, self.player, 8)
Expand Down

0 comments on commit b8d23ec

Please sign in to comment.