LADX: use start_inventory_from_pool (#4641)

This commit is contained in:
threeandthreee
2025-10-13 13:32:49 -04:00
committed by GitHub
parent aff98a5b78
commit 5ce71db048
2 changed files with 37 additions and 42 deletions

View File

@@ -3,7 +3,7 @@ from dataclasses import dataclass
import os.path import os.path
import typing import typing
import logging import logging
from Options import Choice, Toggle, DefaultOnToggle, Range, FreeText, PerGameCommonOptions, OptionGroup, Removed from Options import Choice, Toggle, DefaultOnToggle, Range, FreeText, PerGameCommonOptions, OptionGroup, Removed, StartInventoryPool
from collections import defaultdict from collections import defaultdict
import Utils import Utils
@@ -665,6 +665,7 @@ class LinksAwakeningOptions(PerGameCommonOptions):
tarins_gift: TarinsGift tarins_gift: TarinsGift
overworld: Overworld overworld: Overworld
stabilize_item_pool: StabilizeItemPool stabilize_item_pool: StabilizeItemPool
start_inventory_from_pool: StartInventoryPool
warp_improvements: Removed warp_improvements: Removed
additional_warp_points: Removed additional_warp_points: Removed

View File

@@ -225,8 +225,6 @@ class LinksAwakeningWorld(World):
def create_items(self) -> None: def create_items(self) -> None:
itempool = [] itempool = []
exclude = [item.name for item in self.multiworld.precollected_items[self.player]]
self.prefill_original_dungeon = [ [], [], [], [], [], [], [], [], [] ] self.prefill_original_dungeon = [ [], [], [], [], [], [], [], [], [] ]
self.prefill_own_dungeons = [] self.prefill_own_dungeons = []
self.pre_fill_items = [] self.pre_fill_items = []
@@ -243,50 +241,46 @@ class LinksAwakeningWorld(World):
continue continue
item_name = ladxr_item_to_la_item_name[ladx_item_name] item_name = ladxr_item_to_la_item_name[ladx_item_name]
for _ in range(count): for _ in range(count):
if item_name in exclude: item = self.create_item(item_name)
exclude.remove(item_name) # this is destructive. create unique list above
self.multiworld.itempool.append(self.create_item(self.get_filler_item_name()))
else:
item = self.create_item(item_name)
if not self.options.tradequest and isinstance(item.item_data, TradeItemData): if not self.options.tradequest and isinstance(item.item_data, TradeItemData):
location = self.multiworld.get_location(item.item_data.vanilla_location, self.player) location = self.multiworld.get_location(item.item_data.vanilla_location, self.player)
location.place_locked_item(item) location.place_locked_item(item)
location.show_in_spoiler = False location.show_in_spoiler = False
continue continue
if isinstance(item.item_data, DungeonItemData): if isinstance(item.item_data, DungeonItemData):
item_type = item.item_data.ladxr_id[:-1] item_type = item.item_data.ladxr_id[:-1]
shuffle_type = self.dungeon_item_types[item_type] shuffle_type = self.dungeon_item_types[item_type]
if item.item_data.dungeon_item_type == DungeonItemType.INSTRUMENT and shuffle_type == ShuffleInstruments.option_vanilla: if item.item_data.dungeon_item_type == DungeonItemType.INSTRUMENT and shuffle_type == ShuffleInstruments.option_vanilla:
# Find instrument, lock # Find instrument, lock
# TODO: we should be able to pinpoint the region we want, save a lookup table please # TODO: we should be able to pinpoint the region we want, save a lookup table please
found = False found = False
for r in self.multiworld.get_regions(self.player): for r in self.multiworld.get_regions(self.player):
if r.dungeon_index != item.item_data.dungeon_index: if r.dungeon_index != item.item_data.dungeon_index:
continue
for loc in r.locations:
if not isinstance(loc, LinksAwakeningLocation):
continue continue
for loc in r.locations: if not isinstance(loc.ladxr_item, Instrument):
if not isinstance(loc, LinksAwakeningLocation): continue
continue loc.place_locked_item(item)
if not isinstance(loc.ladxr_item, Instrument): found = True
continue break
loc.place_locked_item(item) if found:
found = True break
break
if found:
break
else:
if shuffle_type == DungeonItemShuffle.option_original_dungeon:
self.prefill_original_dungeon[item.item_data.dungeon_index - 1].append(item)
self.pre_fill_items.append(item)
elif shuffle_type == DungeonItemShuffle.option_own_dungeons:
self.prefill_own_dungeons.append(item)
self.pre_fill_items.append(item)
else:
itempool.append(item)
else: else:
itempool.append(item) if shuffle_type == DungeonItemShuffle.option_original_dungeon:
self.prefill_original_dungeon[item.item_data.dungeon_index - 1].append(item)
self.pre_fill_items.append(item)
elif shuffle_type == DungeonItemShuffle.option_own_dungeons:
self.prefill_own_dungeons.append(item)
self.pre_fill_items.append(item)
else:
itempool.append(item)
else:
itempool.append(item)
self.multi_key = self.generate_multi_key() self.multi_key = self.generate_multi_key()