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,
location.item.player if location.item.player != location.player else 0)
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):
@ -499,7 +499,7 @@ def shuffle_shops(world, items, player: int):
if 'P' in option:
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
# Upgrade shop is only one place, and will generally be too easy to
# replenish hearts and bombs
@ -529,14 +529,14 @@ price_blacklist = {
price_chart = {
ShopPriceType.Rupees: lambda p: p,
ShopPriceType.Hearts: lambda p: min(5, p // 5) * 8, # Each heart is 0x8 in memory, Max of 5 hearts (20 total??)
ShopPriceType.Magic: lambda p: min(15, p // 5) * 8, # Each pip is 0x8 in memory, Max of 15 pips (16 total...)
ShopPriceType.Bombs: lambda p: max(1, min(10, p // 5)), # 10 Bombs max
ShopPriceType.Arrows: lambda p: max(1, min(30, p // 5)), # 30 Arrows Max
ShopPriceType.Hearts: lambda p: min(5, p // 5) * 8, # Each heart is 0x8 in memory, Max of 5 hearts (20 total??)
ShopPriceType.Magic: lambda p: min(15, p // 5) * 8, # Each pip is 0x8 in memory, Max of 15 pips (16 total...)
ShopPriceType.Bombs: lambda p: max(1, min(10, p // 5)), # 10 Bombs max
ShopPriceType.Arrows: lambda p: max(1, min(30, p // 5)), # 30 Arrows Max
ShopPriceType.HeartContainer: lambda p: 0x8,
ShopPriceType.BombUpgrade: lambda p: 0x1,
ShopPriceType.ArrowUpgrade: lambda p: 0x1,
ShopPriceType.Keys: lambda p: min(3, (p // 100) + 1), # Max of 3 keys for a price
ShopPriceType.Keys: lambda p: min(3, (p // 100) + 1), # Max of 3 keys for a price
ShopPriceType.Potion: lambda p: (p // 5) % 5,
}
@ -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
"""
if item:
my_price_types = simple_price_types.copy()
world.random.shuffle(my_price_types)
for p_type in my_price_types:
# Ignore rupee prices, logic-based prices or Keys (if we're not on universal keys)
if p_type in [ShopPriceType.Rupees, ShopPriceType.BombUpgrade, ShopPriceType.ArrowUpgrade]:
price_types = [
ShopPriceType.Rupees, # included as a chance to not change price type
ShopPriceType.Hearts,
ShopPriceType.Bombs,
]
# 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
# 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]):
continue
else: