From bdb5431876cb5591cc8e7faa43b98490a3fc2657 Mon Sep 17 00:00:00 2001
From: Ed86 <email@email.com>
Date: Tue, 16 Jul 2019 20:35:37 +0300
Subject: [PATCH] fix for gave virginity thought changed description of
 GetRapedAsComfortPrisoner record, moved record increase from any rape to rape
 cp only added TookVirginity thought, maybe implement it some day, this year,
 maybe

---
 Defs/RecordDefs/Records.xml                   |  4 +-
 Defs/ThoughtDefs/Thoughts_Virgin.xml          | 13 ++++++
 Source/Common/SexUtility.cs                   |  5 +--
 Source/Common/xxx.cs                          | 41 +++++++++++++++----
 Source/Comps/CompRJW.cs                       |  1 +
 .../JobDriver_PrisonerComfortRapin.cs         |  1 +
 6 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/Defs/RecordDefs/Records.xml b/Defs/RecordDefs/Records.xml
index aca5b6ea..86ae118a 100644
--- a/Defs/RecordDefs/Records.xml
+++ b/Defs/RecordDefs/Records.xml
@@ -112,8 +112,8 @@
 
 	<RecordDef>
 		<defName>GetRapedAsComfortPrisoner</defName>
-		<label>rapes experienced as a designation target</label>
-		<description>The number of times I got raped as a comfort prisoner/colonist.</description>
+		<label>rapes experienced as a comfort target</label>
+		<description>The number of times I was used to comfort someone.</description>
 		<type>Int</type>
 	</RecordDef>
 
diff --git a/Defs/ThoughtDefs/Thoughts_Virgin.xml b/Defs/ThoughtDefs/Thoughts_Virgin.xml
index e50c560c..f7479036 100644
--- a/Defs/ThoughtDefs/Thoughts_Virgin.xml
+++ b/Defs/ThoughtDefs/Thoughts_Virgin.xml
@@ -27,4 +27,17 @@
 			</li>
 		</stages>
 	</ThoughtDef>
+	
+	<ThoughtDef>
+		<defName>TookVirginity</defName>
+		<thoughtClass>Thought_Memory</thoughtClass>
+		<durationDays>10.0</durationDays>
+		<stages>
+			<li>
+				<label>Took virginity</label>
+				<description>I've taken someone's virginity.</description>
+				<baseMoodEffect>10</baseMoodEffect>
+			</li>
+		</stages>
+	</ThoughtDef>
 </Defs>
diff --git a/Source/Common/SexUtility.cs b/Source/Common/SexUtility.cs
index cdef2318..e8327f18 100644
--- a/Source/Common/SexUtility.cs
+++ b/Source/Common/SexUtility.cs
@@ -341,9 +341,7 @@ namespace rjw
 			//apply cum to body:
 			SemenHelper.calculateAndApplySemen(pawn, partner, sextype);
 
-
 			//--Log.Message("SexUtility::aftersex( " + pawn_name + ", " + partner_name + " ) - checking satisfaction");
-			Satisfy(pawn, partner, sextype, rape, isCoreLovin);
 
 			if (!pawn.Dead && !partner.Dead)
 			{
@@ -355,6 +353,7 @@ namespace rjw
 			}
 
 			xxx.UpdateRecords(pawn, partner, sextype, rape, isCoreLovin);
+			Satisfy(pawn, partner, sextype, rape, isCoreLovin);
 
 			CheckTraitGain(pawn);
 			CheckTraitGain(partner);
@@ -376,8 +375,8 @@ namespace rjw
 			SemenHelper.calculateAndApplySemen(pawn, null, sextype);
 
 			//--Log.Message("SexUtility::aftersex( " + pawn_name + ", " + partner_name + " ) - checking satisfaction");
-			Satisfy(pawn, null, sextype);
 			xxx.UpdateRecords(pawn, null, sextype);
+			Satisfy(pawn, null, sextype);
 
 			// No traits from solo. Enable if some are edded. (Voyerism?)
 			//check_trait_gain(pawn);
diff --git a/Source/Common/xxx.cs b/Source/Common/xxx.cs
index 5bf0d510..25b7015d 100644
--- a/Source/Common/xxx.cs
+++ b/Source/Common/xxx.cs
@@ -447,6 +447,26 @@ namespace rjw
 
 		public static bool is_Virgin(Pawn pawn)
 		{
+			/*
+			Log.Message("xxx::is_Virgin( " + xxx.get_pawnname(pawn));
+			Log.Message("xxx::is_Virgin( GetRapedAsComfortPrisoner " + pawn.records.GetValue(GetRapedAsComfortPrisoner));
+			Log.Message("xxx::is_Virgin( GetRapedAsComfortPrisoner " + pawn.records.GetValue(GetRapedAsComfortPrisoner));
+			Log.Message("xxx::is_Virgin( CountOfSex " + pawn.records.GetValue(CountOfSex));
+			Log.Message("xxx::is_Virgin( CountOfSexWithHumanlikes " + pawn.records.GetValue(CountOfSexWithHumanlikes));
+			Log.Message("xxx::is_Virgin( CountOfSexWithAnimals " + pawn.records.GetValue(CountOfSexWithAnimals));
+			Log.Message("xxx::is_Virgin( CountOfSexWithInsects " + pawn.records.GetValue(CountOfSexWithInsects));
+			Log.Message("xxx::is_Virgin( CountOfSexWithOthers " + pawn.records.GetValue(CountOfSexWithOthers));
+			Log.Message("xxx::is_Virgin( CountOfSexWithCorpse " + pawn.records.GetValue(CountOfSexWithCorpse));
+			Log.Message("xxx::is_Virgin( CountOfWhore " + pawn.records.GetValue(CountOfWhore));
+			Log.Message("xxx::is_Virgin( CountOfRapedHumanlikes " + pawn.records.GetValue(CountOfRapedHumanlikes));
+			Log.Message("xxx::is_Virgin( CountOfBeenRapedByHumanlikes " + pawn.records.GetValue(CountOfBeenRapedByHumanlikes));
+			Log.Message("xxx::is_Virgin( CountOfRapedAnimals " + pawn.records.GetValue(CountOfRapedAnimals));
+			Log.Message("xxx::is_Virgin( CountOfBeenRapedByAnimals " + pawn.records.GetValue(CountOfBeenRapedByAnimals));
+			Log.Message("xxx::is_Virgin( CountOfRapedInsects " + pawn.records.GetValue(CountOfRapedInsects));
+			Log.Message("xxx::is_Virgin( CountOfBeenRapedByInsects " + pawn.records.GetValue(CountOfBeenRapedByInsects));
+			Log.Message("xxx::is_Virgin( CountOfRapedOthers " + pawn.records.GetValue(CountOfRapedOthers));
+			Log.Message("xxx::is_Virgin( CountOfBeenRapedByOthers " + pawn.records.GetValue(CountOfBeenRapedByOthers));
+			*/
 			//Inaccurate, because of how relatives and ex-lovers and such are generated
 			return pawn.records.GetValue(GetRapedAsComfortPrisoner) == 0 &&
 					pawn.records.GetValue(CountOfSex) == 0 &&
@@ -1607,9 +1627,19 @@ namespace rjw
 					pawn.records.Increment(pawnIsRaper ? CountOfRapedOthers : CountOfBeenRapedByOthers);
 				}
 			}
-			if (isVirginSex && currentThought != null && !is_animal(pawn))
+			
+			/*
+			Log.Message("xxx::UpdateRecordsInternal( " + xxx.get_pawnname(pawn));
+			Log.Message("xxx::UpdateRecordsInternal( " + xxx.get_pawnname(partner));
+			Log.Message("xxx::UpdateRecordsInternal( isRape " + isRape);
+			Log.Message("xxx::UpdateRecordsInternal( isLoveSex " + isLoveSex);
+			Log.Message("xxx::UpdateRecordsInternal( isVirginSex " + isVirginSex);
+			Log.Message("xxx::UpdateRecordsInternal( pawnIsRaper " + pawnIsRaper);
+			Log.Message("xxx::UpdateRecordsInternal( currentThought " + currentThought);
+			Log.Message("");
+			*/
+			if (!is_animal(pawn) && isVirginSex && currentThought != null) //&& (sextype == rjwSextype.Vaginal || sextype == rjwSextype.DoublePenetration))
 			{
-				//added by Hoge. This works fine, but need balance and discuss about need this or not
 				pawn.needs.mood.thoughts.memories.TryGainMemory((Thought_Memory)ThoughtMaker.MakeThought(currentThought), partner);
 			}
 		}
@@ -1705,17 +1735,12 @@ namespace rjw
 			}
 			return stage > 1;
 		}
-		//add variant for eggs
+		//add variant for eggs?
 		public static void processBrokenPawn(Pawn pawn)
 		{
-			// Ed86:
 			// Called after rape/breed
 			if (pawn is null)
-			{
-				//Log.Error("xxx::processBrokenPawn - pawn is null");
 				return;
-			}
-			pawn.records.Increment(GetRapedAsComfortPrisoner);
 
 			if (is_human(pawn) && !pawn.Dead && pawn.records != null)
 			{
diff --git a/Source/Comps/CompRJW.cs b/Source/Comps/CompRJW.cs
index 67d4fbac..6be8ab17 100644
--- a/Source/Comps/CompRJW.cs
+++ b/Source/Comps/CompRJW.cs
@@ -262,6 +262,7 @@ namespace rjw
 
 			//roll random RJW orientation
 			Comp(pawn).orientation = xxx.is_animal(pawn) ? RollAnimalOrientation() : RollOrientation();
+			//Asexual nymp re-roll
 			if (xxx.is_nympho(pawn))
 				while (Comp(pawn).orientation == Orientation.Asexual)
 				{
diff --git a/Source/JobDrivers/JobDriver_PrisonerComfortRapin.cs b/Source/JobDrivers/JobDriver_PrisonerComfortRapin.cs
index 7e2e56f8..87df4f76 100644
--- a/Source/JobDrivers/JobDriver_PrisonerComfortRapin.cs
+++ b/Source/JobDrivers/JobDriver_PrisonerComfortRapin.cs
@@ -148,6 +148,7 @@ namespace rjw
 				{
 					// Trying to add some interactions and social logs
 					SexUtility.ProcessSex(pawn, Target, true);
+					Target.records.Increment(xxx.GetRapedAsComfortPrisoner);
 				},
 				defaultCompleteMode = ToilCompleteMode.Instant
 			};
-- 
GitLab