From 3fd096844c2d2c1135f8f9a12d558bead7dcf3ea Mon Sep 17 00:00:00 2001 From: aerinon Date: Thu, 1 Jul 2021 16:52:16 -0600 Subject: [PATCH] Fixed the shop spoiler when multiworld balancing --- Fill.py | 27 ++++++++++++++++----------- RELEASENOTES.md | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Fill.py b/Fill.py index 922ef957..25e85a51 100644 --- a/Fill.py +++ b/Fill.py @@ -496,6 +496,10 @@ def balance_multiworld_progression(world): new_location = replacement_locations.pop() new_location.item, old_location.item = old_location.item, new_location.item + if world.shopsanity[new_location.player]: + check_shop_swap(new_location) + if world.shopsanity[old_location.player]: + check_shop_swap(old_location) new_location.event, old_location.event = True, False state.collect(new_location.item, True, new_location) replaced_items = True @@ -516,6 +520,18 @@ def balance_multiworld_progression(world): raise RuntimeError('Not all required items reachable. Something went terribly wrong here.') +def check_shop_swap(l): + if l.parent_region.name in shop_to_location_table: + if l.name in shop_to_location_table[l.parent_region.name]: + idx = shop_to_location_table[l.parent_region.name].index(l.name) + inv_slot = l.parent_region.shop.inventory[idx] + inv_slot['item'] = l.item.name + elif l.parent_region in retro_shops: + idx = retro_shops[l.parent_region.name].index(l.name) + inv_slot = l.parent_region.shop.inventory[idx] + inv_slot['item'] = l.item.name + + def balance_money_progression(world): logger = logging.getLogger('') state = CollectionState(world) @@ -583,17 +599,6 @@ def balance_money_progression(world): path = path[1] return False - def check_shop_swap(l): - if l.parent_region.name in shop_to_location_table: - if l.name in shop_to_location_table[l.parent_region.name]: - idx = shop_to_location_table[l.parent_region.name].index(l.name) - inv_slot = l.parent_region.shop.inventory[idx] - inv_slot['item'] = l.item.name - elif location.parent_region in retro_shops: - idx = retro_shops[l.parent_region.name].index(l.name) - inv_slot = l.parent_region.shop.inventory[idx] - inv_slot['item'] = l.item.name - done = False while not done: sphere_costs = {player: 0 for player in range(1, world.players+1)} diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 487b68b3..01f54a07 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -19,7 +19,7 @@ Thanks to qadan, cheuer, & compiling * Some text updated (Blind jokes, uncle text) * Fixed some enemizer Mystery settings * Added a setting that's random enemy shuffle without Unkillable Thieves possible - * Fixed shop spoiler when money balancing + * Fixed shop spoiler when money balancing/multiworld balancing * 0.4.0.7 * Reduce flashing option added * Sprite author credit added