diff --git a/BaseClasses.py b/BaseClasses.py index e25c29d6..f84abd59 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -452,9 +452,11 @@ class World(object): """Check if accessibility rules are fulfilled with current or supplied state.""" if not state: state = CollectionState(self) - players = {} + players = {"none" : set(), + "items": set(), + "locations": set()} for player, access in self.accessibility.items(): - players.setdefault(access, set()).add(player) + players[access].add(player) beatable_fulfilled = False diff --git a/ItemPool.py b/ItemPool.py index fdcb6cba..83ec53b8 100644 --- a/ItemPool.py +++ b/ItemPool.py @@ -619,7 +619,7 @@ def fill_prizes(world, attempts=15): prize_locs = list(empty_crystal_locations) world.random.shuffle(prizepool) world.random.shuffle(prize_locs) - fill_restrictive(world, all_state, prize_locs, prizepool, True) + fill_restrictive(world, all_state, prize_locs, prizepool, True, lock=True) except FillError as e: logging.getLogger('').exception("Failed to place dungeon prizes (%s). Will retry %s more times", e, attempts - attempt) diff --git a/Main.py b/Main.py index 701ab50e..2ffd86c2 100644 --- a/Main.py +++ b/Main.py @@ -218,7 +218,7 @@ def main(args, seed=None): if shop_slots: # TODO: allow each game to register a blacklist to be used here? - blacklist_words = {"Rupee", "Pendant", "Crystal"} + blacklist_words = {"Rupee"} blacklist_words = {item_name for item_name in item_table if any( blacklist_word in item_name for blacklist_word in blacklist_words)} blacklist_words.add("Bee") @@ -238,12 +238,14 @@ def main(args, seed=None): if shop.can_push_inventory(slot_num): for c in candidates: # chosen item locations if c.item_rule(location.item) and location.item_rule(c.item): # if rule is good... - logger.debug(f'Swapping {c} into {location}:: {c.item}') + swap_location_item(c, location, check_locked=False) candidates.remove(c) if not world.fulfills_accessibility(): swap_location_item(c, location, check_locked=False) continue + + logger.debug(f'Swapping {c} into {location}:: {location.item}') break else: diff --git a/Regions.py b/Regions.py index afbea2c7..94eac4b3 100644 --- a/Regions.py +++ b/Regions.py @@ -416,7 +416,8 @@ def create_shops(world, player: int): if my_shop_slots.pop(): additional_item = 'Rupees (50)' # world.random.choice(['Rupees (50)', 'Rupees (100)', 'Rupees (300)']) slot_name = "{} Slot {}".format(shop.region.name, index + 1) - loc = Location(player, slot_name, address=shop_table_by_location[slot_name], parent=shop.region) + loc = Location(player, slot_name, address=shop_table_by_location[slot_name], + parent=shop.region, hint_text="for sale") loc.shop_slot = True loc.locked = True loc.item = ItemFactory(additional_item, player)