LTTP: fix some hashed string comparisons (#2927)

This commit is contained in:
Aaron Wagener 2024-03-11 04:00:28 -05:00 committed by GitHub
parent 9c920fbc53
commit 5fecb7f043
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 26 additions and 20 deletions

View File

@ -605,7 +605,7 @@ def get_pool_core(world, player: int):
placed_items[loc] = item placed_items[loc] = item
# provide boots to major glitch dependent seeds # 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') precollected_items.append('Pegasus Boots')
pool.remove('Pegasus Boots') pool.remove('Pegasus Boots')
pool.append('Rupees (20)') pool.append('Rupees (20)')

View File

@ -156,7 +156,7 @@ class OpenPyramid(Choice):
return world.goal[player].current_key in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'} return world.goal[player].current_key in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'}
elif self.value == self.option_auto: elif self.value == self.option_auto:
return world.goal[player].current_key in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'} \ 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) world.shuffle_ganon)
elif self.value == self.option_open: elif self.value == self.option_open:
return True return True

View File

@ -89,7 +89,7 @@ def set_rules(world):
if world.mode[player] != 'inverted': if world.mode[player] != 'inverted':
set_big_bomb_rules(world, player) 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) 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') 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: else:

View File

@ -642,17 +642,18 @@ class ALTTPWorld(World):
return ALttPItem(name, self.player, **item_init_table[name]) return ALttPItem(name, self.player, **item_init_table[name])
@classmethod @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 = {} trash_counts = {}
for player in world.get_game_players("A Link to the Past"): for player in multiworld.get_game_players("A Link to the Past"):
if not world.ganonstower_vanilla[player] or \ world = multiworld.worlds[player]
world.glitches_required[player] in {'overworld_glitches', 'hybrid_major_glitches', "no_logic"}: if not multiworld.ganonstower_vanilla[player] or \
world.options.glitches_required.current_key in {'overworld_glitches', 'hybrid_major_glitches', "no_logic"}:
pass pass
elif 'triforce_hunt' in world.goal[player].current_key and ('local' in world.goal[player].current_key or world.players == 1): elif 'triforce_hunt' in world.options.goal.current_key and ('local' in world.options.goal.current_key or world.players == 1):
trash_counts[player] = world.random.randint(world.crystals_needed_for_gt[player] * 2, trash_counts[player] = multiworld.random.randint(world.options.crystals_needed_for_gt * 2,
world.crystals_needed_for_gt[player] * 4) world.options.crystals_needed_for_gt * 4)
else: 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: if trash_counts:
locations_mapping = {player: [] for player in trash_counts} locations_mapping = {player: [] for player in trash_counts}
@ -662,14 +663,14 @@ class ALTTPWorld(World):
for player, trash_count in trash_counts.items(): for player, trash_count in trash_counts.items():
gtower_locations = locations_mapping[player] gtower_locations = locations_mapping[player]
world.random.shuffle(gtower_locations) multiworld.random.shuffle(gtower_locations)
while gtower_locations and filleritempool and trash_count > 0: while gtower_locations and filleritempool and trash_count > 0:
spot_to_fill = gtower_locations.pop() spot_to_fill = gtower_locations.pop()
for index, item in enumerate(filleritempool): for index, item in enumerate(filleritempool):
if spot_to_fill.item_rule(item): if spot_to_fill.item_rule(item):
filleritempool.pop(index) # remove from outer fill 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 fill_locations.remove(spot_to_fill) # very slow, unfortunately
trash_count -= 1 trash_count -= 1
break break

View File

@ -1,8 +1,9 @@
from worlds.alttp.Dungeons import create_dungeons, get_dungeon_item_pool from worlds.alttp.Dungeons import get_dungeon_item_pool
from worlds.alttp.EntranceShuffle import link_inverted_entrances from worlds.alttp.EntranceShuffle import link_inverted_entrances
from worlds.alttp.InvertedRegions import create_inverted_regions from worlds.alttp.InvertedRegions import create_inverted_regions
from worlds.alttp.ItemPool import difficulties from worlds.alttp.ItemPool import difficulties
from worlds.alttp.Items import item_factory from worlds.alttp.Items import item_factory
from worlds.alttp.Options import GlitchesRequired
from worlds.alttp.Regions import mark_light_world_regions from worlds.alttp.Regions import mark_light_world_regions
from worlds.alttp.Shops import create_shops from worlds.alttp.Shops import create_shops
from test.TestBase import TestBase from test.TestBase import TestBase
@ -14,7 +15,7 @@ class TestInvertedMinor(TestBase, LTTPTestBase):
def setUp(self): def setUp(self):
self.world_setup() self.world_setup()
self.multiworld.mode[1].value = 2 self.multiworld.mode[1].value = 2
self.multiworld.glitches_required[1] = "minor_glitches" self.multiworld.glitches_required[1] = GlitchesRequired.from_any("minor_glitches")
self.multiworld.bombless_start[1].value = True self.multiworld.bombless_start[1].value = True
self.multiworld.shuffle_capacity_upgrades[1].value = True self.multiworld.shuffle_capacity_upgrades[1].value = True
self.multiworld.difficulty_requirements[1] = difficulties['normal'] self.multiworld.difficulty_requirements[1] = difficulties['normal']

View File

@ -1,8 +1,9 @@
from worlds.alttp.Dungeons import create_dungeons, get_dungeon_item_pool from worlds.alttp.Dungeons import get_dungeon_item_pool
from worlds.alttp.EntranceShuffle import link_inverted_entrances from worlds.alttp.EntranceShuffle import link_inverted_entrances
from worlds.alttp.InvertedRegions import create_inverted_regions from worlds.alttp.InvertedRegions import create_inverted_regions
from worlds.alttp.ItemPool import difficulties from worlds.alttp.ItemPool import difficulties
from worlds.alttp.Items import item_factory from worlds.alttp.Items import item_factory
from worlds.alttp.Options import GlitchesRequired
from worlds.alttp.Regions import mark_light_world_regions from worlds.alttp.Regions import mark_light_world_regions
from worlds.alttp.Shops import create_shops from worlds.alttp.Shops import create_shops
from test.TestBase import TestBase from test.TestBase import TestBase
@ -13,7 +14,7 @@ from worlds.alttp.test import LTTPTestBase
class TestInvertedOWG(TestBase, LTTPTestBase): class TestInvertedOWG(TestBase, LTTPTestBase):
def setUp(self): def setUp(self):
self.world_setup() self.world_setup()
self.multiworld.glitches_required[1] = "overworld_glitches" self.multiworld.glitches_required[1] = GlitchesRequired.from_any("overworld_glitches")
self.multiworld.mode[1].value = 2 self.multiworld.mode[1].value = 2
self.multiworld.bombless_start[1].value = True self.multiworld.bombless_start[1].value = True
self.multiworld.shuffle_capacity_upgrades[1].value = True self.multiworld.shuffle_capacity_upgrades[1].value = True

View File

@ -3,6 +3,7 @@ from worlds.alttp.InvertedRegions import mark_dark_world_regions
from worlds.alttp.ItemPool import difficulties from worlds.alttp.ItemPool import difficulties
from worlds.alttp.Items import item_factory from worlds.alttp.Items import item_factory
from test.TestBase import TestBase from test.TestBase import TestBase
from worlds.alttp.Options import GlitchesRequired
from worlds.alttp.test import LTTPTestBase from worlds.alttp.test import LTTPTestBase
@ -10,7 +11,7 @@ from worlds.alttp.test import LTTPTestBase
class TestMinor(TestBase, LTTPTestBase): class TestMinor(TestBase, LTTPTestBase):
def setUp(self): def setUp(self):
self.world_setup() self.world_setup()
self.multiworld.glitches_required[1] = "minor_glitches" self.multiworld.glitches_required[1] = GlitchesRequired.from_any("minor_glitches")
self.multiworld.bombless_start[1].value = True self.multiworld.bombless_start[1].value = True
self.multiworld.shuffle_capacity_upgrades[1].value = True self.multiworld.shuffle_capacity_upgrades[1].value = True
self.multiworld.difficulty_requirements[1] = difficulties['normal'] self.multiworld.difficulty_requirements[1] = difficulties['normal']

View File

@ -3,6 +3,7 @@ from worlds.alttp.InvertedRegions import mark_dark_world_regions
from worlds.alttp.ItemPool import difficulties from worlds.alttp.ItemPool import difficulties
from worlds.alttp.Items import item_factory from worlds.alttp.Items import item_factory
from test.TestBase import TestBase from test.TestBase import TestBase
from worlds.alttp.Options import GlitchesRequired
from worlds.alttp.test import LTTPTestBase from worlds.alttp.test import LTTPTestBase
@ -11,7 +12,7 @@ class TestVanillaOWG(TestBase, LTTPTestBase):
def setUp(self): def setUp(self):
self.world_setup() self.world_setup()
self.multiworld.difficulty_requirements[1] = difficulties['normal'] self.multiworld.difficulty_requirements[1] = difficulties['normal']
self.multiworld.glitches_required[1] = "overworld_glitches" self.multiworld.glitches_required[1] = GlitchesRequired.from_any("overworld_glitches")
self.multiworld.bombless_start[1].value = True self.multiworld.bombless_start[1].value = True
self.multiworld.shuffle_capacity_upgrades[1].value = True self.multiworld.shuffle_capacity_upgrades[1].value = True
self.multiworld.worlds[1].er_seed = 0 self.multiworld.worlds[1].er_seed = 0

View File

@ -3,13 +3,14 @@ from worlds.alttp.InvertedRegions import mark_dark_world_regions
from worlds.alttp.ItemPool import difficulties from worlds.alttp.ItemPool import difficulties
from worlds.alttp.Items import item_factory from worlds.alttp.Items import item_factory
from test.TestBase import TestBase from test.TestBase import TestBase
from worlds.alttp.Options import GlitchesRequired
from worlds.alttp.test import LTTPTestBase from worlds.alttp.test import LTTPTestBase
class TestVanilla(TestBase, LTTPTestBase): class TestVanilla(TestBase, LTTPTestBase):
def setUp(self): def setUp(self):
self.world_setup() self.world_setup()
self.multiworld.glitches_required[1] = "no_glitches" self.multiworld.glitches_required[1] = GlitchesRequired.from_any("no_glitches")
self.multiworld.difficulty_requirements[1] = difficulties['normal'] self.multiworld.difficulty_requirements[1] = difficulties['normal']
self.multiworld.bombless_start[1].value = True self.multiworld.bombless_start[1].value = True
self.multiworld.shuffle_capacity_upgrades[1].value = True self.multiworld.shuffle_capacity_upgrades[1].value = True