Skip to content

Commit

Permalink
smallkey_shuffle > small_key_shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
Alchav committed Nov 6, 2023
1 parent 736a887 commit 3447c18
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions worlds/alttp/Dungeons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions worlds/alttp/ItemPool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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'])
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions worlds/alttp/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
20 changes: 10 additions & 10 deletions worlds/alttp/Rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand Down
14 changes: 7 additions & 7 deletions worlds/alttp/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -1157,15 +1157,15 @@ 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:
# Must not go in the Chain Chomps chest - only 2 other chests available and 3+ keys required for all other chests
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',
Expand Down
10 changes: 5 additions & 5 deletions worlds/alttp/Shops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -308,21 +308,21 @@ 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):
shop.locked = True
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)
Expand Down Expand Up @@ -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:
Expand Down
Loading

0 comments on commit 3447c18

Please sign in to comment.