Skip to content

Commit bdd498d

Browse files
authored
ALTTP: Fix #2290's crashes (#2973)
1 parent 355223b commit bdd498d

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

worlds/alttp/ItemPool.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def cut_item(items, item_to_cut, minimum_items):
508508
multiworld.itempool += items
509509

510510
if multiworld.retro_caves[player]:
511-
set_up_take_anys(multiworld, player) # depends on world.itempool to be set
511+
set_up_take_anys(multiworld, world, player) # depends on world.itempool to be set
512512

513513

514514
take_any_locations = {
@@ -528,30 +528,30 @@ def cut_item(items, item_to_cut, minimum_items):
528528
take_any_locations.sort()
529529

530530

531-
def set_up_take_anys(world, player):
531+
def set_up_take_anys(multiworld, world, player):
532532
# these are references, do not modify these lists in-place
533-
if world.mode[player] == 'inverted':
533+
if multiworld.mode[player] == 'inverted':
534534
take_any_locs = take_any_locations_inverted
535535
else:
536536
take_any_locs = take_any_locations
537537

538-
regions = world.random.sample(take_any_locs, 5)
538+
regions = multiworld.random.sample(take_any_locs, 5)
539539

540-
old_man_take_any = LTTPRegion("Old Man Sword Cave", LTTPRegionType.Cave, 'the sword cave', player, world)
541-
world.regions.append(old_man_take_any)
540+
old_man_take_any = LTTPRegion("Old Man Sword Cave", LTTPRegionType.Cave, 'the sword cave', player, multiworld)
541+
multiworld.regions.append(old_man_take_any)
542542

543543
reg = regions.pop()
544-
entrance = world.get_region(reg, player).entrances[0]
545-
connect_entrance(world, entrance.name, old_man_take_any.name, player)
544+
entrance = multiworld.get_region(reg, player).entrances[0]
545+
connect_entrance(multiworld, entrance.name, old_man_take_any.name, player)
546546
entrance.target = 0x58
547547
old_man_take_any.shop = TakeAny(old_man_take_any, 0x0112, 0xE2, True, True, total_shop_slots)
548-
world.shops.append(old_man_take_any.shop)
548+
multiworld.shops.append(old_man_take_any.shop)
549549

550-
swords = [item for item in world.itempool if item.player == player and item.type == 'Sword']
550+
swords = [item for item in multiworld.itempool if item.player == player and item.type == 'Sword']
551551
if swords:
552-
sword = world.random.choice(swords)
553-
world.itempool.remove(sword)
554-
world.itempool.append(item_factory('Rupees (20)', world))
552+
sword = multiworld.random.choice(swords)
553+
multiworld.itempool.remove(sword)
554+
multiworld.itempool.append(item_factory('Rupees (20)', world))
555555
old_man_take_any.shop.add_inventory(0, sword.name, 0, 0)
556556
loc_name = "Old Man Sword Cave"
557557
location = ALttPLocation(player, loc_name, shop_table_by_location[loc_name], parent=old_man_take_any)
@@ -562,16 +562,16 @@ def set_up_take_anys(world, player):
562562
old_man_take_any.shop.add_inventory(0, 'Rupees (300)', 0, 0)
563563

564564
for num in range(4):
565-
take_any = LTTPRegion("Take-Any #{}".format(num+1), LTTPRegionType.Cave, 'a cave of choice', player, world)
566-
world.regions.append(take_any)
565+
take_any = LTTPRegion("Take-Any #{}".format(num+1), LTTPRegionType.Cave, 'a cave of choice', player, multiworld)
566+
multiworld.regions.append(take_any)
567567

568-
target, room_id = world.random.choice([(0x58, 0x0112), (0x60, 0x010F), (0x46, 0x011F)])
568+
target, room_id = multiworld.random.choice([(0x58, 0x0112), (0x60, 0x010F), (0x46, 0x011F)])
569569
reg = regions.pop()
570-
entrance = world.get_region(reg, player).entrances[0]
571-
connect_entrance(world, entrance.name, take_any.name, player)
570+
entrance = multiworld.get_region(reg, player).entrances[0]
571+
connect_entrance(multiworld, entrance.name, take_any.name, player)
572572
entrance.target = target
573573
take_any.shop = TakeAny(take_any, room_id, 0xE3, True, True, total_shop_slots + num + 1)
574-
world.shops.append(take_any.shop)
574+
multiworld.shops.append(take_any.shop)
575575
take_any.shop.add_inventory(0, 'Blue Potion', 0, 0)
576576
take_any.shop.add_inventory(1, 'Boss Heart Container', 0, 0)
577577
location = ALttPLocation(player, take_any.name, shop_table_by_location[take_any.name], parent=take_any)

worlds/alttp/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def stage_fill_hook(cls, multiworld, progitempool, usefulitempool, filleritempoo
649649
if not multiworld.ganonstower_vanilla[player] or \
650650
world.options.glitches_required.current_key in {'overworld_glitches', 'hybrid_major_glitches', "no_logic"}:
651651
pass
652-
elif 'triforce_hunt' in world.options.goal.current_key and ('local' in world.options.goal.current_key or world.players == 1):
652+
elif 'triforce_hunt' in world.options.goal.current_key and ('local' in world.options.goal.current_key or multiworld.players == 1):
653653
trash_counts[player] = multiworld.random.randint(world.options.crystals_needed_for_gt * 2,
654654
world.options.crystals_needed_for_gt * 4)
655655
else:

0 commit comments

Comments
 (0)