LttP: allow hinting and tracking "Take Any" type shops (#1392)

* LttP: allow hinting and tracking "Take Any" type shops
fix broken behaviour since bow/cave split


Co-authored-by: CaitSith2 <d_good@caitsith2.com>
This commit is contained in:
Fabian Dill
2023-01-19 16:17:43 +01:00
committed by GitHub
parent 29e1c3dcf4
commit c839a76fe7
4 changed files with 327 additions and 186 deletions

View File

@@ -3,7 +3,7 @@ import logging
from BaseClasses import Region, RegionType, ItemClassification
from worlds.alttp.SubClasses import ALttPLocation
from worlds.alttp.Shops import TakeAny, total_shop_slots, set_up_shops, shuffle_shops
from worlds.alttp.Shops import TakeAny, total_shop_slots, set_up_shops, shuffle_shops, create_dynamic_shop_locations
from worlds.alttp.Bosses import place_bosses
from worlds.alttp.Dungeons import get_dungeon_item_pool_player
from worlds.alttp.EntranceShuffle import connect_entrance
@@ -436,12 +436,13 @@ def generate_itempool(world):
if world.shop_shuffle[player]:
shuffle_shops(world, nonprogressionitems, player)
create_dynamic_shop_locations(world, player)
world.itempool += progressionitems + nonprogressionitems
if world.retro_caves[player]:
set_up_take_anys(world, player) # depends on world.itempool to be set
# set_up_take_anys needs to run first
create_dynamic_shop_locations(world, player)
take_any_locations = {
@@ -487,7 +488,7 @@ def set_up_take_anys(world, player):
world.itempool.append(ItemFactory('Rupees (20)', player))
old_man_take_any.shop.add_inventory(0, sword.name, 0, 0, create_location=True)
else:
old_man_take_any.shop.add_inventory(0, 'Rupees (300)', 0, 0)
old_man_take_any.shop.add_inventory(0, 'Rupees (300)', 0, 0, create_location=True)
for num in range(4):
take_any = Region("Take-Any #{}".format(num+1), RegionType.Cave, 'a cave of choice', player)
@@ -501,29 +502,11 @@ def set_up_take_anys(world, player):
take_any.shop = TakeAny(take_any, room_id, 0xE3, True, True, total_shop_slots + num + 1)
world.shops.append(take_any.shop)
take_any.shop.add_inventory(0, 'Blue Potion', 0, 0)
take_any.shop.add_inventory(1, 'Boss Heart Container', 0, 0)
take_any.shop.add_inventory(1, 'Boss Heart Container', 0, 0, create_location=True)
world.initialize_regions()
def create_dynamic_shop_locations(world, player):
for shop in world.shops:
if shop.region.player == player:
for i, item in enumerate(shop.inventory):
if item is None:
continue
if item['create_location']:
loc = ALttPLocation(player, f"{shop.region.name} {shop.slot_names[i]}", parent=shop.region)
shop.region.locations.append(loc)
world.clear_location_cache()
world.push_item(loc, ItemFactory(item['item'], player), False)
loc.shop_slot = i
loc.event = True
loc.locked = True
def get_pool_core(world, player: int):
shuffle = world.shuffle[player]
difficulty = world.difficulty[player]