diff --git a/Source/RJWSexperience/Patches/Rimworld_Patch.cs b/Source/RJWSexperience/Patches/Rimworld_Patch.cs index d00a943..15392a6 100644 --- a/Source/RJWSexperience/Patches/Rimworld_Patch.cs +++ b/Source/RJWSexperience/Patches/Rimworld_Patch.cs @@ -27,16 +27,25 @@ namespace RJWSexperience [HarmonyPatch(typeof(ParentRelationUtility), nameof(ParentRelationUtility.SetMother))] public static class Rimworld_Patch_RemoveVirginOnSetMother { + /// + /// Retcon virginity if game desides to generate a child for the pawn + /// public static void Postfix(Pawn pawn, Pawn newMother) { if (!pawn.relations.DirectRelationExists(PawnRelationDefOf.Parent, newMother)) - return; + return; // Failed to add relation? Trait virgin = newMother.story?.traits?.GetTrait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleVirgin); if (virgin != null) { newMother.story.traits.RemoveTrait(virgin); - newMother.story.traits.GainTrait(new Trait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleAfterSurgery)); + + // Player may notice the missing trait on their pawns. + // Doing this for all pawns results in up to a half of tribal raid generating with "virgin?" + if (newMother.IsColonist || newMother.IsPrisonerOfColony) + { + newMother.story.traits.GainTrait(new Trait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleAfterSurgery)); + } } } } diff --git a/Source/RJWSexperience/Virginity/TraitHandler.cs b/Source/RJWSexperience/Virginity/TraitHandler.cs index 21cc148..e6d79f6 100644 --- a/Source/RJWSexperience/Virginity/TraitHandler.cs +++ b/Source/RJWSexperience/Virginity/TraitHandler.cs @@ -14,7 +14,9 @@ namespace RJWSexperience.Virginity if (pawn.gender == Gender.Female && !pawn.IsVirgin()) { - if (Rand.Chance(hymenSurgeryChance)) + TechLevel techLevel = pawn.Faction?.def.techLevel ?? TechLevel.Industrial; + + if (techLevel >= TechLevel.Industrial && Rand.Chance(hymenSurgeryChance)) { Trait virgin = new Trait(RsDefOf.Trait.Virgin, TraitDegree.FemaleAfterSurgery, true); pawn.story.traits.GainTrait(virgin);