mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-20 20:01:31 -06:00
Muse Dash: Adding Option to select Goal Song (#4820)
Co-authored-by: Justus Lind <DeamonHunter@users.noreply.github.com> Co-authored-by: Aaron Wagener <mmmcheese158@gmail.com>
This commit is contained in:
@@ -175,6 +175,13 @@ class ExcludeSongs(SongSet):
|
||||
"""
|
||||
display_name = "Exclude Songs"
|
||||
|
||||
class GoalSong(SongSet):
|
||||
"""
|
||||
One of the selected songs will be guaranteed to show up as the final Goal Song.
|
||||
- You must have the DLC enabled to play these songs.
|
||||
- If no songs are chosen, then the song will be randomly chosen from the available songs.
|
||||
"""
|
||||
display_name = "Goal Song"
|
||||
|
||||
md_option_groups = [
|
||||
OptionGroup("Song Choice", [
|
||||
@@ -182,6 +189,7 @@ md_option_groups = [
|
||||
StreamerModeEnabled,
|
||||
IncludeSongs,
|
||||
ExcludeSongs,
|
||||
GoalSong,
|
||||
]),
|
||||
OptionGroup("Difficulty", [
|
||||
GradeNeeded,
|
||||
@@ -214,6 +222,7 @@ class MuseDashOptions(PerGameCommonOptions):
|
||||
death_link: DeathLink
|
||||
include_songs: IncludeSongs
|
||||
exclude_songs: ExcludeSongs
|
||||
goal_song: GoalSong
|
||||
|
||||
# Removed
|
||||
allow_just_as_planned_dlc_songs: Removed
|
||||
|
@@ -119,12 +119,24 @@ class MuseDashWorld(World):
|
||||
start_items = self.options.start_inventory.value.keys()
|
||||
include_songs = self.options.include_songs.value
|
||||
exclude_songs = self.options.exclude_songs.value
|
||||
chosen_goal_songs = sorted(self.options.goal_song)
|
||||
|
||||
self.starting_songs = [s for s in start_items if s in song_items]
|
||||
self.starting_songs = self.md_collection.filter_songs_to_dlc(self.starting_songs, dlc_songs)
|
||||
self.included_songs = [s for s in include_songs if s in song_items and s not in self.starting_songs]
|
||||
self.included_songs = self.md_collection.filter_songs_to_dlc(self.included_songs, dlc_songs)
|
||||
|
||||
# Making sure songs chosen for goal are allowed by DLC and remove the chosen from being added to the pool.
|
||||
if chosen_goal_songs:
|
||||
chosen_goal_songs = self.md_collection.filter_songs_to_dlc(chosen_goal_songs, dlc_songs)
|
||||
if chosen_goal_songs:
|
||||
self.random.shuffle(chosen_goal_songs)
|
||||
self.victory_song_name = chosen_goal_songs.pop()
|
||||
if self.victory_song_name in self.starting_songs:
|
||||
self.starting_songs.remove(self.victory_song_name)
|
||||
if self.victory_song_name in self.included_songs:
|
||||
self.included_songs.remove(self.victory_song_name)
|
||||
|
||||
return [s for s in available_song_keys if s not in start_items
|
||||
and s not in include_songs and s not in exclude_songs]
|
||||
|
||||
@@ -139,12 +151,13 @@ class MuseDashWorld(World):
|
||||
if included_song_count > additional_song_count:
|
||||
# If so, we want to thin the list, thus let's get the goal song and starter songs while we are at it.
|
||||
self.random.shuffle(self.included_songs)
|
||||
self.victory_song_name = self.included_songs.pop()
|
||||
if not self.victory_song_name:
|
||||
self.victory_song_name = self.included_songs.pop()
|
||||
while len(self.included_songs) > additional_song_count:
|
||||
next_song = self.included_songs.pop()
|
||||
if len(self.starting_songs) < starting_song_count:
|
||||
self.starting_songs.append(next_song)
|
||||
else:
|
||||
elif not self.victory_song_name:
|
||||
# If not, choose a random victory song from the available songs
|
||||
chosen_song = self.random.randrange(0, len(available_song_keys) + included_song_count)
|
||||
if chosen_song < included_song_count:
|
||||
@@ -153,6 +166,8 @@ class MuseDashWorld(World):
|
||||
else:
|
||||
self.victory_song_name = available_song_keys[chosen_song - included_song_count]
|
||||
del available_song_keys[chosen_song - included_song_count]
|
||||
elif self.victory_song_name in available_song_keys:
|
||||
available_song_keys.remove(self.victory_song_name)
|
||||
|
||||
# Next, make sure the starting songs are fulfilled
|
||||
if len(self.starting_songs) < starting_song_count:
|
||||
|
Reference in New Issue
Block a user