Introduced PersonaProfile

- PersonaProfile is for the exported JSON file
- Renamed a few classes
This commit is contained in:
Tony Bark 2025-04-28 09:00:12 -04:00
parent 63f4de6ffd
commit 1666dd55cd
6 changed files with 56 additions and 34 deletions

2
.gitignore vendored
View file

@ -544,3 +544,5 @@ FodyWeavers.xsd
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
.idea/** .idea/**
profiles/**
export/**

15
PersonaProfile.cs Normal file
View file

@ -0,0 +1,15 @@
namespace PersonaForge;
public class PersonaProfile
{
public string Name { get; set; } = string.Empty;
// Fandom Wiki calls them "Qualities," but I use the term "Traits" internally
public PersonalityTraits Qualities { get; set; } = new();
public static string ToJson(PersonalityTraits qualities, string name) => JsonSerializer.Serialize(
new PersonaProfile { Name = name, Qualities = qualities },
new JsonSerializerOptions { WriteIndented = true }
);
}

View file

@ -6,9 +6,9 @@ public static class PersonalityGen
const int TotalBudget = 25; const int TotalBudget = 25;
static readonly Random rng = new(); static readonly Random rng = new();
public static PersonalityProfile GenerateRandom() public static PersonalityTraits GenerateRandom()
{ {
var profile = PersonalityProfile.Create(); var profile = PersonalityTraits.Create();
var traits = new List<string> { "Outgoing", "Nice", "Playful", "Neat", "Active" }; var traits = new List<string> { "Outgoing", "Nice", "Playful", "Neat", "Active" };
var remaining = TotalBudget; var remaining = TotalBudget;
@ -28,7 +28,7 @@ public static class PersonalityGen
return profile; return profile;
} }
static int GetCurrentTraitPoints(PersonalityProfile p, string trait) => trait switch static int GetCurrentTraitPoints(PersonalityTraits p, string trait) => trait switch
{ {
"Outgoing" => p.Outgoing, "Outgoing" => p.Outgoing,
"Nice" => p.Nice, "Nice" => p.Nice,
@ -38,7 +38,7 @@ public static class PersonalityGen
_ => 0 _ => 0
}; };
static void SetTraitPoints(PersonalityProfile p, string trait, int points) static void SetTraitPoints(PersonalityTraits p, string trait, int points)
{ {
switch (trait) switch (trait)
{ {

View file

@ -1,6 +1,6 @@
namespace PersonaForge; namespace PersonaForge;
public class PersonalityProfile public class PersonalityTraits
{ {
public int Outgoing { get; set; } public int Outgoing { get; set; }
public int Nice { get; set; } public int Nice { get; set; }
@ -8,9 +8,7 @@ public class PersonalityProfile
public int Neat { get; set; } public int Neat { get; set; }
public int Active { get; set; } public int Active { get; set; }
public static PersonalityProfile Create() => new(); public static PersonalityTraits Create() => new();
public int TotalPoints() => Outgoing + Nice + Playful + Neat + Active; public int TotalPoints() => Outgoing + Nice + Playful + Neat + Active;
public string ToJson() => JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true });
} }

View file

@ -3,5 +3,6 @@
using PersonaForge; using PersonaForge;
var profile = PersonalityGen.GenerateRandom(); var traits = PersonalityGen.GenerateRandom();
Console.WriteLine(profile.ToJson()); var profile = PersonaProfile.ToJson(traits, "John Doe");
Console.WriteLine(profile);

View file

@ -3,6 +3,7 @@
PersonaForge is a lightweight personality generator for The Sims 2. It balances randomness with user choice without complexity. PersonaForge is a lightweight personality generator for The Sims 2. It balances randomness with user choice without complexity.
It helps if you want to: It helps if you want to:
- Have a specific Sim but arent sure how to fairly distribute leftover points. - Have a specific Sim but arent sure how to fairly distribute leftover points.
- Need a fast and balanced Sims that still has a natural personality without min-maxing - Need a fast and balanced Sims that still has a natural personality without min-maxing
- Are just tired of flying blind - Are just tired of flying blind
@ -14,11 +15,12 @@ With Sims 3 and later, creating personalities is as simple as selecting a trait.
## 🛣️ Project Roadmap ## 🛣️ Project Roadmap
| Phase | Goal | Status | | Phase | Goal | Status |
| --- | --- | --- | | ----- | ------------------------------------------- | ------ |
| v0.1 | Core random point generator (working) | ✅ | | v0.1 | Core random point generator (working) | ✅ |
| v0.2 | PersonalityProfile class + JSON export | ✅ | | v0.2 | PersonalityProfile class | ✅ |
| v0.3 | Archetypes with weighted biases | 🔜 | | v0.3 | JSON export | ✅ |
| v0.4 | Profile import/load from JSON | 🔜 | | v0.4 | Archetypes with weighted biases | 🔜 |
| v0.5 | Profile import/load from JSON | 🔜 |
| v1.0 | Stable "Release" version with documentation | 🔜 | | v1.0 | Stable "Release" version with documentation | 🔜 |
## 🧩 Tech Stack ## 🧩 Tech Stack
@ -29,6 +31,7 @@ With Sims 3 and later, creating personalities is as simple as selecting a trait.
- Pure backend logic (no UI planned) - Pure backend logic (no UI planned)
## 📐 Design Principles ## 📐 Design Principles
- Simple with no bloat or feature creep - Simple with no bloat or feature creep
- Stay true to The Sims 2 - Stay true to The Sims 2
- Respect randomness - Respect randomness
@ -39,11 +42,14 @@ With Sims 3 and later, creating personalities is as simple as selecting a trait.
```json ```json
{ {
"Outgoing": 7, "Name": "Max Casey",
"Nice": 5, "Qualities": {
"Outgoing": 6,
"Nice": 4,
"Playful": 6, "Playful": 6,
"Neat": 4, "Neat": 5,
"Active": 3 "Active": 4
}
} }
``` ```
@ -55,7 +61,7 @@ With Sims 3 and later, creating personalities is as simple as selecting a trait.
## 📌 Stretch Goals ## 📌 Stretch Goals
- Cross-platform dotnet tool. (e.g. ``dotnet tool install``) - Cross-platform dotnet tool. (e.g. `dotnet tool install`)
## 🗓️ Update Cycle ## 🗓️ Update Cycle
@ -65,22 +71,22 @@ With Sims 3 and later, creating personalities is as simple as selecting a trait.
| Patch Update | As needed | Bug fixes, security updates | | Patch Update | As needed | Bug fixes, security updates |
| Major Update | As needed | Framework upgrades, major refactors | | Major Update | As needed | Framework upgrades, major refactors |
* Reserve months: June (Mid-Year Chill) & December (End-Year Freeze) - Reserve months: June (Mid-Year Chill) & December (End-Year Freeze)
## 🛡️ Status ## 🛡️ Status
* [x] Active Support - [x] Active Support
* [ ] Limited Support (Security patches only) - [ ] Limited Support (Security patches only)
* [ ] Maintenance Mode (Dependency-only updates) - [ ] Maintenance Mode (Dependency-only updates)
* [ ] Archived (No active work planned) - [ ] Archived (No active work planned)
## 🎮 Relaxation Practices ## 🎮 Relaxation Practices
* 20% creative/recovery space built into development - 20% creative/recovery space built into development
* Mandatory cooldowns after major launches (minimum 1 week) - Mandatory cooldowns after major launches (minimum 1 week)
* Crisis Mode Activates if: - Crisis Mode Activates if:
* Critical vulnerabilities - Critical vulnerabilities
* Framework-breaking issues - Framework-breaking issues
## License ## License