From 518e683dd4c6e93374b9945d74f5a863751ba2fd Mon Sep 17 00:00:00 2001 From: amevarashi Date: Sun, 12 Jun 2022 09:20:12 +0500 Subject: [PATCH] Virgin trait degree enum --- .../ExtensionMethods/PawnExtensions.cs | 26 +++++++++---------- .../RJWSexperience/Virginity/TraitDegree.cs | 10 +++++++ 2 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 RJWSexperience/RJWSexperience/Virginity/TraitDegree.cs diff --git a/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs index 45d17b2..c2523eb 100644 --- a/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs +++ b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs @@ -114,20 +114,20 @@ namespace RJWSexperience public static void AddVirginTrait(this Pawn pawn) { - if (pawn.story?.traits != null) + if (pawn.story?.traits == null) + return; + + if (pawn.IsVirgin()) { - if (pawn.IsVirgin()) - { - int degree = 0; - if (pawn.gender == Gender.Female) degree = 2; - Trait virgin = new Trait(VariousDefOf.Virgin, degree, true); - pawn.story.traits.GainTrait(virgin); - } - else if (pawn.gender == Gender.Female && Rand.Chance(0.05f)) - { - Trait virgin = new Trait(VariousDefOf.Virgin, 1, true); - pawn.story.traits.GainTrait(virgin); - } + Virginity.TraitDegree degree = Virginity.TraitDegree.MaleVirgin; + if (pawn.gender == Gender.Female) degree = Virginity.TraitDegree.FemaleVirgin; + Trait virgin = new Trait(VariousDefOf.Virgin, (int)degree, true); + pawn.story.traits.GainTrait(virgin); + } + else if (pawn.gender == Gender.Female && Rand.Chance(0.05f)) + { + Trait virgin = new Trait(VariousDefOf.Virgin, (int)Virginity.TraitDegree.FemaleAfterSurgery, true); + pawn.story.traits.GainTrait(virgin); } } } diff --git a/RJWSexperience/RJWSexperience/Virginity/TraitDegree.cs b/RJWSexperience/RJWSexperience/Virginity/TraitDegree.cs new file mode 100644 index 0000000..6baad93 --- /dev/null +++ b/RJWSexperience/RJWSexperience/Virginity/TraitDegree.cs @@ -0,0 +1,10 @@ +namespace RJWSexperience.Virginity +{ + public enum TraitDegree + { + FemaleDamagedVirgin = -1, + MaleVirgin = 0, + FemaleAfterSurgery = 1, + FemaleVirgin = 2 + } +}