Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OoT: Entrance Spoiler Fixes #2500

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 28 additions & 25 deletions worlds/oot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,32 @@ def prefill_state(base_state):


def generate_output(self, output_directory: str):

# Write entrances to spoiler log
all_entrances = self.get_shuffled_entrances()
all_entrances.sort(reverse=True, key=lambda x: x.name)
all_entrances.sort(reverse=True, key=lambda x: x.type)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
all_entrances.sort(reverse=True, key=lambda x: x.name)
all_entrances.sort(reverse=True, key=lambda x: x.type)
all_entrances.sort(reverse=True, key=lambda x: (x.name, x.type))

if not self.decouple_entrances:
while all_entrances:
loadzone = all_entrances.pop()
if loadzone.type != 'Overworld':
if loadzone.primary:
entrance = loadzone
else:
entrance = loadzone.reverse
if entrance.reverse is not None:
self.multiworld.spoiler.set_entrance(entrance, entrance.replaces.reverse, 'both', self.player)
else:
self.multiworld.spoiler.set_entrance(entrance, entrance.replaces, 'entrance', self.player)
else:
reverse = loadzone.replaces.reverse
if reverse in all_entrances:
all_entrances.remove(reverse)
self.multiworld.spoiler.set_entrance(loadzone, reverse, 'both', self.player)
else:
for entrance in all_entrances:
self.multiworld.spoiler.set_entrance(entrance, entrance.replaces, 'entrance', self.player)

if self.hints != 'none':
self.hint_data_available.wait()

Expand Down Expand Up @@ -1220,38 +1246,15 @@ def get_entrance_to_region(region):

def write_spoiler(self, spoiler_handle: typing.TextIO) -> None:
required_trials_str = ", ".join(t for t in self.skipped_trials if not self.skipped_trials[t])
if required_trials_str == "":
required_trials_str = "None"
spoiler_handle.write(f"\n\nTrials ({self.multiworld.get_player_name(self.player)}): {required_trials_str}\n")

if self.shopsanity != 'off':
spoiler_handle.write(f"\nShop Prices ({self.multiworld.get_player_name(self.player)}):\n")
for k, v in self.shop_prices.items():
spoiler_handle.write(f"{k}: {v} Rupees\n")

# Write entrances to spoiler log
all_entrances = self.get_shuffled_entrances()
all_entrances.sort(reverse=True, key=lambda x: x.name)
all_entrances.sort(reverse=True, key=lambda x: x.type)
if not self.decouple_entrances:
while all_entrances:
loadzone = all_entrances.pop()
if loadzone.type != 'Overworld':
if loadzone.primary:
entrance = loadzone
else:
entrance = loadzone.reverse
if entrance.reverse is not None:
self.multiworld.spoiler.set_entrance(entrance, entrance.replaces.reverse, 'both', self.player)
else:
self.multiworld.spoiler.set_entrance(entrance, entrance.replaces, 'entrance', self.player)
else:
reverse = loadzone.replaces.reverse
if reverse in all_entrances:
all_entrances.remove(reverse)
self.multiworld.spoiler.set_entrance(loadzone, reverse, 'both', self.player)
else:
for entrance in all_entrances:
self.multiworld.spoiler.set_entrance(entrance, entrance.replaces, 'entrance', self.player)


# Key ring handling:
# Key rings are multiple items glued together into one, so we need to give
Expand Down
Loading