mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Added Settings for RJW Genes, minor Cleanups
This commit is contained in:
		
							parent
							
								
									31e96bd5e3
								
							
						
					
					
						commit
						d6aeca7249
					
				
					 11 changed files with 115 additions and 45 deletions
				
			
		| 
						 | 
				
			
			@ -38,6 +38,7 @@ namespace RJW_Genes
 | 
			
		|||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public static bool HasLowLifeForce(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (HasLifeForce(pawn))
 | 
			
		||||
| 
						 | 
				
			
			@ -118,5 +119,7 @@ namespace RJW_Genes
 | 
			
		|||
        public static bool HasParalysingKiss(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_paralysingkiss); }
 | 
			
		||||
        public static bool HasSeduce(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_seduce); }
 | 
			
		||||
        public static bool IsSexualDrainer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_drainer); }
 | 
			
		||||
        public static bool IsCumEater(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_cum_eater); }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,13 +1,7 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Verse;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using rjw.Modules.Interactions.Helpers;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -31,11 +25,8 @@ namespace RJW_Genes
 | 
			
		|||
			bool any_wound_tended = AbilityUtility.Heal(pawn, this.Props.tendQualityRange);
 | 
			
		||||
			if (any_wound_tended)
 | 
			
		||||
			{
 | 
			
		||||
				MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, "Sex healed wounds", 3.65f);
 | 
			
		||||
				//pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.Pussy_Healed, pawn, null);
 | 
			
		||||
				MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, "Sex tended wounds", 3.65f);
 | 
			
		||||
			}
 | 
			
		||||
			//this.AfterSex(any_wound_tended);
 | 
			
		||||
			//FleckMaker.AttachedOverlay(pawn, FleckDefOf.FlashHollow, Vector3.zero, 1.5f, -1f);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Not yet implemented, but the heal should also trigger after normal sex
 | 
			
		||||
| 
						 | 
				
			
			@ -77,7 +68,7 @@ namespace RJW_Genes
 | 
			
		|||
					}
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
				//AbilityUtility.ValidateHasTendableWound(pawn, throwMessages, this.parent);
 | 
			
		||||
				//TODO: Only make pawns targetable that have tendable wounds 
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
			return base.Valid(target, throwMessages);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,7 +39,7 @@ namespace RJW_Genes
 | 
			
		|||
                {
 | 
			
		||||
					return null;
 | 
			
		||||
                }
 | 
			
		||||
				int num = Mathf.RoundToInt(((gene_lifeforce.targetValue - gene_lifeforce.Value) * 100 + 10) / ingestionOutcomeDoer.FERTILIN_PER_UNIT);
 | 
			
		||||
				int num = Mathf.RoundToInt(((gene_lifeforce.targetValue - gene_lifeforce.Value) * 100 + 10) / IngestionOutcomeDoer_LifeForceOffset.FERTILIN_PER_UNIT);
 | 
			
		||||
				if (gatheredCum != null && num > 0)
 | 
			
		||||
				{
 | 
			
		||||
					Job job = JobMaker.MakeJob(RimWorld.JobDefOf.Ingest, gatheredCum);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,6 +103,12 @@ namespace RJW_Genes
 | 
			
		|||
			multiplier *= absorb_percentage;
 | 
			
		||||
			//Currently taking the sum of all penises, maybe I should just consider one at random
 | 
			
		||||
			float valuechange = TotalFertilinAmount(props, multiplier);
 | 
			
		||||
 | 
			
		||||
			if (props.partner.IsAnimal())
 | 
			
		||||
            {
 | 
			
		||||
				valuechange *= RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
			GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(props.partner), valuechange);
 | 
			
		||||
			//gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -129,7 +135,7 @@ namespace RJW_Genes
 | 
			
		|||
		/// </summary>
 | 
			
		||||
		/// <param name="props">The summary of the sex act, used for checking conditions.</param>
 | 
			
		||||
		/// <param name="PawnWithLifeForce">The pawn that might gain LifeForce through this method.</param>
 | 
			
		||||
		/// <returns></returns>
 | 
			
		||||
		/// <returns>A factor between 0 and 1 how much of output-fertilin will be used for input-lifeforce</returns>
 | 
			
		||||
		public static float BaseDom(SexProps props, Pawn PawnWithLifeForce)
 | 
			
		||||
		{
 | 
			
		||||
			float absorb_factor = 0f;
 | 
			
		||||
| 
						 | 
				
			
			@ -145,7 +151,7 @@ namespace RJW_Genes
 | 
			
		|||
		/// </summary>
 | 
			
		||||
		/// <param name="props">The summary of the sex act, used for checking conditions.</param>
 | 
			
		||||
		/// <param name="PawnWithLifeForce">The pawn that might gain LifeForce through this method.</param>
 | 
			
		||||
		/// <returns></returns>
 | 
			
		||||
		/// <returns>A factor between 0 and 1 how much of output-fertilin will be used for input-lifeforce</returns>
 | 
			
		||||
		public static float BaseSub(SexProps props, Pawn PawnWithLifeForce)
 | 
			
		||||
        {
 | 
			
		||||
			float absorb_factor = 0f;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,47 +11,52 @@ using Verse;
 | 
			
		|||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
	//[HarmonyPatch(typeof(JobDriver_Sex), nameof(JobDriver_Sex.ChangePsyfocus))]
 | 
			
		||||
	/// <summary>
 | 
			
		||||
	/// This patch enables cum-eater pawns to drain cumflations for more fertilin drain by passively having sex.
 | 
			
		||||
	/// It is hooked after RJWs Change-Psyfocus so that pawns that are having prolonged sex (e.g. by overdrive) can fully drain the cumflation over time.
 | 
			
		||||
	/// 
 | 
			
		||||
	/// It is conditionally loaded only when LicentiaLabs is enabled, as this is the necessary source for cumflation-hediffs. 
 | 
			
		||||
	/// The patched function is: [HarmonyPatch(typeof(JobDriver_Sex), nameof(JobDriver_Sex.ChangePsyfocus))]
 | 
			
		||||
	/// </summary>
 | 
			
		||||
	public static class Patch_SexTicks_ChangePsyfocus
 | 
			
		||||
	{
 | 
			
		||||
		public const float LIFEFORCE_GAIN_PER_TICK = 0.05f;
 | 
			
		||||
		public const float CUMFLATION_SEVERITY_LOSS_PER_TICK = 0.1f;
 | 
			
		||||
 | 
			
		||||
		//Using ChangePsyfocus as it is something that fires every 60 ticks
 | 
			
		||||
		public static void Postfix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target)
 | 
			
		||||
		{
 | 
			
		||||
			if (__instance.Sexprops.sexType == xxx.rjwSextype.Cunnilingus)
 | 
			
		||||
			{
 | 
			
		||||
				if (target != null)
 | 
			
		||||
				{
 | 
			
		||||
					Pawn pawn2 = target as Pawn;
 | 
			
		||||
					if (pawn2 != null)
 | 
			
		||||
					{
 | 
			
		||||
						//We need to know who the pawn on top is and if reverse we need to make the sub the pawn on top
 | 
			
		||||
						if (__instance.Sexprops.isRevese)
 | 
			
		||||
						{
 | 
			
		||||
							
 | 
			
		||||
							DrinkCumflation(pawn2, pawn);
 | 
			
		||||
						}
 | 
			
		||||
						else
 | 
			
		||||
						{
 | 
			
		||||
							//
 | 
			
		||||
							DrinkCumflation(pawn, pawn2);
 | 
			
		||||
							return;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
			SexProps props = __instance.Sexprops;
 | 
			
		||||
			if (props != null && props.sexType == xxx.rjwSextype.Cunnilingus && props.partner != null && target != null)
 | 
			
		||||
            {
 | 
			
		||||
				Pawn pawn2 = target as Pawn;
 | 
			
		||||
				// Case 1: Pawn is "drinking" and has CumEater Gene
 | 
			
		||||
				if (props.isRevese && GeneUtility.IsCumEater(pawn))
 | 
			
		||||
                {
 | 
			
		||||
					if (RJW_Genes_Settings.rjw_genes_detailed_debug)
 | 
			
		||||
						ModLog.Message($"{pawn.Name} is draining {pawn2.Name}'s cumflation for additional fertilin (CumEater-Gene ChangePsyFocus-Trigger).");
 | 
			
		||||
					DrinkCumflation(pawn2, pawn);
 | 
			
		||||
				}
 | 
			
		||||
				// Case 2: Pawn2 is "drinking" and has CumEater Gene
 | 
			
		||||
				else if (GeneUtility.IsCumEater(pawn2))
 | 
			
		||||
				{
 | 
			
		||||
					if (RJW_Genes_Settings.rjw_genes_detailed_debug)
 | 
			
		||||
						ModLog.Message($"{pawn.Name} is draining {pawn2.Name}'s cumflation for additional fertilin (CumEater-Gene ChangePsyFocus-Trigger).");
 | 
			
		||||
					DrinkCumflation(pawn, pawn2);
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public static void DrinkCumflation(Pawn dom, Pawn sub)
 | 
			
		||||
		public static void DrinkCumflation(Pawn source, Pawn consumer)
 | 
			
		||||
        {
 | 
			
		||||
			if (GeneUtility.HasLifeForce(sub) && GeneUtility.HasGeneNullCheck(sub,GeneDefOf.rjw_genes_cum_eater)&& dom.health.hediffSet.HasHediff(HediffDef.Named("Cumflation")))
 | 
			
		||||
			if (GeneUtility.HasLifeForce(consumer) && GeneUtility.IsCumEater(consumer)
 | 
			
		||||
				&& source.health.hediffSet.HasHediff(HediffDef.Named("Cumflation")))
 | 
			
		||||
			{
 | 
			
		||||
				Hediff cumflation = dom.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Cumflation"));
 | 
			
		||||
				Gene_LifeForce gene_LifeForce = sub.genes.GetFirstGeneOfType<Gene_LifeForce>();
 | 
			
		||||
				cumflation.Severity -= 0.1f;
 | 
			
		||||
				gene_LifeForce.Resource.Value += 0.05f;
 | 
			
		||||
				Hediff cumflation = source.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Cumflation"));
 | 
			
		||||
				Gene_LifeForce gene_LifeForce = consumer.genes.GetFirstGeneOfType<Gene_LifeForce>();
 | 
			
		||||
				cumflation.Severity = Math.Max(0f,cumflation.Severity - CUMFLATION_SEVERITY_LOSS_PER_TICK);
 | 
			
		||||
				gene_LifeForce.Resource.Value += LIFEFORCE_GAIN_PER_TICK;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		//Maybe I can store gene and hediff so I dont need to look them up every time
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue