- Fix missing traits
This commit is contained in:
Tony Bark 2025-02-02 02:00:36 -05:00
parent 0180d2d02e
commit 6e455bbc97
2 changed files with 26 additions and 7 deletions

14
README.md Normal file
View file

@ -0,0 +1,14 @@
# Sims Personality Generator
As the name suggets, this will generate a persoanlity for The Sims 1 and 2. If you set one trait higher than other, it will automatically adjust itself to compensate for the difference.
## Background
I wanted to play The Sims 2 with my characters. Problem was I've been spoiled by traits. How do I create an ideal personality within these limitations? What if I have a random generator that gives me some options but also is smart enough to let me set some bias towards Playfulness or Nice?
The code itself was initially generated using the Qwen Coder model because I wouldn't know to begin. While it is easy to generate random numbers, I also had to have it to account for one being higher than the other. How? That was the point in asking the AI for a template, with that taken into consideration.
## License
I license this project under the GPL-3.0 license - see [LICENSE](LICENSE) for details.

19
Sim.cs
View file

@ -1,11 +1,15 @@
namespace SimsPersonalityGenerator;
public enum Traits { Nice, Neat, Outgoing, Active, Playful }
public class Sim
{
public int Niceness { get; private set; }
public int Neatness { get; private set; }
public int Outgoingness { get; private set; }
public int Activeness { get; private set; }
public int Laziness { get; private set; }
public int Playfulness { get; private set; }
public Sim()
@ -13,35 +17,36 @@ public class Sim
GenerateRandomPersonality();
}
public void SetTraitHigher(string trait, bool isHigh)
// TODO: Fix trait mix up
public void SetTraitHigher(Traits trait, bool isHigh)
{
switch (trait.ToLower())
switch (trait)
{
case "niceness":
case Traits.Nice:
if (isHigh)
Niceness = Math.Min(10, Neatness + 5);
else
Neatness = Math.Min(10, Niceness + 5);
break;
case "neatness":
case Traits.Neat:
if (isHigh)
Neatness = Math.Min(10, Activeness + 5);
else
Activeness = Math.Min(10, Neatness + 5);
break;
case "outgoingness":
case Traits.Outgoing:
if (isHigh)
Outgoingness = Math.Min(10, Playfulness + 5);
else
Playfulness = Math.Min(10, Outgoingness + 5);
break;
case "activeness":
case Traits.Active:
if (isHigh)
Activeness = Math.Min(10, Niceness + 5);
else
Niceness = Math.Min(10, Activeness + 5);
break;
case "playfulness":
case Traits.Playful:
if (isHigh)
Playfulness = Math.Min(10, Outgoingness + 5);
else