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

ladx: shuffle instruments #2804

Merged
merged 3 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
16 changes: 16 additions & 0 deletions worlds/ladx/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,21 @@ class ShuffleStoneBeaks(DungeonItemShuffle):
display_name = "Shuffle Stone Beaks"
ladxr_item = "STONE_BEAK"

class ShuffleInstruments(DungeonItemShuffle):
"""
Shuffle Instruments
[Original Dungeon] The item will be within its original dungeon
[Own Dungeons] The item will be within a dungeon in your world
[Own World] The item will be somewhere in your world
[Any World] The item could be anywhere
[Different World] The item will be somewhere in another world
[Vanilla] The item will be in its vanilla location in your world
"""
display_name = "Shuffle Instruments"
ladxr_item = "INSTRUMENT"
option_vanilla = 100
alias_false = 100

class Goal(Choice, LADXROption):
"""
The Goal of the game
Expand Down Expand Up @@ -465,6 +480,7 @@ class AdditionalWarpPoints(DefaultOffToggle):
'shuffle_compasses': ShuffleCompasses,
'shuffle_stone_beaks': ShuffleStoneBeaks,
'music': Music,
'shuffle_instruments': ShuffleInstruments,
'music_change_condition': MusicChangeCondition,
'nag_messages': NagMessages,
'ap_title_screen': APTitleScreen,
Expand Down
13 changes: 7 additions & 6 deletions worlds/ladx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .LADXR.worldSetup import WorldSetup as LADXRWorldSetup
from .Locations import (LinksAwakeningLocation, LinksAwakeningRegion,
create_regions_from_ladxr, get_locations_to_id)
from .Options import DungeonItemShuffle, links_awakening_options
from .Options import DungeonItemShuffle, links_awakening_options, ShuffleInstruments
from .Rom import LADXDeltaPatch

DEVELOPER_MODE = False
Expand Down Expand Up @@ -184,7 +184,7 @@ def create_items(self) -> None:
self.pre_fill_items = []
# For any and different world, set item rule instead

for option in ["maps", "compasses", "small_keys", "nightmare_keys", "stone_beaks"]:
for option in ["maps", "compasses", "small_keys", "nightmare_keys", "stone_beaks", "instruments"]:
option = "shuffle_" + option
option = self.player_options[option]

Expand Down Expand Up @@ -224,7 +224,10 @@ def create_items(self) -> None:
continue

if isinstance(item.item_data, DungeonItemData):
if item.item_data.dungeon_item_type == DungeonItemType.INSTRUMENT:
item_type = item.item_data.ladxr_id[:-1]
shuffle_type = dungeon_item_types[item_type]

if item.item_data.dungeon_item_type == DungeonItemType.INSTRUMENT and shuffle_type == ShuffleInstruments.option_vanilla:
# Find instrument, lock
# TODO: we should be able to pinpoint the region we want, save a lookup table please
found = False
Expand All @@ -240,10 +243,8 @@ def create_items(self) -> None:
found = True
break
if found:
break
break
else:
item_type = item.item_data.ladxr_id[:-1]
shuffle_type = dungeon_item_types[item_type]
if shuffle_type == DungeonItemShuffle.option_original_dungeon:
self.prefill_original_dungeon[item.item_data.dungeon_index - 1].append(item)
self.pre_fill_items.append(item)
Expand Down