Fix money balancing with reduced item pool

This commit is contained in:
Catobat
2021-08-06 14:17:24 +02:00
parent bcaee735a2
commit 579c3bfd23
2 changed files with 13 additions and 10 deletions

View File

@@ -808,6 +808,8 @@ class CollectionState(object):
def collect(self, item, event=False, location=None):
if location:
self.locations_checked.add(location)
if not item:
return
changed = False
if item.name.startswith('Progressive '):
if 'Sword' in item.name:

View File

@@ -553,7 +553,7 @@ def balance_money_progression(world):
base_value = sum(rupee_rooms.values())
available_money = {player: base_value for player in range(1, world.players+1)}
for loc in world.get_locations():
if loc.item.name in rupee_chart:
if loc.item and loc.item.name in rupee_chart:
available_money[loc.item.player] += rupee_chart[loc.item.name]
total_price = {player: 0 for player in range(1, world.players+1)}
@@ -618,7 +618,7 @@ def balance_money_progression(world):
slot = shop_to_location_table[location.parent_region.name].index(location.name)
shop = location.parent_region.shop
shop_item = shop.inventory[slot]
if interesting_item(location, location.item, world, location.item.player):
if location.item and interesting_item(location, location.item, world, location.item.player):
if location.item.name.startswith('Rupee') and loc_player == location.item.player:
if shop_item['price'] < rupee_chart[location.item.name]:
wallet[loc_player] -= shop_item['price'] # will get picked up in the location_free block
@@ -638,6 +638,7 @@ def balance_money_progression(world):
if location_free:
state.collect(location.item, True, location)
unchecked_locations.remove(location)
if location.item:
if location.item.name.startswith('Rupee'):
wallet[location.item.player] += rupee_chart[location.item.name]
if location.item.name != 'Rupees (300)':
@@ -710,5 +711,5 @@ def balance_money_progression(world):
else:
state.collect(location.item, True, location)
unchecked_locations.remove(location)
if location.item.name.startswith('Rupee'):
if location.item and location.item.name.startswith('Rupee'):
wallet[location.item.player] += rupee_chart[location.item.name]