LttP: fix retro allowing arrows in "P" price shuffle in shops (#448)

This commit is contained in:
Fabian Dill 2022-04-22 09:12:51 +02:00 committed by GitHub
parent acd7bce903
commit 0f5a7cda6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 23 deletions

View File

@ -267,7 +267,7 @@ def ShopSlotFill(world):
min(int(price * world.shop_price_modifier[location.player] / 100) * 5, 9999), 1, min(int(price * world.shop_price_modifier[location.player] / 100) * 5, 9999), 1,
location.item.player if location.item.player != location.player else 0) location.item.player if location.item.player != location.player else 0)
if 'P' in world.shop_shuffle[location.player]: if 'P' in world.shop_shuffle[location.player]:
price_to_funny_price(shop.inventory[location.shop_slot], world, location.player) price_to_funny_price(world, shop.inventory[location.shop_slot], location.player)
def create_shops(world, player: int): def create_shops(world, player: int):
@ -499,7 +499,7 @@ def shuffle_shops(world, items, player: int):
if 'P' in option: if 'P' in option:
for item in total_inventory: for item in total_inventory:
price_to_funny_price(item, world, player) price_to_funny_price(world, item, player)
# Don't apply to upgrade shops # Don't apply to upgrade shops
# Upgrade shop is only one place, and will generally be too easy to # Upgrade shop is only one place, and will generally be too easy to
# replenish hearts and bombs # replenish hearts and bombs
@ -564,27 +564,27 @@ simple_price_types = [
] ]
def price_to_funny_price(item: dict, world, player: int): def price_to_funny_price(world, item: dict, player: int):
""" """
Converts a raw Rupee price into a special price type Converts a raw Rupee price into a special price type
""" """
if item: if item:
my_price_types = simple_price_types.copy() price_types = [
world.random.shuffle(my_price_types) ShopPriceType.Rupees, # included as a chance to not change price type
for p_type in my_price_types: ShopPriceType.Hearts,
# Ignore rupee prices, logic-based prices or Keys (if we're not on universal keys) ShopPriceType.Bombs,
if p_type in [ShopPriceType.Rupees, ShopPriceType.BombUpgrade, ShopPriceType.ArrowUpgrade]: ]
# don't pay in universal keys to get access to universal keys
if world.smallkey_shuffle[player] == smallkey_shuffle.option_universal \
and not "Small Key (Universal)" == item['replacement']:
price_types.append(ShopPriceType.Keys)
if not world.retro[player]:
price_types.append(ShopPriceType.Arrows)
world.random.shuffle(price_types)
for p_type in price_types:
# Ignore rupee prices
if p_type == ShopPriceType.Rupees:
return return
# If we're using keys...
# Check if we're in universal, check if our replacement isn't a Small Key
# Check if price isn't super small... (this will ideally be handled in a future table)
if p_type in [ShopPriceType.Keys]:
if world.smallkey_shuffle[player] != smallkey_shuffle.option_universal:
continue
elif item['replacement'] and 'Small Key' in item['replacement']:
continue
if item['price'] < 50:
continue
if any(x in item['item'] for x in price_blacklist[p_type]): if any(x in item['item'] for x in price_blacklist[p_type]):
continue continue
else: else: