Skip to content

LTTP: fix some hashed string comparisons #2927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion worlds/alttp/ItemPool.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def place_item(loc, item):
placed_items[loc] = item

# provide boots to major glitch dependent seeds
if logic in {'overworld_glitches', 'hybrid_major_glitches', 'no_logic'} and world.glitch_boots[player]:
if logic.current_key in {'overworld_glitches', 'hybrid_major_glitches', 'no_logic'} and world.glitch_boots[player]:
precollected_items.append('Pegasus Boots')
pool.remove('Pegasus Boots')
pool.append('Rupees (20)')
Expand Down
2 changes: 1 addition & 1 deletion worlds/alttp/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def to_bool(self, world: MultiWorld, player: int) -> bool:
return world.goal[player].current_key in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'}
elif self.value == self.option_auto:
return world.goal[player].current_key in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'} \
and (world.entrance_shuffle[player] in {'vanilla', 'dungeons_simple', 'dungeons_full', 'dungeons_crossed'} or not
and (world.entrance_shuffle[player].current_key in {'vanilla', 'dungeons_simple', 'dungeons_full', 'dungeons_crossed'} or not
world.shuffle_ganon)
elif self.value == self.option_open:
return True
Expand Down
2 changes: 1 addition & 1 deletion worlds/alttp/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def set_rules(world):

if world.mode[player] != 'inverted':
set_big_bomb_rules(world, player)
if world.glitches_required[player] in {'overworld_glitches', 'hybrid_major_glitches', 'no_logic'} and world.entrance_shuffle[player] not in {'insanity', 'insanity_legacy', 'madness'}:
if world.glitches_required[player].current_key in {'overworld_glitches', 'hybrid_major_glitches', 'no_logic'} and world.entrance_shuffle[player].current_key not in {'insanity', 'insanity_legacy', 'madness'}:
path_to_courtyard = mirrorless_path_to_castle_courtyard(world, player)
add_rule(world.get_entrance('Pyramid Fairy', player), lambda state: state.multiworld.get_entrance('Dark Death Mountain Offset Mirror', player).can_reach(state) and all(rule(state) for rule in path_to_courtyard), 'or')
else:
Expand Down
21 changes: 11 additions & 10 deletions worlds/alttp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,17 +642,18 @@ def create_item(self, name: str) -> Item:
return ALttPItem(name, self.player, **item_init_table[name])

@classmethod
def stage_fill_hook(cls, world, progitempool, usefulitempool, filleritempool, fill_locations):
def stage_fill_hook(cls, multiworld, progitempool, usefulitempool, filleritempool, fill_locations):
trash_counts = {}
for player in world.get_game_players("A Link to the Past"):
if not world.ganonstower_vanilla[player] or \
world.glitches_required[player] in {'overworld_glitches', 'hybrid_major_glitches', "no_logic"}:
for player in multiworld.get_game_players("A Link to the Past"):
world = multiworld.worlds[player]
if not multiworld.ganonstower_vanilla[player] or \
world.options.glitches_required.current_key in {'overworld_glitches', 'hybrid_major_glitches', "no_logic"}:
pass
elif 'triforce_hunt' in world.goal[player].current_key and ('local' in world.goal[player].current_key or world.players == 1):
trash_counts[player] = world.random.randint(world.crystals_needed_for_gt[player] * 2,
world.crystals_needed_for_gt[player] * 4)
elif 'triforce_hunt' in world.options.goal.current_key and ('local' in world.options.goal.current_key or world.players == 1):
trash_counts[player] = multiworld.random.randint(world.options.crystals_needed_for_gt * 2,
world.options.crystals_needed_for_gt * 4)
else:
trash_counts[player] = world.random.randint(0, world.crystals_needed_for_gt[player] * 2)
trash_counts[player] = multiworld.random.randint(0, world.options.crystals_needed_for_gt * 2)

if trash_counts:
locations_mapping = {player: [] for player in trash_counts}
Expand All @@ -662,14 +663,14 @@ def stage_fill_hook(cls, world, progitempool, usefulitempool, filleritempool, fi

for player, trash_count in trash_counts.items():
gtower_locations = locations_mapping[player]
world.random.shuffle(gtower_locations)
multiworld.random.shuffle(gtower_locations)

while gtower_locations and filleritempool and trash_count > 0:
spot_to_fill = gtower_locations.pop()
for index, item in enumerate(filleritempool):
if spot_to_fill.item_rule(item):
filleritempool.pop(index) # remove from outer fill
world.push_item(spot_to_fill, item, False)
multiworld.push_item(spot_to_fill, item, False)
fill_locations.remove(spot_to_fill) # very slow, unfortunately
trash_count -= 1
break
Expand Down