Merge branch 'shop-fill' into multishop-all

This commit is contained in:
pepperpow
2020-12-23 11:29:20 -06:00
5 changed files with 60 additions and 7 deletions

22
Rom.py
View File

@@ -633,6 +633,8 @@ def patch_rom(world, rom, player, team, enemized):
distinguished_prog_bow_loc.item.code = 0x65
# patch items
shop_items = []
for location in world.get_locations():
if location.player != player:
continue
@@ -659,9 +661,19 @@ def patch_rom(world, rom, player, team, enemized):
my_item['replacement'] = my_item['item']
my_item['replacement_price'] = my_item['price']
my_item['item'] = item.name
my_item['price'] = world.random.randrange(1, 61) * 5 # can probably replace this with a price chart
if any([x in my_item['item'] for x in ['Single Bomb', 'Single Arrow']]):
my_item['price'] = world.random.randrange(5,35)
elif any([x in my_item['item'] for x in ['Arrows', 'Bombs', 'Clock']]):
my_item['price'] = world.random.randrange(20,120)
elif any([x in my_item['item'] for x in ['Universal Key', 'Compass', 'Map', 'Small Key', 'Piece of Heart']]):
my_item['price'] = world.random.randrange(50,150)
else:
my_item['price'] = world.random.randrange(50,300)
my_item['max'] = 1
my_item['player'] = item.player if item.player != location.player else 0
shop_items.append(my_item)
continue
if not location.crystal:
@@ -702,6 +714,14 @@ def patch_rom(world, rom, player, team, enemized):
for music_address in music_addresses:
rom.write_byte(music_address, music)
my_prices = [my_item['price'] for my_item in shop_items]
price_scale = (80*max(8, len(my_prices)+2))/sum(my_prices)
for i in shop_items:
i['price'] *= price_scale
if i['price'] < 5: i['price'] = 5
else: i['price'] = int((i['price']//5)*5)
if world.mapshuffle[player]:
rom.write_byte(0x155C9, local_random.choice([0x11, 0x16])) # Randomize GT music too with map shuffle