Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions Fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,20 @@ def distribute_items_restrictive(worlds: list[World], fill_locations: Optional[l
# the song locations only.
if worlds[0].settings.shuffle_song_items != 'any':
logger.info('Placing song items.')
# Prioritize Song from Impa when skip child zelda is on to ensure it
# gets a song and not some other type of item when songs on songs is
# enabled.
impas: list[Location] = []
impas_songs: list[Item] = []
for world in worlds:
if world.skip_child_zelda:
own_songs = [song for song in songitempool if song.world.id == world.id]
impa = world.get_location('Song from Impa')
if own_songs and impa.item is None:
impas.append(impa)
impas_songs.append(random.choice(own_songs))
if impas and impas_songs:
fill_ownworld_restrictive(worlds, search, impas, impas_songs, progitempool, "song")
fill_ownworld_restrictive(worlds, search, song_locations, songitempool, progitempool, "song")
search.collect_locations()
fill_locations += [location for location in song_locations if location.item is None]
Expand Down Expand Up @@ -342,8 +356,8 @@ def fill_dungeon_unique_item(worlds: list[World], search: Search, fill_locations
def fill_ownworld_restrictive(worlds: list[World], search: Search, locations: list[Location], ownpool: list[Item],
itempool: list[Item], description: str = "Unknown", attempts: int = 15) -> None:
# look for preplaced items
placed_prizes = [loc.item.name for loc in locations if loc.item is not None]
unplaced_prizes = [item for item in ownpool if item.name not in placed_prizes]
placed_prizes = [loc.item for loc in locations if loc.item is not None]
unplaced_prizes = [item for item in ownpool if item not in placed_prizes]
empty_locations = [loc for loc in locations if loc.item is None]

prizepool_dict = {world.id: [item for item in unplaced_prizes if item.world.id == world.id] for world in worlds}
Expand Down
4 changes: 2 additions & 2 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def generate(settings: Settings) -> Spoiler:

def build_world_graphs(settings: Settings) -> list[World]:
logger = logging.getLogger('')
worlds = []
worlds: list[World] = []
for i in range(0, settings.world_count):
worlds.append(World(i, settings.copy()))

Expand Down Expand Up @@ -264,7 +264,7 @@ def generate_wad(wad_file: str, rom_file: str, output_file: str, channel_title:
with open(wad_file, 'rb') as wad_stream:
wad_buffer = bytearray(wad_stream.read(0xFC0))
except FileNotFoundError as ex:
raise FileNotFoundError(f'Invalid path to Base WAD: "{input_file}"')
raise FileNotFoundError(f'Invalid path to Base WAD: "{wad_file}"')

wad_app1_sha1_usa = [
[0x76, 0x3D, 0x4D, 0x3D, 0x07, 0x13, 0xE4, 0xD1, 0x0E, 0x44, 0x54, 0x0C, 0xCF, 0xA3, 0x25, 0x5E, 0x19, 0xF2, 0x8A, 0xF7], # US Wad App1
Expand Down