Skip to content

Commit

Permalink
OoT: Entrance Spoiler Fixes (ArchipelagoMW#2500)
Browse files Browse the repository at this point in the history
  • Loading branch information
espeon65536 authored and EmilyV99 committed Apr 15, 2024
1 parent 933ce5f commit f2cbedd
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions worlds/oot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,31 @@ 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.type, x.name))
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 @@ -1229,38 +1254,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

0 comments on commit f2cbedd

Please sign in to comment.