LADX: shuffle instruments (#2804)

* ladx: shuffle instruments

* set correct default for shuffled instruments
This commit is contained in:
panicbit 2024-03-10 14:48:00 +01:00 committed by GitHub
parent 5a4d88d554
commit 37add8ee59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 6 deletions

View File

@ -179,6 +179,22 @@ 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"
default = 100
option_vanilla = 100
alias_false = 100
class Goal(Choice, LADXROption):
"""
The Goal of the game
@ -465,6 +481,7 @@ links_awakening_options: typing.Dict[str, typing.Type[Option]] = {
'shuffle_compasses': ShuffleCompasses,
'shuffle_stone_beaks': ShuffleStoneBeaks,
'music': Music,
'shuffle_instruments': ShuffleInstruments,
'music_change_condition': MusicChangeCondition,
'nag_messages': NagMessages,
'ap_title_screen': APTitleScreen,

View File

@ -23,7 +23,7 @@ from .LADXR.settings import Settings as LADXRSettings
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
@ -184,7 +184,7 @@ class LinksAwakeningWorld(World):
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]
@ -224,7 +224,10 @@ class LinksAwakeningWorld(World):
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
@ -240,10 +243,8 @@ class LinksAwakeningWorld(World):
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)