Archipelago/worlds/musedash/test/TestDifficultyRanges.py

77 lines
3.3 KiB
Python
Raw Normal View History

Muse Dash: Add New Game (#1723) * Alpha 1 Muse dash stuff. * Add in an option to limit to only base game songs. * Make all items progression instead of progression_skip_balancing. * Add in extra_goal_song_items to help make runs less about completing every song. * Change ID range to be in a more open area, and add some comments. * Add in Streamer Mode and difficulty range options. Rearrange data files so its easier to get all data at once. * Fix generation issues. * Fix up the maximum and remove old option. * Remove empty items and the option to make filler songs empty. * Support emerald hunt mode. Make difficulties an option rather than 2 sliders. * Fix DLC Song option being inverted. * Fix item counting being broken if there was more than 1 world. * Make compatible with .apworld specification. * Make All item names ASCII compatible. * Add in the additional_item_percentage option. * Add a test to ensure the item names are within the normal ascii range. * Add in death link. * Remove the album from the item name. Not really needed anymore. * Add the 2 budget is burning albums under the free songs heading. Adds a couple more songs without dlc. * Sanitise Album names. * Added the grade needed choice. * Update songs to v3.1.0 * Adjust difficulty ranges. Add Expert and Master. * Fix setup_en.md being out of date. * Add a manual override. * Add testing for diff ranges. Fix bugs introduced there. Limit option to 11 to not generate an impossible seed. * Remove regions from Muse Dash. * Some Oops... * Attempt to make tests happy. * Remove supports weighting false to stop webhost test failing. * Adjusted settings * Adjust music sheets to use percentages. Various cleanups. * Fixes to new code. * Add Ola Dash Album. Add support for overriding song difficulty. Other stylisation changes. * Attempt fix tests. * Ooops missed one. * flake8 suggestions. * Remove FM 17314 SUGAR RADIO as that song is a bit weird. * Update document pages. * Add trap support * Lower additional song count by 10. * Tests broke on my end. Using github to test this. * Looks like I was accidentally adding ~. * Fix the one song that crashes OoT hint generation * Various documentation changes. * Website documents fixup. * Doc updates part 2. * Oops. Doc updates part 3. * Add Muse Dash to the apworld list. * Add trailing comma. * Add a couple plando options. * Set data_version to 1. * Add in some handling incase someone decides a song is both starter and included. * Remove brackets around ifs. * Oops. Accidentally removed a necessary bracket. * Fix filtering crash due to me mixing up c# and python .remove(). * Add Happy Otaku Pack Vol.17. Also increment data version. * Update links to melon loader to be the latest. * Clean up song selection code by shuffling once then popping. * Add UID to the Data text file, so the same file can be used client and server. * Increment Data Version because some names have changed. * Correct some names. * Update data to v3.4.0 (Addition of Muse Radio FM104) * Add support for SFX traps. Adjusted how traps were setup a bit. * Update the docs to include a troubleshooting section. * Small fixes. * Remove unnecessary brackets. * Add .net downloads to docs. * Avoid failing generation if strict difficulty settings are applied with no dlc songs and streamer mode. * Forgot to add the worst starting song count. * Make minimum song count be Starting Songs + 11 instead of Starting Songs * 2 + 1. * Fix up several issues where song count could mismatch the requested amount. * Add a test to ensure world size doesn't grow. * Fix some oversights. * Remove unnecessary brackets. * Fix up passing the tuple out when just the key would suffice. * Adjust typing based on Phar's suggestions. * Apply the rest of Phar's suggestions with minor tweaks to other parts to suit suggestions. * Adjust some more stuff to fit 120 characters. * Some more pep8 stuff and fix tests. * Some pep8 in tests.
2023-06-29 12:36:39 +00:00
from . import MuseDashTestBase
class DifficultyRanges(MuseDashTestBase):
def test_all_difficulty_ranges(self) -> None:
muse_dash_world = self.multiworld.worlds[1]
dlc_set = {x for x in muse_dash_world.md_collection.DLC}
Muse Dash: Add New Game (#1723) * Alpha 1 Muse dash stuff. * Add in an option to limit to only base game songs. * Make all items progression instead of progression_skip_balancing. * Add in extra_goal_song_items to help make runs less about completing every song. * Change ID range to be in a more open area, and add some comments. * Add in Streamer Mode and difficulty range options. Rearrange data files so its easier to get all data at once. * Fix generation issues. * Fix up the maximum and remove old option. * Remove empty items and the option to make filler songs empty. * Support emerald hunt mode. Make difficulties an option rather than 2 sliders. * Fix DLC Song option being inverted. * Fix item counting being broken if there was more than 1 world. * Make compatible with .apworld specification. * Make All item names ASCII compatible. * Add in the additional_item_percentage option. * Add a test to ensure the item names are within the normal ascii range. * Add in death link. * Remove the album from the item name. Not really needed anymore. * Add the 2 budget is burning albums under the free songs heading. Adds a couple more songs without dlc. * Sanitise Album names. * Added the grade needed choice. * Update songs to v3.1.0 * Adjust difficulty ranges. Add Expert and Master. * Fix setup_en.md being out of date. * Add a manual override. * Add testing for diff ranges. Fix bugs introduced there. Limit option to 11 to not generate an impossible seed. * Remove regions from Muse Dash. * Some Oops... * Attempt to make tests happy. * Remove supports weighting false to stop webhost test failing. * Adjusted settings * Adjust music sheets to use percentages. Various cleanups. * Fixes to new code. * Add Ola Dash Album. Add support for overriding song difficulty. Other stylisation changes. * Attempt fix tests. * Ooops missed one. * flake8 suggestions. * Remove FM 17314 SUGAR RADIO as that song is a bit weird. * Update document pages. * Add trap support * Lower additional song count by 10. * Tests broke on my end. Using github to test this. * Looks like I was accidentally adding ~. * Fix the one song that crashes OoT hint generation * Various documentation changes. * Website documents fixup. * Doc updates part 2. * Oops. Doc updates part 3. * Add Muse Dash to the apworld list. * Add trailing comma. * Add a couple plando options. * Set data_version to 1. * Add in some handling incase someone decides a song is both starter and included. * Remove brackets around ifs. * Oops. Accidentally removed a necessary bracket. * Fix filtering crash due to me mixing up c# and python .remove(). * Add Happy Otaku Pack Vol.17. Also increment data version. * Update links to melon loader to be the latest. * Clean up song selection code by shuffling once then popping. * Add UID to the Data text file, so the same file can be used client and server. * Increment Data Version because some names have changed. * Correct some names. * Update data to v3.4.0 (Addition of Muse Radio FM104) * Add support for SFX traps. Adjusted how traps were setup a bit. * Update the docs to include a troubleshooting section. * Small fixes. * Remove unnecessary brackets. * Add .net downloads to docs. * Avoid failing generation if strict difficulty settings are applied with no dlc songs and streamer mode. * Forgot to add the worst starting song count. * Make minimum song count be Starting Songs + 11 instead of Starting Songs * 2 + 1. * Fix up several issues where song count could mismatch the requested amount. * Add a test to ensure world size doesn't grow. * Fix some oversights. * Remove unnecessary brackets. * Fix up passing the tuple out when just the key would suffice. * Adjust typing based on Phar's suggestions. * Apply the rest of Phar's suggestions with minor tweaks to other parts to suit suggestions. * Adjust some more stuff to fit 120 characters. * Some more pep8 stuff and fix tests. * Some pep8 in tests.
2023-06-29 12:36:39 +00:00
difficulty_choice = self.multiworld.song_difficulty_mode[1]
difficulty_min = self.multiworld.song_difficulty_min[1]
difficulty_max = self.multiworld.song_difficulty_max[1]
def test_range(inputRange, lower, upper):
self.assertEqual(inputRange[0], lower)
self.assertEqual(inputRange[1], upper)
Muse Dash: Add New Game (#1723) * Alpha 1 Muse dash stuff. * Add in an option to limit to only base game songs. * Make all items progression instead of progression_skip_balancing. * Add in extra_goal_song_items to help make runs less about completing every song. * Change ID range to be in a more open area, and add some comments. * Add in Streamer Mode and difficulty range options. Rearrange data files so its easier to get all data at once. * Fix generation issues. * Fix up the maximum and remove old option. * Remove empty items and the option to make filler songs empty. * Support emerald hunt mode. Make difficulties an option rather than 2 sliders. * Fix DLC Song option being inverted. * Fix item counting being broken if there was more than 1 world. * Make compatible with .apworld specification. * Make All item names ASCII compatible. * Add in the additional_item_percentage option. * Add a test to ensure the item names are within the normal ascii range. * Add in death link. * Remove the album from the item name. Not really needed anymore. * Add the 2 budget is burning albums under the free songs heading. Adds a couple more songs without dlc. * Sanitise Album names. * Added the grade needed choice. * Update songs to v3.1.0 * Adjust difficulty ranges. Add Expert and Master. * Fix setup_en.md being out of date. * Add a manual override. * Add testing for diff ranges. Fix bugs introduced there. Limit option to 11 to not generate an impossible seed. * Remove regions from Muse Dash. * Some Oops... * Attempt to make tests happy. * Remove supports weighting false to stop webhost test failing. * Adjusted settings * Adjust music sheets to use percentages. Various cleanups. * Fixes to new code. * Add Ola Dash Album. Add support for overriding song difficulty. Other stylisation changes. * Attempt fix tests. * Ooops missed one. * flake8 suggestions. * Remove FM 17314 SUGAR RADIO as that song is a bit weird. * Update document pages. * Add trap support * Lower additional song count by 10. * Tests broke on my end. Using github to test this. * Looks like I was accidentally adding ~. * Fix the one song that crashes OoT hint generation * Various documentation changes. * Website documents fixup. * Doc updates part 2. * Oops. Doc updates part 3. * Add Muse Dash to the apworld list. * Add trailing comma. * Add a couple plando options. * Set data_version to 1. * Add in some handling incase someone decides a song is both starter and included. * Remove brackets around ifs. * Oops. Accidentally removed a necessary bracket. * Fix filtering crash due to me mixing up c# and python .remove(). * Add Happy Otaku Pack Vol.17. Also increment data version. * Update links to melon loader to be the latest. * Clean up song selection code by shuffling once then popping. * Add UID to the Data text file, so the same file can be used client and server. * Increment Data Version because some names have changed. * Correct some names. * Update data to v3.4.0 (Addition of Muse Radio FM104) * Add support for SFX traps. Adjusted how traps were setup a bit. * Update the docs to include a troubleshooting section. * Small fixes. * Remove unnecessary brackets. * Add .net downloads to docs. * Avoid failing generation if strict difficulty settings are applied with no dlc songs and streamer mode. * Forgot to add the worst starting song count. * Make minimum song count be Starting Songs + 11 instead of Starting Songs * 2 + 1. * Fix up several issues where song count could mismatch the requested amount. * Add a test to ensure world size doesn't grow. * Fix some oversights. * Remove unnecessary brackets. * Fix up passing the tuple out when just the key would suffice. * Adjust typing based on Phar's suggestions. * Apply the rest of Phar's suggestions with minor tweaks to other parts to suit suggestions. * Adjust some more stuff to fit 120 characters. * Some more pep8 stuff and fix tests. * Some pep8 in tests.
2023-06-29 12:36:39 +00:00
songs = muse_dash_world.md_collection.get_songs_with_settings(dlc_set, False, inputRange[0], inputRange[1])
Muse Dash: Add New Game (#1723) * Alpha 1 Muse dash stuff. * Add in an option to limit to only base game songs. * Make all items progression instead of progression_skip_balancing. * Add in extra_goal_song_items to help make runs less about completing every song. * Change ID range to be in a more open area, and add some comments. * Add in Streamer Mode and difficulty range options. Rearrange data files so its easier to get all data at once. * Fix generation issues. * Fix up the maximum and remove old option. * Remove empty items and the option to make filler songs empty. * Support emerald hunt mode. Make difficulties an option rather than 2 sliders. * Fix DLC Song option being inverted. * Fix item counting being broken if there was more than 1 world. * Make compatible with .apworld specification. * Make All item names ASCII compatible. * Add in the additional_item_percentage option. * Add a test to ensure the item names are within the normal ascii range. * Add in death link. * Remove the album from the item name. Not really needed anymore. * Add the 2 budget is burning albums under the free songs heading. Adds a couple more songs without dlc. * Sanitise Album names. * Added the grade needed choice. * Update songs to v3.1.0 * Adjust difficulty ranges. Add Expert and Master. * Fix setup_en.md being out of date. * Add a manual override. * Add testing for diff ranges. Fix bugs introduced there. Limit option to 11 to not generate an impossible seed. * Remove regions from Muse Dash. * Some Oops... * Attempt to make tests happy. * Remove supports weighting false to stop webhost test failing. * Adjusted settings * Adjust music sheets to use percentages. Various cleanups. * Fixes to new code. * Add Ola Dash Album. Add support for overriding song difficulty. Other stylisation changes. * Attempt fix tests. * Ooops missed one. * flake8 suggestions. * Remove FM 17314 SUGAR RADIO as that song is a bit weird. * Update document pages. * Add trap support * Lower additional song count by 10. * Tests broke on my end. Using github to test this. * Looks like I was accidentally adding ~. * Fix the one song that crashes OoT hint generation * Various documentation changes. * Website documents fixup. * Doc updates part 2. * Oops. Doc updates part 3. * Add Muse Dash to the apworld list. * Add trailing comma. * Add a couple plando options. * Set data_version to 1. * Add in some handling incase someone decides a song is both starter and included. * Remove brackets around ifs. * Oops. Accidentally removed a necessary bracket. * Fix filtering crash due to me mixing up c# and python .remove(). * Add Happy Otaku Pack Vol.17. Also increment data version. * Update links to melon loader to be the latest. * Clean up song selection code by shuffling once then popping. * Add UID to the Data text file, so the same file can be used client and server. * Increment Data Version because some names have changed. * Correct some names. * Update data to v3.4.0 (Addition of Muse Radio FM104) * Add support for SFX traps. Adjusted how traps were setup a bit. * Update the docs to include a troubleshooting section. * Small fixes. * Remove unnecessary brackets. * Add .net downloads to docs. * Avoid failing generation if strict difficulty settings are applied with no dlc songs and streamer mode. * Forgot to add the worst starting song count. * Make minimum song count be Starting Songs + 11 instead of Starting Songs * 2 + 1. * Fix up several issues where song count could mismatch the requested amount. * Add a test to ensure world size doesn't grow. * Fix some oversights. * Remove unnecessary brackets. * Fix up passing the tuple out when just the key would suffice. * Adjust typing based on Phar's suggestions. * Apply the rest of Phar's suggestions with minor tweaks to other parts to suit suggestions. * Adjust some more stuff to fit 120 characters. * Some more pep8 stuff and fix tests. * Some pep8 in tests.
2023-06-29 12:36:39 +00:00
for songKey in songs:
song = muse_dash_world.md_collection.song_items[songKey]
if (song.easy is not None and inputRange[0] <= song.easy <= inputRange[1]):
continue
if (song.hard is not None and inputRange[0] <= song.hard <= inputRange[1]):
continue
if (song.master is not None and inputRange[0] <= song.master <= inputRange[1]):
continue
self.fail(f"Invalid song '{songKey}' was given for range '{inputRange[0]} to {inputRange[1]}'")
Muse Dash: Add New Game (#1723) * Alpha 1 Muse dash stuff. * Add in an option to limit to only base game songs. * Make all items progression instead of progression_skip_balancing. * Add in extra_goal_song_items to help make runs less about completing every song. * Change ID range to be in a more open area, and add some comments. * Add in Streamer Mode and difficulty range options. Rearrange data files so its easier to get all data at once. * Fix generation issues. * Fix up the maximum and remove old option. * Remove empty items and the option to make filler songs empty. * Support emerald hunt mode. Make difficulties an option rather than 2 sliders. * Fix DLC Song option being inverted. * Fix item counting being broken if there was more than 1 world. * Make compatible with .apworld specification. * Make All item names ASCII compatible. * Add in the additional_item_percentage option. * Add a test to ensure the item names are within the normal ascii range. * Add in death link. * Remove the album from the item name. Not really needed anymore. * Add the 2 budget is burning albums under the free songs heading. Adds a couple more songs without dlc. * Sanitise Album names. * Added the grade needed choice. * Update songs to v3.1.0 * Adjust difficulty ranges. Add Expert and Master. * Fix setup_en.md being out of date. * Add a manual override. * Add testing for diff ranges. Fix bugs introduced there. Limit option to 11 to not generate an impossible seed. * Remove regions from Muse Dash. * Some Oops... * Attempt to make tests happy. * Remove supports weighting false to stop webhost test failing. * Adjusted settings * Adjust music sheets to use percentages. Various cleanups. * Fixes to new code. * Add Ola Dash Album. Add support for overriding song difficulty. Other stylisation changes. * Attempt fix tests. * Ooops missed one. * flake8 suggestions. * Remove FM 17314 SUGAR RADIO as that song is a bit weird. * Update document pages. * Add trap support * Lower additional song count by 10. * Tests broke on my end. Using github to test this. * Looks like I was accidentally adding ~. * Fix the one song that crashes OoT hint generation * Various documentation changes. * Website documents fixup. * Doc updates part 2. * Oops. Doc updates part 3. * Add Muse Dash to the apworld list. * Add trailing comma. * Add a couple plando options. * Set data_version to 1. * Add in some handling incase someone decides a song is both starter and included. * Remove brackets around ifs. * Oops. Accidentally removed a necessary bracket. * Fix filtering crash due to me mixing up c# and python .remove(). * Add Happy Otaku Pack Vol.17. Also increment data version. * Update links to melon loader to be the latest. * Clean up song selection code by shuffling once then popping. * Add UID to the Data text file, so the same file can be used client and server. * Increment Data Version because some names have changed. * Correct some names. * Update data to v3.4.0 (Addition of Muse Radio FM104) * Add support for SFX traps. Adjusted how traps were setup a bit. * Update the docs to include a troubleshooting section. * Small fixes. * Remove unnecessary brackets. * Add .net downloads to docs. * Avoid failing generation if strict difficulty settings are applied with no dlc songs and streamer mode. * Forgot to add the worst starting song count. * Make minimum song count be Starting Songs + 11 instead of Starting Songs * 2 + 1. * Fix up several issues where song count could mismatch the requested amount. * Add a test to ensure world size doesn't grow. * Fix some oversights. * Remove unnecessary brackets. * Fix up passing the tuple out when just the key would suffice. * Adjust typing based on Phar's suggestions. * Apply the rest of Phar's suggestions with minor tweaks to other parts to suit suggestions. * Adjust some more stuff to fit 120 characters. * Some more pep8 stuff and fix tests. * Some pep8 in tests.
2023-06-29 12:36:39 +00:00
#auto ranges
difficulty_choice.value = 0
test_range(muse_dash_world.get_difficulty_range(), 0, 12)
difficulty_choice.value = 1
test_range(muse_dash_world.get_difficulty_range(), 0, 3)
difficulty_choice.value = 2
test_range(muse_dash_world.get_difficulty_range(), 4, 5)
difficulty_choice.value = 3
test_range(muse_dash_world.get_difficulty_range(), 6, 7)
difficulty_choice.value = 4
test_range(muse_dash_world.get_difficulty_range(), 8, 9)
difficulty_choice.value = 5
test_range(muse_dash_world.get_difficulty_range(), 10, 12)
# Test the Manual ranges
difficulty_choice.value = 6
difficulty_min.value = 1
difficulty_max.value = 11
test_range(muse_dash_world.get_difficulty_range(), 1, 11)
difficulty_min.value = 1
difficulty_max.value = 1
test_range(muse_dash_world.get_difficulty_range(), 1, 1)
difficulty_min.value = 11
difficulty_max.value = 11
test_range(muse_dash_world.get_difficulty_range(), 11, 11)
difficulty_min.value = 4
difficulty_max.value = 6
test_range(muse_dash_world.get_difficulty_range(), 4, 6)
def test_songs_have_difficulty(self) -> None:
muse_dash_world = self.multiworld.worlds[1]
for song_name in muse_dash_world.md_collection.DIFF_OVERRIDES:
song = muse_dash_world.md_collection.song_items[song_name]
# umpopoff is a one time weird song. Its currently the only song in the game
# with non-standard difficulties and also doesn't have 3 or more difficulties.
if song_name == 'umpopoff':
self.assertTrue(song.easy is None and song.hard is not None and song.master is None,
f"Song '{song_name}' difficulty not set when it should be.")
else:
self.assertTrue(song.easy is not None and song.hard is not None and song.master is not None,
f"Song '{song_name}' difficulty not set when it should be.")