Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fenhl committed Nov 8, 2023
1 parent 900463f commit 6622b72
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions World.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,14 @@ def __init__(self, world_id: int, settings: Settings, resolve_randomized_setting
self.disable_trade_revert: bool = self.shuffle_interior_entrances or settings.shuffle_overworld_entrances or settings.adult_trade_shuffle
self.skip_child_zelda: bool = 'Zeldas Letter' not in settings.shuffle_child_trade and \
'Zeldas Letter' in self.distribution.starting_items
self.selected_adult_trade_item: str = random.choice(settings.adult_trade_start) if settings.adult_trade_start else None
# Override the adult trade item used to control trade quest flags during patching if any are placed in plando.
# This has to run here because the rule parser caches world attributes and this attribute impacts logic for buying a blue potion from Granny's Potion shop.
locations = {}
if self.distribution.locations:
locations = {loc: self.distribution.locations[loc] for loc in random.sample(sorted(self.distribution.locations), len(self.distribution.locations))}
adult_trade_matcher = self.distribution.pattern_matcher("#AdultTrade")
plando_adult_trade = list(filter(lambda location_record_pair: adult_trade_matcher(location_record_pair[1].item), self.distribution.pattern_dict_items(locations)))
if plando_adult_trade and not settings.adult_trade_shuffle and settings.adult_trade_start:
self.selected_adult_trade_item = plando_adult_trade[0][1].item # ugly but functional, see the loop in Plandomizer.WorldDistribution.fill for how this is indexed
if not settings.adult_trade_shuffle and settings.adult_trade_start:
self.selected_adult_trade_item: str = random.choice(settings.adult_trade_start)
# Override the adult trade item used to control trade quest flags during patching if any are placed in plando.
# This has to run here because the rule parser caches world attributes and this attribute impacts logic for buying a blue potion from Granny's Potion shop.
adult_trade_matcher = self.distribution.pattern_matcher("#AdultTrade")
plando_adult_trade = list(filter(lambda location_record_pair: adult_trade_matcher(location_record_pair[1].item), self.distribution.pattern_dict_items(self.distribution.locations)))
if plando_adult_trade:
self.selected_adult_trade_item = plando_adult_trade[0][1].item # ugly but functional, see the loop in Plandomizer.WorldDistribution.fill for how this is indexed
self.adult_trade_starting_inventory: str = ''

if (settings.open_forest == 'closed'
Expand Down

0 comments on commit 6622b72

Please sign in to comment.