Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 14 additions & 1 deletion worlds/sadx/ItemPool.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(self, emblem_count_progressive=0, emblem_count_non_progressive=0, f

def create_sadx_items(world: World, starter_setup: StarterSetup, options: SonicAdventureDXOptions):
item_names = get_item_names(options, starter_setup)

# Remove the items that are already in the starting inventory
for item in world.options.start_inventory:
for _ in range(world.options.start_inventory[item]):
Expand Down Expand Up @@ -70,6 +70,13 @@ def create_sadx_items(world: World, starter_setup: StarterSetup, options: SonicA

world.multiworld.push_precollected(world.create_item(get_playable_character_item(starter_setup.character)))

# Setups for random starting items
for character in starter_setup.additional_starting_characters_list:
world.multiworld.push_precollected(world.create_item(get_playable_character_item(character)))

for item in starter_setup.starting_key_items:
world.multiworld.push_precollected(world.create_item(item.name))

world.multiworld.itempool += itempool
return item_distribution

Expand Down Expand Up @@ -131,7 +138,13 @@ def get_item_names(options: SonicAdventureDXOptions, starter_setup: StarterSetup
]

item_names.remove(get_playable_character_item(starter_setup.character))

for character in starter_setup.additional_starting_characters_list:
item_names.remove(get_playable_character_item(character))

for item in starter_setup.starting_key_items:
item_names.remove(item.name)

return item_names


Expand Down
17 changes: 17 additions & 0 deletions worlds/sadx/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,19 @@ class GuaranteedStartingChecks(Range):
range_end = 10
default = 2

class AdditionalStartingCharacters(Range):
"""Adds extra characters to start inventory randomly based on set value."""
display_name = "Additional Starting Character(s)"
range_start = 1
range_end = 5
default = 0

class StartingOverworldKeyItems(Range):
"""Grants a number of items that allow extra overworld access at random."""
display_name = "Starting Overworld Key Items"
range_start = 1
range_end = 15
default = 0

class EntranceRandomizer(Toggle):
"""
Expand Down Expand Up @@ -775,6 +788,8 @@ class SonicAdventureDXOptions(PerGameCommonOptions):
starting_location: StartingLocationOption
random_starting_location_per_character: RandomStartingLocationPerCharacter
guaranteed_starting_checks: GuaranteedStartingChecks
additional_starting_characters: AdditionalStartingCharacters
starting_overworld_key_items: StartingOverworldKeyItems
entrance_randomizer: EntranceRandomizer
level_entrance_plando: LevelEntrancePlando

Expand Down Expand Up @@ -891,6 +906,8 @@ class SonicAdventureDXOptions(PerGameCommonOptions):
StartingLocationOption,
RandomStartingLocationPerCharacter,
GuaranteedStartingChecks,
AdditionalStartingCharacters,
StartingOverworldKeyItems,
EntranceRandomizer,
LevelEntrancePlando,
SendDeathLinkChance,
Expand Down
14 changes: 12 additions & 2 deletions worlds/sadx/StartingSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
field_emblem_location_table, boss_location_table, capsule_location_table, mission_location_table
from .Logic import area_connections, chao_egg_location_table, enemy_location_table, fish_location_table
from .Options import SonicAdventureDXOptions
from .Items import key_item_table


@dataclass
Expand All @@ -27,14 +28,14 @@ class StarterSetup:
area: Area = None
charactersWithArea: List[CharacterArea] = field(default_factory=list)
level_mapping: dict[Area, Area] = field(default_factory=dict)

additional_starting_characters_list: List[Character] = field(default_factory=list)
starting_key_items: List[str] = field(default_factory=list)
def get_starting_area(self, character: Character) -> Area:
for char_area in self.charactersWithArea:
if char_area.character == character:
return char_area.area
return self.area


def generate_early_sadx(world: World, options: SonicAdventureDXOptions) -> StarterSetup:
validate_settings(options)

Expand Down Expand Up @@ -96,6 +97,15 @@ def generate_early_sadx(world: World, options: SonicAdventureDXOptions) -> Start
used_areas.add(area)
starter_setup.charactersWithArea.append(CharacterArea(character, area))

for character_slot in range(0, options.additional_starting_characters.value):
if character_slot < len(possible_characters) - 1:
starter_setup.additional_starting_characters_list.append(possible_characters[character_slot+1])

if options.starting_overworld_key_items.value > len(key_item_table):
starter_setup.starting_key_items = world.random.sample(key_item_table, k=len(key_item_table))
else:
starter_setup.starting_key_items = world.random.sample(key_item_table, k=options.starting_overworld_key_items.value)

return starter_setup


Expand Down
3 changes: 2 additions & 1 deletion worlds/sadx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ def generate_early(self):
self.options.random_starting_location_per_character.value = passthrough[
"RandomStartingLocationPerCharacter"]
self.options.guaranteed_starting_checks.value = passthrough["GuaranteedStartingChecks"]

self.options.additional_starting_characters = passthrough["AdditionalStartingCharacters"]
self.options.starting_overworld_key_items = passthrough["StartingOverworldKeyItems"]
self.options.chao_egg_checks.value = passthrough["SecretChaoEggs"]
self.options.chao_races_checks.value = passthrough["ChaoRacesChecks"]
self.options.chao_races_levels_to_access_percentage.value = passthrough[
Expand Down