Handle when a bot type is similar to another, e.g. cursedassault vs assault

This commit is contained in:
Chomp 2021-08-17 18:34:37 +01:00
parent 76a17e6d6a
commit 4dc11acf06

View File

@ -16,7 +16,7 @@ namespace Generator.Helpers
// Read bot setting files from assets folder that match this bots type // Read bot setting files from assets folder that match this bots type
// Save into dictionary with difficulty as key // Save into dictionary with difficulty as key
var difficultySettingsJsons = new Dictionary<string, DifficultySettings>(); var difficultySettingsJsons = new Dictionary<string, DifficultySettings>();
foreach (var path in difficultyFilePaths.Where(x=>x.Contains(bot.botType.ToString(), System.StringComparison.InvariantCultureIgnoreCase))) foreach (var path in difficultyFilePaths.Where(x=>x.Contains($"_{bot.botType.ToString()}", System.StringComparison.InvariantCultureIgnoreCase)))
{ {
var json = File.ReadAllText(path); var json = File.ReadAllText(path);
var serialisedObject = JsonConvert.DeserializeObject<DifficultySettings>(json); var serialisedObject = JsonConvert.DeserializeObject<DifficultySettings>(json);