fall back to first non-null settings file when applying difficulty settings

This commit is contained in:
Chomp 2021-08-17 15:41:35 +01:00
parent eb11ab2da5
commit 0494ccacef

View File

@ -30,6 +30,13 @@ namespace Generator.Helpers
{ {
var settings = difficultySettingsJsons.FirstOrDefault(x => x.Key.Contains(difficulty)); var settings = difficultySettingsJsons.FirstOrDefault(x => x.Key.Contains(difficulty));
// No difficulty settings found, find any settings file and use that
// This is required for many bot types that only have 'normal' difficulty settings
if (settings.Key == null)
{
settings = difficultySettingsJsons.FirstOrDefault(x => x.Key != null);
}
SaveSettingsIntoBotFile(bot, difficulty, settings.Value); SaveSettingsIntoBotFile(bot, difficulty, settings.Value);
} }
} }