mirror of
				https://github.com/amevarashi/RJW-Sexperience.git
				synced 2024-08-14 23:54:08 +00:00 
			
		
		
		
	Move rape effects to the base mod
This commit is contained in:
		
							parent
							
								
									8c353b572b
								
							
						
					
					
						commit
						9613dd2aba
					
				
					 2 changed files with 36 additions and 25 deletions
				
			
		| 
						 | 
				
			
			@ -51,7 +51,7 @@ namespace RJWSexperience.Ideology.Patches
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.Aftersex), new Type[] { typeof(SexProps) })]
 | 
			
		||||
	public static class RJW_Patch_Aftersex
 | 
			
		||||
	public static class RJW_Patch_SexUtility_Aftersex_RecordHistoryEvents
 | 
			
		||||
	{
 | 
			
		||||
		public static void Postfix(SexProps props)
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			@ -61,17 +61,9 @@ namespace RJWSexperience.Ideology.Patches
 | 
			
		|||
			{
 | 
			
		||||
				if (xxx.is_human(props.pawn))
 | 
			
		||||
					AfterSexHuman(props.pawn, props.partner);
 | 
			
		||||
				else if (xxx.is_human(props.partner))
 | 
			
		||||
				if (xxx.is_human(props.partner))
 | 
			
		||||
					AfterSexHuman(props.partner, props.pawn);
 | 
			
		||||
 | 
			
		||||
				if (xxx.is_human(props.partner) && props.isRape)
 | 
			
		||||
				{
 | 
			
		||||
					if (props.partner.IsPrisoner)
 | 
			
		||||
						props.partner.guest.will = Math.Max(0, props.partner.guest.will - 0.2f);
 | 
			
		||||
					if (props.partner.IsSlave)
 | 
			
		||||
						RapeEffectSlave(props.partner);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if (interactionEvents != null)
 | 
			
		||||
				{
 | 
			
		||||
					foreach (HistoryEventDef eventDef in interactionEvents.pawnEvents)
 | 
			
		||||
| 
						 | 
				
			
			@ -91,26 +83,12 @@ namespace RJWSexperience.Ideology.Patches
 | 
			
		|||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public static void AfterSexHuman(Pawn human, Pawn partner)
 | 
			
		||||
		private static void AfterSexHuman(Pawn human, Pawn partner)
 | 
			
		||||
		{
 | 
			
		||||
			RsiHistoryEventDefOf.RSI_NonIncestuosSex.RecordEventWithPartner(human, partner);
 | 
			
		||||
			RsiHistoryEventDefOf.RSI_NonIncestuosSex.RecordEventWithPartner(partner, human);
 | 
			
		||||
 | 
			
		||||
			if (partner.IsAnimal())
 | 
			
		||||
			{
 | 
			
		||||
				RsiHistoryEventDefOf.RSI_SexWithAnimal.RecordEventWithPartner(human, partner);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public static void RapeEffectSlave(Pawn victim)
 | 
			
		||||
		{
 | 
			
		||||
			Need_Suppression suppression = victim.needs.TryGetNeed<Need_Suppression>();
 | 
			
		||||
			if (suppression != null)
 | 
			
		||||
			{
 | 
			
		||||
				Hediff broken = victim.health.hediffSet.GetFirstHediffOfDef(xxx.feelingBroken);
 | 
			
		||||
				if (broken != null) suppression.CurLevel += (0.3f * broken.Severity) + 0.05f;
 | 
			
		||||
				else suppression.CurLevel += 0.05f;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@ using rjw;
 | 
			
		|||
using RJWSexperience.Cum;
 | 
			
		||||
using RJWSexperience.Logs;
 | 
			
		||||
using RJWSexperience.SexHistory;
 | 
			
		||||
using System;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -155,4 +156,36 @@ namespace RJWSexperience
 | 
			
		|||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.Aftersex), new Type[] { typeof(SexProps) })]
 | 
			
		||||
	public static class RJW_Patch_SexUtility_Aftersex_RapeEffects
 | 
			
		||||
	{
 | 
			
		||||
		public static void Postfix(SexProps props)
 | 
			
		||||
		{
 | 
			
		||||
			if (!props.hasPartner() || !props.isRape || !xxx.is_human(props.partner))
 | 
			
		||||
				return;
 | 
			
		||||
 | 
			
		||||
			if (props.partner.IsPrisoner)
 | 
			
		||||
				RapeEffectPrisoner(props.partner);
 | 
			
		||||
 | 
			
		||||
			if (props.partner.IsSlave)
 | 
			
		||||
				RapeEffectSlave(props.partner);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		private static void RapeEffectPrisoner(Pawn victim)
 | 
			
		||||
		{
 | 
			
		||||
			victim.guest.will = Math.Max(0, victim.guest.will - 0.2f);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		private static void RapeEffectSlave(Pawn victim)
 | 
			
		||||
		{
 | 
			
		||||
			Need_Suppression suppression = victim.needs.TryGetNeed<Need_Suppression>();
 | 
			
		||||
			if (suppression != null)
 | 
			
		||||
			{
 | 
			
		||||
				Hediff broken = victim.health.hediffSet.GetFirstHediffOfDef(xxx.feelingBroken);
 | 
			
		||||
				if (broken != null) suppression.CurLevel += (0.3f * broken.Severity) + 0.05f;
 | 
			
		||||
				else suppression.CurLevel += 0.05f;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue