From 3447c18feff228008b8cde9cc87d123c2006c6e0 Mon Sep 17 00:00:00 2001 From: Alchav <59858495+Alchav@users.noreply.github.com> Date: Mon, 6 Nov 2023 13:33:22 -0500 Subject: [PATCH] smallkey_shuffle > small_key_shuffle --- worlds/alttp/Dungeons.py | 4 ++-- worlds/alttp/ItemPool.py | 18 +++++++++--------- worlds/alttp/Options.py | 8 ++++---- worlds/alttp/Rom.py | 20 ++++++++++---------- worlds/alttp/Rules.py | 14 +++++++------- worlds/alttp/Shops.py | 10 +++++----- worlds/alttp/__init__.py | 22 +++++++++++----------- 7 files changed, 48 insertions(+), 48 deletions(-) diff --git a/worlds/alttp/Dungeons.py b/worlds/alttp/Dungeons.py index a68acf7288cf..9a050f43e34b 100644 --- a/worlds/alttp/Dungeons.py +++ b/worlds/alttp/Dungeons.py @@ -9,7 +9,7 @@ from .Bosses import BossFactory, Boss from .Items import ItemFactory from .Regions import lookup_boss_drops, key_drop_data -from .Options import smallkey_shuffle +from .Options import small_key_shuffle if typing.TYPE_CHECKING: from .SubClasses import ALttPLocation, ALttPItem @@ -66,7 +66,7 @@ def create_dungeons(world: "ALTTPWorld"): def make_dungeon(name, default_boss, dungeon_regions, big_key, small_keys, dungeon_items): dungeon = Dungeon(name, dungeon_regions, big_key, - [] if multiworld.smallkey_shuffle[player] == smallkey_shuffle.option_universal else small_keys, + [] if multiworld.small_key_shuffle[player] == small_key_shuffle.option_universal else small_keys, dungeon_items, player) for item in dungeon.all_items: item.dungeon = dungeon diff --git a/worlds/alttp/ItemPool.py b/worlds/alttp/ItemPool.py index 9708e6e8deae..29de8e7e6594 100644 --- a/worlds/alttp/ItemPool.py +++ b/worlds/alttp/ItemPool.py @@ -10,7 +10,7 @@ from .Dungeons import get_dungeon_item_pool_player from .EntranceShuffle import connect_entrance from .Items import ItemFactory, GetBeemizerItem, trap_replaceable, item_name_groups -from .Options import smallkey_shuffle, compass_shuffle, bigkey_shuffle, map_shuffle, LTTPBosses +from .Options import small_key_shuffle, compass_shuffle, big_key_shuffle, map_shuffle, LTTPBosses from .StateHelpers import has_triforce_pieces, has_melee_weapon from .Regions import key_drop_data @@ -312,7 +312,7 @@ def generate_itempool(world): itempool.extend(['Rupees (300)'] * 34) itempool.extend(['Bombs (10)'] * 5) itempool.extend(['Arrows (10)'] * 7) - if multiworld.smallkey_shuffle[player] == smallkey_shuffle.option_universal: + if multiworld.small_key_shuffle[player] == small_key_shuffle.option_universal: itempool.extend(itemdiff.universal_keys) for item in itempool: @@ -448,7 +448,7 @@ def generate_itempool(world): # key drop item removed because of ice_rod_hunt multiworld.itempool.append(ItemFactory(GetBeemizerItem(multiworld, player, 'Nothing'), player)) multiworld.push_precollected(drop_item) - elif "Small" in key_data[3] and multiworld.smallkey_shuffle[player] == smallkey_shuffle.option_universal: + elif "Small" in key_data[3] and multiworld.small_key_shuffle[player] == small_key_shuffle.option_universal: # key drop shuffle and universal keys are on. Add universal keys in place of key drop keys. multiworld.itempool.append(ItemFactory(GetBeemizerItem(multiworld, player, 'Small Key (Universal)'), player)) dungeon_item_replacements = sum(difficulties[multiworld.difficulty[player]].extras, []) * 2 @@ -460,8 +460,8 @@ def generate_itempool(world): else: for x in range(len(dungeon_items)-1, -1, -1): item = dungeon_items[x] - if ((multiworld.smallkey_shuffle[player] == smallkey_shuffle.option_start_with and item.type == 'SmallKey') - or (multiworld.bigkey_shuffle[player] == bigkey_shuffle.option_start_with and item.type == 'BigKey') + if ((multiworld.small_key_shuffle[player] == small_key_shuffle.option_start_with and item.type == 'SmallKey') + or (multiworld.big_key_shuffle[player] == big_key_shuffle.option_start_with and item.type == 'BigKey') or (multiworld.compass_shuffle[player] == compass_shuffle.option_start_with and item.type == 'Compass') or (multiworld.map_shuffle[player] == map_shuffle.option_start_with and item.type == 'Map')): dungeon_items.pop(x) @@ -474,7 +474,7 @@ def generate_itempool(world): if multiworld.shuffle_capacity_upgrades[player]: shop_items += 2 chance_100 = int(multiworld.retro_bow[player]) * 0.25 + int( - multiworld.smallkey_shuffle[player] == smallkey_shuffle.option_universal) * 0.5 + multiworld.small_key_shuffle[player] == small_key_shuffle.option_universal) * 0.5 for _ in range(shop_items): if multiworld.goal[player] != 'ice_rod_hunt': if multiworld.random.random() < chance_100: @@ -784,7 +784,7 @@ def place_item(loc, item): if retro_bow: replace = {'Single Arrow', 'Arrows (10)', 'Arrow Upgrade (+5)', 'Arrow Upgrade (+10)', 'Arrow Upgrade (50)'} pool = ['Rupees (5)' if item in replace else item for item in pool] - if world.smallkey_shuffle[player] == smallkey_shuffle.option_universal: + if world.small_key_shuffle[player] == small_key_shuffle.option_universal: pool.extend(diff.universal_keys) if mode == 'standard': if world.key_drop_shuffle[player] and world.goal[player] != 'ice_rod_hunt': @@ -933,7 +933,7 @@ def place_item(loc, item): itemtotal = itemtotal + 1 if mode == 'standard': - if world.smallkey_shuffle[player] == smallkey_shuffle.option_universal: + if world.small_key_shuffle[player] == small_key_shuffle.option_universal: key_location = world.random.choice( ['Secret Passage', 'Hyrule Castle - Boomerang Chest', 'Hyrule Castle - Map Chest', 'Hyrule Castle - Zelda\'s Chest', 'Sewers - Dark Cross']) @@ -956,7 +956,7 @@ def place_item(loc, item): pool.extend(['Magic Mirror'] * customitemarray[22]) pool.extend(['Moon Pearl'] * customitemarray[28]) - if world.smallkey_shuffle[player] == smallkey_shuffle.option_universal: + if world.small_key_shuffle[player] == small_key_shuffle.option_universal: itemtotal = itemtotal - 28 # Corrects for small keys not being in item pool in universal Mode if world.key_drop_shuffle[player]: itemtotal = itemtotal - (len(key_drop_data) - 1) diff --git a/worlds/alttp/Options.py b/worlds/alttp/Options.py index f2824446f638..990875e19437 100644 --- a/worlds/alttp/Options.py +++ b/worlds/alttp/Options.py @@ -175,13 +175,13 @@ def hints_useful(self): return self.value in {1, 2, 3, 4} -class bigkey_shuffle(DungeonItem): +class big_key_shuffle(DungeonItem): """Big Key Placement""" item_name_group = "Big Keys" display_name = "Big Key Shuffle" -class smallkey_shuffle(DungeonItem): +class small_key_shuffle(DungeonItem): """Small Key Placement""" option_universal = 5 item_name_group = "Small Keys" @@ -726,8 +726,8 @@ class AllowCollect(Toggle): "crystals_needed_for_gt": CrystalsTower, "crystals_needed_for_ganon": CrystalsGanon, "open_pyramid": OpenPyramid, - "bigkey_shuffle": bigkey_shuffle, - "smallkey_shuffle": smallkey_shuffle, + "big_key_shuffle": big_key_shuffle, + "small_key_shuffle": small_key_shuffle, "key_drop_shuffle": key_drop_shuffle, "compass_shuffle": compass_shuffle, "map_shuffle": map_shuffle, diff --git a/worlds/alttp/Rom.py b/worlds/alttp/Rom.py index b415511fdc1a..a17d0e7a81ce 100644 --- a/worlds/alttp/Rom.py +++ b/worlds/alttp/Rom.py @@ -36,7 +36,7 @@ SickKid_texts, FluteBoy_texts, Zora_texts, MagicShop_texts, Sahasrahla_names from .Items import ItemFactory, item_table, item_name_groups, progression_items from .EntranceShuffle import door_addresses -from .Options import smallkey_shuffle +from .Options import small_key_shuffle try: from maseya import z3pr @@ -1541,10 +1541,10 @@ def chunk(l, n): # block HC upstairs doors in rain state in standard mode rom.write_byte(0x18008A, 0x01 if world.mode[player] == "standard" and world.entrance_shuffle[player] != 'vanilla' else 0x00) - rom.write_byte(0x18016A, 0x10 | ((0x01 if world.smallkey_shuffle[player] else 0x00) + rom.write_byte(0x18016A, 0x10 | ((0x01 if world.small_key_shuffle[player] else 0x00) | (0x02 if world.compass_shuffle[player] else 0x00) | (0x04 if world.map_shuffle[player] else 0x00) - | (0x08 if world.bigkey_shuffle[ + | (0x08 if world.big_key_shuffle[ player] else 0x00))) # free roaming item text boxes rom.write_byte(0x18003B, 0x01 if world.map_shuffle[player] else 0x00) # maps showing crystals on overworld @@ -1566,9 +1566,9 @@ def chunk(l, n): # b - Big Key # a - Small Key # - rom.write_byte(0x180045, ((0x00 if (world.smallkey_shuffle[player] == smallkey_shuffle.option_original_dungeon or - world.smallkey_shuffle[player] == smallkey_shuffle.option_universal) else 0x01) - | (0x02 if world.bigkey_shuffle[player] else 0x00) + rom.write_byte(0x180045, ((0x00 if (world.small_key_shuffle[player] == small_key_shuffle.option_original_dungeon or + world.small_key_shuffle[player] == small_key_shuffle.option_universal) else 0x01) + | (0x02 if world.big_key_shuffle[player] else 0x00) | (0x04 if world.map_shuffle[player] else 0x00) | (0x08 if world.compass_shuffle[player] else 0x00))) # free roaming items in menu @@ -1600,8 +1600,8 @@ def get_reveal_bytes(itemName): rom.write_int16(0x18017C, get_reveal_bytes('Crystal 5') | get_reveal_bytes('Crystal 6') if world.map_shuffle[ player] else 0x0000) # Bomb Shop Reveal - rom.write_byte(0x180172, 0x01 if world.smallkey_shuffle[ - player] == smallkey_shuffle.option_universal else 0x00) # universal keys + rom.write_byte(0x180172, 0x01 if world.small_key_shuffle[ + player] == small_key_shuffle.option_universal else 0x00) # universal keys rom.write_byte(0x18637E, 0x01 if world.retro_bow[player] else 0x00) # Skip quiver in item shops once bought rom.write_byte(0x180175, 0x01 if world.retro_bow[player] else 0x00) # rupee bow rom.write_byte(0x180176, 0x0A if world.retro_bow[player] else 0x00) # wood arrow cost @@ -2386,9 +2386,9 @@ def hint_text(dest, ped_hint=False): # Lastly we write hints to show where certain interesting items are. items_to_hint = RelevantItems.copy() - if world.smallkey_shuffle[player].hints_useful: + if world.small_key_shuffle[player].hints_useful: items_to_hint |= item_name_groups["Small Keys"] - if world.bigkey_shuffle[player].hints_useful: + if world.big_key_shuffle[player].hints_useful: items_to_hint |= item_name_groups["Big Keys"] if world.hints[player] == "full": diff --git a/worlds/alttp/Rules.py b/worlds/alttp/Rules.py index 584566142996..0432e8fdcecb 100644 --- a/worlds/alttp/Rules.py +++ b/worlds/alttp/Rules.py @@ -9,7 +9,7 @@ from . import OverworldGlitchRules from .Bosses import GanonDefeatRule from .Items import ItemFactory, item_name_groups, item_table, progression_items -from .Options import smallkey_shuffle +from .Options import small_key_shuffle from .OverworldGlitchRules import no_logic_rules, overworld_glitches_rules from .Regions import LTTPRegionType, location_table from .StateHelpers import (can_extend_magic, can_kill_most_things, @@ -286,7 +286,7 @@ def global_rules(world, player): set_rule(world.get_entrance('Sewers Door', player), lambda state: state._lttp_has_key('Small Key (Hyrule Castle)', player, 4) or ( - world.smallkey_shuffle[player] == smallkey_shuffle.option_universal and world.mode[ + world.small_key_shuffle[player] == small_key_shuffle.option_universal and world.mode[ player] == 'standard')) # standard universal small keys cannot access the shop set_rule(world.get_entrance('Sewers Back Door', player), lambda state: state._lttp_has_key('Small Key (Hyrule Castle)', player, 4)) @@ -341,7 +341,7 @@ def global_rules(world, player): add_rule(world.get_location('Desert Palace - Boss', player), lambda state: state._lttp_has_key('Small Key (Desert Palace)', player, 4) and state.has('Big Key (Desert Palace)', player) and has_fire_source(state, player) and state.multiworld.get_location('Desert Palace - Boss', player).parent_region.dungeon.boss.can_defeat(state)) # logic patch to prevent placing a crystal in Desert that's required to reach the required keys - if not (world.smallkey_shuffle[player] and world.bigkey_shuffle[player]): + if not (world.small_key_shuffle[player] and world.big_key_shuffle[player]): add_rule(world.get_location('Desert Palace - Prize', player), lambda state: state.multiworld.get_region('Desert Palace Main (Outer)', player).can_reach(state)) set_rule(world.get_entrance('Tower of Hera Small Key Door', player), lambda state: state._lttp_has_key('Small Key (Tower of Hera)', player) or location_item_name(state, 'Tower of Hera - Big Key Chest', player) == ('Small Key (Tower of Hera)', player)) @@ -374,7 +374,7 @@ def global_rules(world, player): if world.accessibility[player] != 'locations': allow_self_locking_items(world.get_location('Swamp Palace - Big Chest', player), 'Big Key (Swamp Palace)') set_rule(world.get_entrance('Swamp Palace (North)', player), lambda state: state.has('Hookshot', player) and state._lttp_has_key('Small Key (Swamp Palace)', player, 5)) - if not world.smallkey_shuffle[player] and world.glitches_required[player] not in ['hybrid_major_glitches', 'no_logic']: + if not world.small_key_shuffle[player] and world.glitches_required[player] not in ['hybrid_major_glitches', 'no_logic']: forbid_item(world.get_location('Swamp Palace - Entrance', player), 'Big Key (Swamp Palace)', player) add_rule(world.get_location('Swamp Palace - Prize', player), lambda state: state._lttp_has_key('Small Key (Swamp Palace)', player, 6)) add_rule(world.get_location('Swamp Palace - Boss', player), lambda state: state._lttp_has_key('Small Key (Swamp Palace)', player, 6)) @@ -1052,7 +1052,7 @@ def standard_rules(world, player): set_rule(world.get_entrance('Links House S&Q', player), lambda state: state.can_reach('Sanctuary', 'Region', player)) set_rule(world.get_entrance('Sanctuary S&Q', player), lambda state: state.can_reach('Sanctuary', 'Region', player)) - if world.smallkey_shuffle[player] != smallkey_shuffle.option_universal: + if world.small_key_shuffle[player] != small_key_shuffle.option_universal: set_rule(world.get_location('Hyrule Castle - Boomerang Guard Key Drop', player), lambda state: state._lttp_has_key('Small Key (Hyrule Castle)', player, 1)) set_rule(world.get_location('Hyrule Castle - Boomerang Chest', player), @@ -1157,7 +1157,7 @@ def tr_big_key_chest_keys_needed(state): return 6 # If TR is only accessible from the middle, the big key must be further restricted to prevent softlock potential - if not can_reach_front and not world.smallkey_shuffle[player]: + if not can_reach_front and not world.small_key_shuffle[player]: # Must not go in the Big Key Chest - only 1 other chest available and 2+ keys required for all other chests forbid_item(world.get_location('Turtle Rock - Big Key Chest', player), 'Big Key (Turtle Rock)', player) if not can_reach_big_chest: @@ -1165,7 +1165,7 @@ def tr_big_key_chest_keys_needed(state): forbid_item(world.get_location('Turtle Rock - Chain Chomps', player), 'Big Key (Turtle Rock)', player) forbid_item(world.get_location('Turtle Rock - Pokey 2 Key Drop', player), 'Big Key (Turtle Rock)', player) if world.accessibility[player] == 'locations' and world.goal[player] != 'ice_rod_hunt': - if world.bigkey_shuffle[player] and can_reach_big_chest: + if world.big_key_shuffle[player] and can_reach_big_chest: # Must not go in the dungeon - all 3 available chests (Chomps, Big Chest, Crystaroller) must be keys to access laser bridge, and the big key is required first for location in ['Turtle Rock - Chain Chomps', 'Turtle Rock - Compass Chest', 'Turtle Rock - Pokey 1 Key Drop', 'Turtle Rock - Pokey 2 Key Drop', diff --git a/worlds/alttp/Shops.py b/worlds/alttp/Shops.py index 5313c3c83628..3cab693d3f5a 100644 --- a/worlds/alttp/Shops.py +++ b/worlds/alttp/Shops.py @@ -11,7 +11,7 @@ from .SubClasses import ALttPLocation from .EntranceShuffle import door_addresses from .Items import item_name_groups -from .Options import smallkey_shuffle, RandomizeShopInventories +from .Options import small_key_shuffle, RandomizeShopInventories from .StateHelpers import has_hearts, can_use_bombs, can_hold_arrows logger = logging.getLogger("Shops") @@ -308,13 +308,13 @@ def set_up_shops(world, player: int): replacement_items = [['Red Potion', 150], ['Green Potion', 75], ['Blue Potion', 200], ['Bombs (10)', 50], ['Blue Shield', 50], ['Small Heart', 10]] # Can't just replace the single arrow with 10 arrows as retro doesn't need them. - if world.smallkey_shuffle[player] == smallkey_shuffle.option_universal: + if world.small_key_shuffle[player] == small_key_shuffle.option_universal: replacement_items.append(['Small Key (Universal)', 100]) replacement_item = world.random.choice(replacement_items) rss.add_inventory(2, 'Single Arrow', 80, 1, replacement_item[0], replacement_item[1]) rss.locked = True - if world.smallkey_shuffle[player] == smallkey_shuffle.option_universal or world.retro_bow[player]: + if world.small_key_shuffle[player] == small_key_shuffle.option_universal or world.retro_bow[player]: for shop in world.random.sample([s for s in world.shops if s.custom and not s.locked and s.type == ShopType.Shop and s.region.player == player], 5): @@ -322,7 +322,7 @@ def set_up_shops(world, player: int): slots = [0, 1, 2] world.random.shuffle(slots) slots = iter(slots) - if world.smallkey_shuffle[player] == smallkey_shuffle.option_universal: + if world.small_key_shuffle[player] == small_key_shuffle.option_universal: shop.add_inventory(next(slots), 'Small Key (Universal)', 100) if world.retro_bow[player]: shop.push_inventory(next(slots), 'Single Arrow', 80) @@ -440,7 +440,7 @@ def get_price(multiworld, item, player: int, price_type=None): ShopPriceType.Bombs, ShopPriceType.Magic, ] - if multiworld.smallkey_shuffle[player] == smallkey_shuffle.option_universal: + if multiworld.small_key_shuffle[player] == small_key_shuffle.option_universal: if item and item["item"] == "Small Key (Universal)": price_types = [ShopPriceType.Rupees, ShopPriceType.Magic] # no logical requirements for repeatable keys else: diff --git a/worlds/alttp/__init__.py b/worlds/alttp/__init__.py index 60aff48a52e2..f6788dffdc6d 100644 --- a/worlds/alttp/__init__.py +++ b/worlds/alttp/__init__.py @@ -13,7 +13,7 @@ from .InvertedRegions import create_inverted_regions, mark_dark_world_regions from .ItemPool import generate_itempool, difficulties from .Items import item_init_table, item_name_groups, item_table, GetBeemizerItem -from .Options import alttp_options, smallkey_shuffle +from .Options import alttp_options, small_key_shuffle from .Regions import lookup_name_to_id, create_regions, mark_light_world_regions, lookup_vanilla_location_to_entrance, \ is_main_entrance, key_drop_data from .Client import ALTTPSNIClient @@ -276,10 +276,10 @@ def generate_early(self): world = self.multiworld if world.mode[player] == 'standard' \ - and world.smallkey_shuffle[player] \ - and world.smallkey_shuffle[player] != smallkey_shuffle.option_universal \ - and world.smallkey_shuffle[player] != smallkey_shuffle.option_own_dungeons \ - and world.smallkey_shuffle[player] != smallkey_shuffle.option_start_with: + and world.small_key_shuffle[player] \ + and world.small_key_shuffle[player] != small_key_shuffle.option_universal \ + and world.small_key_shuffle[player] != small_key_shuffle.option_own_dungeons \ + and world.small_key_shuffle[player] != small_key_shuffle.option_start_with: self.multiworld.local_early_items[self.player]["Small Key (Hyrule Castle)"] = 1 # system for sharing ER layouts @@ -298,7 +298,7 @@ def generate_early(self): elif world.entrance_shuffle[player] == "vanilla": self.er_seed = "vanilla" - for dungeon_item in ["smallkey_shuffle", "bigkey_shuffle", "compass_shuffle", "map_shuffle"]: + for dungeon_item in ["small_key_shuffle", "big_key_shuffle", "compass_shuffle", "map_shuffle"]: option = getattr(world, dungeon_item)[player] if option == "own_world": world.local_items[player].value |= self.item_name_groups[option.item_name_group] @@ -482,9 +482,9 @@ def pre_fill(self): break else: raise FillError('Unable to place dungeon prizes') - if world.mode[player] == 'standard' and world.smallkey_shuffle[player] \ - and world.smallkey_shuffle[player] != smallkey_shuffle.option_universal and \ - world.smallkey_shuffle[player] != smallkey_shuffle.option_own_dungeons: + if world.mode[player] == 'standard' and world.small_key_shuffle[player] \ + and world.small_key_shuffle[player] != small_key_shuffle.option_universal and \ + world.small_key_shuffle[player] != small_key_shuffle.option_own_dungeons: world.local_early_items[player]["Small Key (Hyrule Castle)"] = 1 @classmethod @@ -767,7 +767,7 @@ def fill_slot_data(self): # for convenient auto-tracking of the generated settings and adjusting the tracker accordingly slot_options = ["crystals_needed_for_gt", "crystals_needed_for_ganon", "open_pyramid", - "bigkey_shuffle", "smallkey_shuffle", "compass_shuffle", "map_shuffle", + "big_key_shuffle", "small_key_shuffle", "compass_shuffle", "map_shuffle", "progressive", "swordless", "retro_bow", "retro_caves", "shop_item_slots", "boss_shuffle", "pot_shuffle", "enemy_shuffle", "key_drop_shuffle", "bombless_start", "randomize_shop_inventories", "shuffle_shop_inventories", "shuffle_capacity_upgrades", @@ -796,6 +796,6 @@ class ALttPLogic(LogicMixin): def _lttp_has_key(self, item, player, count: int = 1): if self.multiworld.glitches_required[player] == 'no_logic': return True - if self.multiworld.smallkey_shuffle[player] == smallkey_shuffle.option_universal: + if self.multiworld.small_key_shuffle[player] == small_key_shuffle.option_universal: return can_buy_unlimited(self, 'Small Key (Universal)', player) return self.prog_items[player][item] >= count