From 60379d9ae6158011f482b69f253ff1d610aadb3f Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Thu, 3 Feb 2022 10:41:31 +0100 Subject: [PATCH] LttP: when generating hint tiles, no longer consider Single Arrow as useful, but do consider all varieties of Bow. Additionally, don't create hints for Universal Small Keys --- worlds/alttp/Options.py | 5 +++ worlds/alttp/Rom.py | 98 +++++------------------------------------ 2 files changed, 15 insertions(+), 88 deletions(-) diff --git a/worlds/alttp/Options.py b/worlds/alttp/Options.py index 93c3e6c8..5cd73e07 100644 --- a/worlds/alttp/Options.py +++ b/worlds/alttp/Options.py @@ -42,6 +42,11 @@ class DungeonItem(Choice): def in_dungeon(self): return self.value in {0, 1} + @property + def hints_useful(self): + """Indicates if hints for this Item are useful in any way.""" + return self.value in {1, 2, 3, 4} + class bigkey_shuffle(DungeonItem): """Big Key Placement""" diff --git a/worlds/alttp/Rom.py b/worlds/alttp/Rom.py index e72e22cd..c66758dc 100644 --- a/worlds/alttp/Rom.py +++ b/worlds/alttp/Rom.py @@ -35,7 +35,7 @@ from worlds.alttp.Text import KingsReturn_texts, Sanctuary_texts, Kakariko_texts LostWoods_texts, WishingWell_texts, DesertPalace_texts, MountainTower_texts, LinksHouse_texts, Lumberjacks_texts, \ SickKid_texts, FluteBoy_texts, Zora_texts, MagicShop_texts, Sahasrahla_names from Utils import local_path, int16_as_bytes, int32_as_bytes, snes_to_pc, is_frozen -from worlds.alttp.Items import ItemFactory, item_table +from worlds.alttp.Items import ItemFactory, item_table, item_name_groups, progression_items from worlds.alttp.EntranceShuffle import door_addresses from worlds.alttp.Options import smallkey_shuffle import Patch @@ -2271,13 +2271,13 @@ def write_strings(rom, world, player): this_hint = location + ' contains ' + hint_text(world.get_location(location, player).item) + '.' tt[hint_locations.pop(0)] = this_hint - # Lastly we write hints to show where certain interesting items are. It is done the way it is to re-use the silver code and also to give one hint per each type of item regardless of how many exist. This supports many settings well. + # Lastly we write hints to show where certain interesting items are. items_to_hint = RelevantItems.copy() - if world.smallkey_shuffle[player]: - items_to_hint.extend(SmallKeys) - if world.bigkey_shuffle[player]: - items_to_hint.extend(BigKeys) - local_random.shuffle(items_to_hint) + if world.smallkey_shuffle[player].hints_useful: + items_to_hint |= item_name_groups["Small Keys"] + if world.bigkey_shuffle[player].hints_useful: + items_to_hint |= item_name_groups["Big Keys"] + if world.hints[player] == "full": hint_count = len(hint_locations) # fill all remaining hint locations with Item hints. else: @@ -2285,7 +2285,7 @@ def write_strings(rom, world, player): 'dungeonscrossed'] else 8 hint_count = min(hint_count, len(items_to_hint), len(hint_locations)) if hint_count: - locations = world.find_items_in_locations(set(items_to_hint), player) + locations = world.find_items_in_locations(items_to_hint, player) local_random.shuffle(locations) for x in range(min(hint_count, len(locations))): this_location = locations.pop() @@ -2873,88 +2873,10 @@ InconvenientLocations = ['Spike Cave', InconvenientVanillaLocations = ['Graveyard Cave', 'Mimic Cave'] -RelevantItems = ['Bow', - 'Progressive Bow', - 'Book of Mudora', - 'Hammer', - 'Hookshot', - 'Magic Mirror', - 'Flute', - 'Pegasus Boots', - 'Power Glove', - 'Cape', - 'Mushroom', - 'Shovel', - 'Lamp', - 'Magic Powder', - 'Moon Pearl', - 'Cane of Somaria', - 'Fire Rod', - 'Flippers', - 'Ice Rod', - 'Titans Mitts', - 'Ether', - 'Bombos', - 'Quake', - 'Bottle', - 'Bottle (Red Potion)', - 'Bottle (Green Potion)', - 'Bottle (Blue Potion)', - 'Bottle (Fairy)', - 'Bottle (Bee)', - 'Bottle (Good Bee)', - 'Master Sword', - 'Tempered Sword', - 'Fighter Sword', - 'Golden Sword', - 'Progressive Sword', - 'Progressive Glove', - 'Master Sword', - 'Power Star', - 'Triforce Piece', - 'Single Arrow', - 'Blue Mail', - 'Red Mail', - 'Progressive Mail', - 'Blue Boomerang', - 'Red Boomerang', - 'Blue Shield', - 'Red Shield', - 'Mirror Shield', - 'Progressive Shield', - 'Bug Catching Net', - 'Cane of Byrna', - 'Magic Upgrade (1/2)', - 'Magic Upgrade (1/4)' - ] -SmallKeys = ['Small Key (Eastern Palace)', - 'Small Key (Hyrule Castle)', - 'Small Key (Desert Palace)', - 'Small Key (Tower of Hera)', - 'Small Key (Agahnims Tower)', - 'Small Key (Palace of Darkness)', - 'Small Key (Thieves Town)', - 'Small Key (Swamp Palace)', - 'Small Key (Skull Woods)', - 'Small Key (Ice Palace)', - 'Small Key (Misery Mire)', - 'Small Key (Turtle Rock)', - 'Small Key (Ganons Tower)', - ] +RelevantItems = progression_items - {"Triforce", "Activated Flute"} - item_name_groups["Small Keys"] - item_name_groups["Big Keys"] \ + | item_name_groups["Mails"] | item_name_groups["Shields"] -BigKeys = ['Big Key (Eastern Palace)', - 'Big Key (Desert Palace)', - 'Big Key (Tower of Hera)', - 'Big Key (Palace of Darkness)', - 'Big Key (Thieves Town)', - 'Big Key (Swamp Palace)', - 'Big Key (Skull Woods)', - 'Big Key (Ice Palace)', - 'Big Key (Misery Mire)', - 'Big Key (Turtle Rock)', - 'Big Key (Ganons Tower)' - ] hash_alphabet = [ "Bow", "Boomerang", "Hookshot", "Bomb", "Mushroom", "Powder", "Rod", "Pendant", "Bombos", "Ether", "Quake",