From da1a2b2957b8cf283bdebc53225d5e36d3815c0c Mon Sep 17 00:00:00 2001 From: espeon65536 Date: Sun, 5 Sep 2021 23:39:56 -0500 Subject: [PATCH] split shopsanity into two options: "shopsanity" and "shop_slots" --- worlds/oot/Options.py | 25 +++++++++++++++---------- worlds/oot/__init__.py | 27 +++++++++++++++------------ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/worlds/oot/Options.py b/worlds/oot/Options.py index 36cf4d80..280bef07 100644 --- a/worlds/oot/Options.py +++ b/worlds/oot/Options.py @@ -237,17 +237,21 @@ class SongShuffle(Choice): class ShopShuffle(Choice): - """Randomizes shop contents. Set to "off" to not shuffle shops; "0" shuffles shops but does not allow multiworld items in shops.""" + """Randomizes shop contents. "fixed_number" randomizes a specific number of items per shop; + "random_number" randomizes the value for each shop. """ displayname = "Shopsanity" - option_0 = 0 - option_1 = 1 - option_2 = 2 - option_3 = 3 - option_4 = 4 - option_random_value = 5 - option_off = 6 - default = 6 - alias_false = 6 + option_off = 0 + option_fixed_number = 1 + option_random_number = 2 + alias_false = 0 + + +class ShopSlots(Range): + """Number of items per shop to be randomized into the main itempool. + Only active if Shopsanity is set to "fixed_number." """ + displayname = "Shuffled Shop Slots" + range_start = 0 + range_end = 4 class TokenShuffle(Choice): @@ -310,6 +314,7 @@ class ShuffleMedigoronCarpet(Toggle): shuffle_options: typing.Dict[str, type(Option)] = { "shuffle_song_items": SongShuffle, "shopsanity": ShopShuffle, + "shop_slots": ShopSlots, "tokensanity": TokenShuffle, "shuffle_scrubs": ScrubShuffle, "shuffle_cows": ShuffleCows, diff --git a/worlds/oot/__init__.py b/worlds/oot/__init__.py index a4349bd0..690bb364 100644 --- a/worlds/oot/__init__.py +++ b/worlds/oot/__init__.py @@ -198,9 +198,14 @@ class OOTWorld(World): self.disable_trade_revert = (self.shuffle_interior_entrances != 'off') or self.shuffle_overworld_entrances self.shuffle_special_interior_entrances = self.shuffle_interior_entrances == 'all' + # Convert the double option used by shopsanity into a single option + if self.shopsanity == 'random_number': + self.shopsanity = 'random' + elif self.shopsanity == 'fixed_number': + self.shopsanity = str(self.shop_slots) + # fixing some options self.starting_tod = self.starting_tod.replace('_', '-') # Fixes starting time spelling: "witching_hour" -> "witching-hour" - self.shopsanity = self.shopsanity.replace('_value', '') # can't set "random" manually self.shuffle_scrubs = self.shuffle_scrubs.replace('_prices', '') # Get hint distribution @@ -465,14 +470,6 @@ class OOTWorld(World): # Uniquely rename drop locations for each region and erase them from the spoiler set_drop_location_names(self) - # Locations which are not sendable must be converted to events - # This includes all locations for which show_in_spoiler is false, and shuffled shop items. - for loc in self.get_locations(): - if loc.address is not None and ( - not loc.show_in_spoiler or (loc.item is not None and loc.item.type == 'Shop') - or (self.skip_child_zelda and loc.name in ['HC Zeldas Letter', 'Song from Impa'])): - loc.address = None - # Gather items for ice trap appearances self.fake_items = [] if self.ice_trap_appearance in ['major_only', 'anything']: @@ -635,11 +632,17 @@ class OOTWorld(World): from .SaveContext import SaveContext item_to_place = self.world.random.choice(item for item in self.world.itempool if item.player == self.player and item.name in SaveContext.giveable_items) - self.world.push_item(impa, item_to_place, False) - impa.locked = True - impa.event = True + impa.place_locked_item(item_to_place) self.world.itempool.remove(item_to_place) + # Locations which are not sendable must be converted to events + # This includes all locations for which show_in_spoiler is false, and shuffled shop items. + for loc in self.get_locations(): + if loc.address is not None and ( + not loc.show_in_spoiler or (loc.item is not None and loc.item.type == 'Shop') + or (self.skip_child_zelda and loc.name in ['HC Zeldas Letter', 'Song from Impa'])): + loc.address = None + def generate_output(self, output_directory: str): if self.hints != 'none': hint_data_available.wait()