Better support for customized start_inverntory with dungeon items (can be mixed with item pool)

This commit is contained in:
aerinon
2023-02-24 15:45:37 -07:00
parent 409f7d50d5
commit d23d2d8323
2 changed files with 20 additions and 3 deletions

View File

@@ -1014,8 +1014,19 @@ item_alternates = {
def modify_pool_for_start_inventory(start_inventory, world, player): def modify_pool_for_start_inventory(start_inventory, world, player):
# skips custom item pools - these shouldn't be adjusted
if (world.customizer and world.customizer.get_item_pool()) or world.custom: if (world.customizer and world.customizer.get_item_pool()) or world.custom:
# custom item pools only adjust in dungeon items
for item in start_inventory:
if item.dungeon:
d = world.get_dungeon(item.dungeon, item.player)
match = next((i for i in d.all_items if i.name == item.name), None)
if match:
if match.map or match.compass:
d.dungeon_items.remove(match)
elif match.smallkey:
d.small_keys.remove(match)
elif match.bigkey and d.big_key == match:
d.big_key = None
return return
for item in start_inventory: for item in start_inventory:
if item.player == player: if item.player == player:
@@ -1041,8 +1052,8 @@ def modify_pool_for_start_inventory(start_inventory, world, player):
d.dungeon_items.remove(match) d.dungeon_items.remove(match)
elif match.smallkey: elif match.smallkey:
d.small_keys.remove(match) d.small_keys.remove(match)
elif match.bigkey: elif match.bigkey and d.big_key == match:
d.big_key.remove(match) d.big_key = None
def make_custom_item_pool(world, player, progressive, shuffle, difficulty, timer, goal, mode, swords, bombbag, customitemarray): def make_custom_item_pool(world, player, progressive, shuffle, difficulty, timer, goal, mode, swords, bombbag, customitemarray):

View File

@@ -2094,6 +2094,12 @@ def validate_key_placement(key_layout, world, player):
if world.bigkeyshuffle[player]: if world.bigkeyshuffle[player]:
max_counter = find_max_counter(key_layout) max_counter = find_max_counter(key_layout)
big_key_outside = bigkey_name not in (l.item.name for l in max_counter.free_locations if l.item) big_key_outside = bigkey_name not in (l.item.name for l in max_counter.free_locations if l.item)
for i in world.precollected_items:
if i.player == player and i.name == bigkey_name:
big_key_outside = True
break
if i.player == player and i.name == smallkey_name:
keys_outside += 1
for code, counter in key_layout.key_counters.items(): for code, counter in key_layout.key_counters.items():
if len(counter.child_doors) == 0: if len(counter.child_doors) == 0: