Skip to content
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

LTTP: Update to options API #4134

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
724667f
First pass of removing deprecated calls
nicholassaylor Nov 1, 2024
99f604f
Continue removing deprecated calls
nicholassaylor Nov 1, 2024
34bbc52
Revert accidental change to CollectionState
nicholassaylor Nov 1, 2024
6af81b9
Merge branch 'main' into alttp-slot-data-update
nicholassaylor Nov 1, 2024
444accc
Merge branch 'main' into alttp-slot-data-update
nicholassaylor Nov 2, 2024
3b8855d
Merge branch 'ArchipelagoMW:main' into alttp-slot-data-update
nicholassaylor Nov 3, 2024
89e5884
Use self in generate_early
nicholassaylor Nov 3, 2024
167343e
Update use_enemizer and stage_extend_hint_information
nicholassaylor Nov 3, 2024
167e378
Update write_spoiler
nicholassaylor Nov 3, 2024
eb3624a
Missed call in Inverted Tests
nicholassaylor Nov 3, 2024
7226625
Missed call in Shops.py
nicholassaylor Nov 3, 2024
574f343
Update StateHelpers.py
nicholassaylor Nov 3, 2024
e4013d6
Update Bosses.py
nicholassaylor Nov 3, 2024
ea2f4a7
Updated missing calls in Rules.py
nicholassaylor Nov 3, 2024
dd5eaf5
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Nov 11, 2024
bda82f8
Merge branch 'ArchipelagoMW:main' into alttp-deprecated-calls
nicholassaylor Nov 11, 2024
19e534d
Merge branch 'ArchipelagoMW:main' into alttp-deprecated-calls
nicholassaylor Nov 12, 2024
edc486a
Merge branch 'ArchipelagoMW:main' into alttp-deprecated-calls
nicholassaylor Nov 12, 2024
c86bd75
Port Rom.py and remove per_slot_randoms
nicholassaylor Nov 13, 2024
bb821c5
Make options a dataclass
nicholassaylor Nov 13, 2024
61a2357
Deep Dive part 1
nicholassaylor Nov 13, 2024
b25cde9
Deep Dive part 2
nicholassaylor Nov 13, 2024
e81c9d5
Deep Dive part 3
nicholassaylor Nov 13, 2024
c4b2c00
Deep Dive part 4
nicholassaylor Nov 13, 2024
9eaa8b2
Did I get everything?
nicholassaylor Nov 13, 2024
468d404
Final bug fixes?
nicholassaylor Nov 13, 2024
d6ad194
Of course EntranceShuffle.py had world: Multiworld still
nicholassaylor Nov 13, 2024
88cdaff
Maybe if I just made everything into one big commit, it wouldn't have…
nicholassaylor Nov 13, 2024
a7fb60f
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Nov 13, 2024
9aab4ba
Merge branch 'ArchipelagoMW:main' into alttp-deprecated-calls
nicholassaylor Nov 16, 2024
77290ad
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Nov 23, 2024
c928c32
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Nov 27, 2024
9d367c7
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Nov 29, 2024
cc3e268
Remove old options re-establisher
nicholassaylor Nov 29, 2024
29013fe
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Nov 29, 2024
8c29a91
Revert world -> multiworld in EntranceShuffle.py
nicholassaylor Nov 30, 2024
a3b8deb
Revert world -> multiworld in Items.py
nicholassaylor Nov 30, 2024
4cf6fa9
Revert world -> multiworld in Options.py
nicholassaylor Nov 30, 2024
90ae38b
Revert world -> multiworld in OverworldGlitchRules.py
nicholassaylor Nov 30, 2024
2fdef90
Revert world -> multiworld in Rom.py
nicholassaylor Nov 30, 2024
4d5c355
Revert world -> multiworld in UnderworldGlitchRules.py
nicholassaylor Nov 30, 2024
53f8d93
Revert world -> multiworld in ItemPool.py
nicholassaylor Nov 30, 2024
df1c25b
Revert world -> multiworld in Rom.py
nicholassaylor Nov 30, 2024
f29ffb8
Revert world -> multiworld in Rules.py
nicholassaylor Nov 30, 2024
6ebc0a3
This really annoying thing
nicholassaylor Nov 30, 2024
a4db817
These were actually right
nicholassaylor Nov 30, 2024
d886376
Finally get to __init__.py
nicholassaylor Nov 30, 2024
ff3a9ee
Refactor failures make me sad
nicholassaylor Nov 30, 2024
9aca4d9
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Nov 30, 2024
de95d98
Pesky rules
nicholassaylor Nov 30, 2024
1bc6663
Merge remote-tracking branch 'origin/alttp-deprecated-calls' into alt…
nicholassaylor Nov 30, 2024
262c938
Flashbacks trying to get this right the first time
nicholassaylor Nov 30, 2024
d7bb856
Merge branch 'ArchipelagoMW:main' into alttp-deprecated-calls
nicholassaylor Nov 30, 2024
7e609b0
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Dec 1, 2024
888dbc8
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Dec 3, 2024
94e07c7
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Dec 5, 2024
b4855bb
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Dec 16, 2024
f107c26
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Jan 1, 2025
f4839d7
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Jan 8, 2025
1835df0
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Jan 13, 2025
06a5b4c
Fix editing artifacts
nicholassaylor Jan 13, 2025
1478c77
Merge branch 'ArchipelagoMW:main' into alttp-deprecated-calls
nicholassaylor Jan 14, 2025
f43c00d
Code review
nicholassaylor Jan 14, 2025
3e9db22
Code Review 2
nicholassaylor Jan 14, 2025
bdb69c1
Code Review 3
nicholassaylor Jan 14, 2025
24c7fb2
Code Review 4
nicholassaylor Jan 14, 2025
3ee3cf0
Code Review 5
nicholassaylor Jan 14, 2025
258dc7d
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Jan 14, 2025
2d3bd3c
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Jan 17, 2025
46dcda9
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Jan 19, 2025
c80f169
Apply suggestions from code review
nicholassaylor Jan 20, 2025
0bc3145
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Jan 20, 2025
61faa44
Revert random format changes
nicholassaylor Jan 20, 2025
055b5ee
Merge branch 'main' into alttp-deprecated-calls
nicholassaylor Jan 23, 2025
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
13 changes: 6 additions & 7 deletions worlds/alttp/Bosses.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def KholdstareDefeatRule(state, player: int) -> bool:
state.has('Fire Rod', player) or
(
state.has('Bombos', player) and
(has_sword(state, player) or state.multiworld.swordless[player])
(has_sword(state, player) or state.multiworld.worlds[player].options.swordless)
)
) and
(
Expand All @@ -111,7 +111,7 @@ def KholdstareDefeatRule(state, player: int) -> bool:
(
state.has('Fire Rod', player) and
state.has('Bombos', player) and
state.multiworld.swordless[player] and
state.multiworld.worlds[player].options.swordless and
can_extend_magic(state, player, 16)
)
)
Expand All @@ -137,7 +137,7 @@ def AgahnimDefeatRule(state, player: int) -> bool:


def GanonDefeatRule(state, player: int) -> bool:
if state.multiworld.swordless[player]:
if state.multiworld.worlds[player].options.swordless:
return state.has('Hammer', player) and \
has_fire_source(state, player) and \
state.has('Silver Bow', player) and \
Expand All @@ -146,7 +146,7 @@ def GanonDefeatRule(state, player: int) -> bool:
can_hurt = has_beam_sword(state, player)
common = can_hurt and has_fire_source(state, player)
# silverless ganon may be needed in anything higher than no glitches
if state.multiworld.glitches_required[player] != 'no_glitches':
if state.multiworld.worlds[player].options.glitches_required != 'no_glitches':
# need to light torch a sufficient amount of times
return common and (state.has('Tempered Sword', player) or state.has('Golden Sword', player) or (
state.has('Silver Bow', player) and can_shoot_arrows(state, player)) or
Expand Down Expand Up @@ -248,7 +248,7 @@ def can_place_boss(boss: str, dungeon_name: str, level: Optional[str] = None) ->

def place_boss(world: "ALTTPWorld", boss: str, location: str, level: Optional[str]) -> None:
player = world.player
if location == 'Ganons Tower' and world.multiworld.mode[player] == 'inverted':
if location == 'Ganons Tower' and world.options.mode == 'inverted':
location = 'Inverted Ganons Tower'
logging.debug('Placing boss %s at %s', boss, location + (' (' + level + ')' if level else ''))
world.dungeons[location].bosses[level] = BossFactory(boss, player)
Expand All @@ -260,9 +260,8 @@ def format_boss_location(location_name: str, level: str) -> str:

def place_bosses(world: "ALTTPWorld") -> None:
multiworld = world.multiworld
player = world.player
# will either be an int or a lower case string with ';' between options
boss_shuffle: Union[str, int] = multiworld.boss_shuffle[player].value
boss_shuffle: Union[str, int] = world.options.boss_shuffle.value
already_placed_bosses: List[str] = []
remaining_locations: List[Tuple[str, str]] = []
# handle plando
Expand Down
4 changes: 2 additions & 2 deletions worlds/alttp/Dungeons.py
Original file line number Diff line number Diff line change
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.small_key_shuffle[player] == small_key_shuffle.option_universal else small_keys,
[] if multiworld.worlds[player].options.small_key_shuffle == small_key_shuffle.option_universal else small_keys,
dungeon_items, player)
for item in dungeon.all_items:
item.dungeon = dungeon
Expand Down Expand Up @@ -143,7 +143,7 @@ def make_dungeon(name, default_boss, dungeon_regions, big_key, small_keys, dunge
item_factory(['Small Key (Turtle Rock)'] * 6, world),
item_factory(['Map (Turtle Rock)', 'Compass (Turtle Rock)'], world))

if multiworld.mode[player] != 'inverted':
if multiworld.worlds[player].options.mode != 'inverted':
AT = make_dungeon('Agahnims Tower', 'Agahnim', ['Agahnims Tower', 'Agahnim 1'], None,
item_factory(['Small Key (Agahnims Tower)'] * 4, world), [])
GT = make_dungeon('Ganons Tower', 'Agahnim2',
Expand Down
100 changes: 50 additions & 50 deletions worlds/alttp/EntranceShuffle.py

Large diffs are not rendered by default.

170 changes: 85 additions & 85 deletions worlds/alttp/ItemPool.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions worlds/alttp/Items.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ def GetBeemizerItem(world, player: int, item):
return item

# first roll - replaceable item should be replaced, within beemizer_total_chance
if not world.beemizer_total_chance[player] or world.random.random() > (world.beemizer_total_chance[player] / 100):
if not world.worlds[player].options.beemizer_total_chance or world.random.random() > (world.worlds[player].options.beemizer_total_chance / 100):
return item

# second roll - bee replacement should be trap, within beemizer_trap_chance
if not world.beemizer_trap_chance[player] or world.random.random() > (world.beemizer_trap_chance[player] / 100):
if not world.worlds[player].options.beemizer_trap_chance or world.random.random() > (world.worlds[player].options.beemizer_trap_chance / 100):
return "Bee" if isinstance(item, str) else world.create_item("Bee", player)
else:
return "Bee Trap" if isinstance(item, str) else world.create_item("Bee Trap", player)
Expand Down
6 changes: 3 additions & 3 deletions worlds/alttp/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ class OpenPyramid(Choice):

def to_bool(self, world: MultiWorld, player: int) -> bool:
if self.value == self.option_goal:
return world.goal[player].current_key in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'}
return world.worlds[player].options.goal.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].current_key in {'vanilla', 'dungeons_simple', 'dungeons_full', 'dungeons_crossed'} or not
return world.worlds[player].options.goal.current_key in {'crystals', 'ganon_triforce_hunt', 'local_ganon_triforce_hunt', 'ganon_pedestal'} \
and (world.worlds[player].options.entrance_shuffle.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
20 changes: 10 additions & 10 deletions worlds/alttp/OverworldGlitchRules.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,14 @@ def get_invalid_bunny_revival_dungeons():

def overworld_glitch_connections(world, player):
# Boots-accessible locations.
create_owg_connections(player, world, get_boots_clip_exits_lw(world.mode[player] == 'inverted'))
create_owg_connections(player, world, get_boots_clip_exits_dw(world.mode[player] == 'inverted', player))
create_owg_connections(player, world, get_boots_clip_exits_lw(world.worlds[player].options.mode == 'inverted'))
create_owg_connections(player, world, get_boots_clip_exits_dw(world.worlds[player].options.mode == 'inverted', player))

# Glitched speed drops.
create_owg_connections(player, world, get_glitched_speed_drops_dw(world.mode[player] == 'inverted'))
create_owg_connections(player, world, get_glitched_speed_drops_dw(world.worlds[player].options.mode == 'inverted'))

# Mirror clip spots.
if world.mode[player] != 'inverted':
if world.worlds[player].options.mode != 'inverted':
create_owg_connections(player, world, get_mirror_clip_spots_dw())
create_owg_connections(player, world, get_mirror_offset_spots_dw())
else:
Expand All @@ -239,24 +239,24 @@ def overworld_glitch_connections(world, player):
def overworld_glitches_rules(world, player):

# Boots-accessible locations.
set_owg_connection_rules(player, world, get_boots_clip_exits_lw(world.mode[player] == 'inverted'), lambda state: can_boots_clip_lw(state, player))
set_owg_connection_rules(player, world, get_boots_clip_exits_dw(world.mode[player] == 'inverted', player), lambda state: can_boots_clip_dw(state, player))
set_owg_connection_rules(player, world, get_boots_clip_exits_lw(world.worlds[player].options.mode == 'inverted'), lambda state: can_boots_clip_lw(state, player))
set_owg_connection_rules(player, world, get_boots_clip_exits_dw(world.worlds[player].options.mode == 'inverted', player), lambda state: can_boots_clip_dw(state, player))

# Glitched speed drops.
set_owg_connection_rules(player, world, get_glitched_speed_drops_dw(world.mode[player] == 'inverted'), lambda state: can_get_glitched_speed_dw(state, player))
set_owg_connection_rules(player, world, get_glitched_speed_drops_dw(world.worlds[player].options.mode == 'inverted'), lambda state: can_get_glitched_speed_dw(state, player))
# Dark Death Mountain Ledge Clip Spot also accessible with mirror.
if world.mode[player] != 'inverted':
if world.worlds[player].options.mode != 'inverted':
add_alternate_rule(world.get_entrance('Dark Death Mountain Ledge Clip Spot', player), lambda state: state.has('Magic Mirror', player))

# Mirror clip spots.
if world.mode[player] != 'inverted':
if world.worlds[player].options.mode != 'inverted':
set_owg_connection_rules(player, world, get_mirror_clip_spots_dw(), lambda state: state.has('Magic Mirror', player))
set_owg_connection_rules(player, world, get_mirror_offset_spots_dw(), lambda state: state.has('Magic Mirror', player) and can_boots_clip_lw(state, player))
else:
set_owg_connection_rules(player, world, get_mirror_offset_spots_lw(player), lambda state: state.has('Magic Mirror', player) and can_boots_clip_dw(state, player))

# Regions that require the boots and some other stuff.
if world.mode[player] != 'inverted':
if world.worlds[player].options.mode != 'inverted':
world.get_entrance('Turtle Rock Teleporter', player).access_rule = lambda state: (can_boots_clip_lw(state, player) or can_lift_heavy_rocks(state, player)) and state.has('Hammer', player)
add_alternate_rule(world.get_entrance('Waterfall of Wishing', player), lambda state: state.has('Moon Pearl', player) or state.has('Pegasus Boots', player))
else:
Expand Down
Loading
Loading