Updated to store experience/aggressor bonus/exp reward in dictionaries keyed by bot difficulty

This commit is contained in:
Dev 2024-11-14 11:52:11 +00:00
parent 8c0db8e0c2
commit 5083c7c5c3
2 changed files with 27 additions and 7 deletions

View File

@ -70,16 +70,16 @@ public class Experience
public Experience()
{
level = new MinMax(0, 1);
reward = new MinMax(-1, -1);
reward = new Dictionary<string, MinMax>();
standingForKill = new Dictionary<string, object>();
aggressorBonus = null;
aggressorBonus = new Dictionary<string, object>(); ;
useSimpleAnimator = false;
}
public MinMax level { get; set; }
public MinMax reward { get; set; }
public Dictionary<string, MinMax> reward { get; set; }
public Dictionary<string, object> standingForKill { get; set; }
public object aggressorBonus { get; set; }
public new Dictionary<string, object> aggressorBonus { get; set; }
public bool useSimpleAnimator { get; set; }
}

View File

@ -14,6 +14,7 @@ namespace Generator
UpdateBodyPartHealth(botData, rawBotData);
AddExperience(botData, rawBotData);
AddStandingForKill(botData, rawBotData);
AddAggressorBonus(botData, rawBotData);
AddSkills(botData, rawBotData);
botData.experience.useSimpleAnimator = rawBotData.Info.Settings.UseSimpleAnimator;
@ -47,14 +48,33 @@ namespace Generator
{
botToUpdate.experience.standingForKill.Add(rawBotData.Info.Settings.BotDifficulty, rawBotData.Info.Settings.StandingForKill);
}
}
botToUpdate.experience.aggressorBonus ??= rawBotData.Info.Settings.AggressorBonus;
private static void AddAggressorBonus(Bot botToUpdate, Datum rawBotData)
{
botToUpdate.experience.aggressorBonus ??= new Dictionary<string, object>();
if (!botToUpdate.experience.aggressorBonus.ContainsKey(rawBotData.Info.Settings.BotDifficulty))
{
botToUpdate.experience.aggressorBonus.Add(rawBotData.Info.Settings.BotDifficulty, rawBotData.Info.Settings.AggressorBonus);
}
}
private static void AddExperience(Bot botToUpdate, Datum rawBotData)
{
botToUpdate.experience.reward.min = rawBotData.Info.Settings.Experience;
botToUpdate.experience.reward.max = rawBotData.Info.Settings.Experience;
botToUpdate.experience.reward ??= new();
botToUpdate.experience.reward.TryGetValue(rawBotData.Info.Settings.BotDifficulty, out var minMaxValues);
if (minMaxValues is null)
{
botToUpdate.experience.reward.Add(rawBotData.Info.Settings.BotDifficulty, new(rawBotData.Info.Settings.Experience, rawBotData.Info.Settings.Experience));
return;
}
minMaxValues.min = Math.Min(minMaxValues.min, rawBotData.Info.Settings.Experience);
minMaxValues.max = Math.Max(minMaxValues.max, rawBotData.Info.Settings.Experience);
}
private static void AddVoice(Bot bot, Datum rawBot)