Merge branch 'shop-fill' into multishop-all

This commit is contained in:
pepperpow 2020-12-23 20:50:41 -06:00
commit 62cfa8813f
1 changed files with 7 additions and 6 deletions

13
Main.py
View File

@ -233,12 +233,13 @@ def main(args, seed=None):
shop_item['player'] = item.player if item.player != location.player else 0 shop_item['player'] = item.player if item.player != location.player else 0
shop_items.append(shop_item) shop_items.append(shop_item)
my_prices = [my_item['price'] for my_item in shop_items] if len(shop_items) > 0:
price_scale = (80*max(8, len(my_prices)+2))/sum(my_prices) my_prices = [my_item['price'] for my_item in shop_items]
for i in shop_items: price_scale = (80*max(8, len(my_prices)+2))/sum(my_prices)
i['price'] *= price_scale for i in shop_items:
if i['price'] < 5: i['price'] = 5 i['price'] *= price_scale
else: i['price'] = int((i['price']//5)*5) if i['price'] < 5: i['price'] = 5
else: i['price'] = int((i['price']//5)*5)
logging.debug('Adjusting {} of {} shop slots'.format(len(shop_slots_adjusted), len(shop_slots))) logging.debug('Adjusting {} of {} shop slots'.format(len(shop_slots_adjusted), len(shop_slots)))
logging.debug('Adjusted {} into shops'.format([x.item.name for x in shop_slots_adjusted])) logging.debug('Adjusted {} into shops'.format([x.item.name for x in shop_slots_adjusted]))