Fixed the shop spoiler when multiworld balancing

This commit is contained in:
aerinon
2021-07-01 16:52:16 -06:00
parent 1fb849c137
commit 3fd096844c
2 changed files with 17 additions and 12 deletions

27
Fill.py
View File

@@ -496,6 +496,10 @@ def balance_multiworld_progression(world):
new_location = replacement_locations.pop() new_location = replacement_locations.pop()
new_location.item, old_location.item = old_location.item, new_location.item 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 new_location.event, old_location.event = True, False
state.collect(new_location.item, True, new_location) state.collect(new_location.item, True, new_location)
replaced_items = True replaced_items = True
@@ -516,6 +520,18 @@ def balance_multiworld_progression(world):
raise RuntimeError('Not all required items reachable. Something went terribly wrong here.') 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): def balance_money_progression(world):
logger = logging.getLogger('') logger = logging.getLogger('')
state = CollectionState(world) state = CollectionState(world)
@@ -583,17 +599,6 @@ def balance_money_progression(world):
path = path[1] path = path[1]
return False 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 done = False
while not done: while not done:
sphere_costs = {player: 0 for player in range(1, world.players+1)} sphere_costs = {player: 0 for player in range(1, world.players+1)}

View File

@@ -19,7 +19,7 @@ Thanks to qadan, cheuer, & compiling
* Some text updated (Blind jokes, uncle text) * Some text updated (Blind jokes, uncle text)
* Fixed some enemizer Mystery settings * Fixed some enemizer Mystery settings
* Added a setting that's random enemy shuffle without Unkillable Thieves possible * 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 * 0.4.0.7
* Reduce flashing option added * Reduce flashing option added
* Sprite author credit added * Sprite author credit added