split shopsanity into two options: "shopsanity" and "shop_slots"

This commit is contained in:
espeon65536 2021-09-05 23:39:56 -05:00 committed by Fabian Dill
parent 9f6fa2bd05
commit da1a2b2957
2 changed files with 30 additions and 22 deletions

View File

@ -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,

View File

@ -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()