personaforge/Archetypes.cs
Tony Bark 3690f96e42 Fixed conversion problem
- Zodiac option isn’t showing for some reason
2025-04-28 15:00:49 -04:00

92 lines
2.7 KiB
C#

namespace PersonaForge;
public class Archetypes
{
public string Name { get; set; }
public Dictionary<string, double> TraitBiases { get; set; } = new();
public static List<Archetypes> LoadFromJson(string file)
{
var opt = new JsonSerializerOptions()
{
PropertyNameCaseInsensitive = false
};
var json = File.ReadAllText(file);
var definitions = JsonSerializer.Deserialize<List<Archetypes>>(json, opt);
if (definitions is null)
throw new InvalidOperationException("Failed to deserialize Archetype JSON.");
return definitions;
}
public static List<Archetypes> DefaultArchetypes() => new()
{
new Archetypes
{
Name = "Grumpy",
TraitBiases = new Dictionary<string, double>
{
{ "Nice", 0.2 },
{ "Playful", 0.4 },
{ "Outgoing", 0.6 },
{ "Neat", 0.7 },
{ "Active", 0.5 }
}
},
new Archetypes
{
Name = "Party Animal",
TraitBiases = new Dictionary<string, double>
{
{ "Outgoing", 0.9 },
{ "Playful", 0.8 },
{ "Active", 0.7 },
{ "Nice", 0.5 },
{ "Neat", 0.3 }
}
},
new Archetypes
{
Name = "Lazy",
TraitBiases = new Dictionary<string, double>
{
{ "Nice", 0.8 },
{ "Playful", 0.6 },
{ "Outgoing", 0.4 },
{ "Neat", 0.2 },
{ "Active", 0.1 }
}
},
new Archetypes
{
Name = "Shy",
TraitBiases = new Dictionary<string, double>
{
{ "Nice", 0.9 },
{ "Playful", 0.7 },
{ "Outgoing", 0.3 },
{ "Neat", 0.5 },
{ "Active", 0.2 }
}
},
new Archetypes
{
Name = "Energetic",
TraitBiases = new Dictionary<string, double>
{
{ "Nice", 0.7 },
{ "Playful", 0.6 },
{ "Outgoing", 0.5 },
{ "Neat", 0.4 },
{ "Active", 0.3 }
}
},
new Archetypes
{
Name = "Random",
TraitBiases = new()
}
};
}