mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Adding Lifeforce and succubus wings gene
Adds lifeforce gene and functions for gaining lifeforce from oral sex and mental break if lifeforce reaches zero. Also add succubus wings drawn by me
This commit is contained in:
		
							parent
							
								
									f0a9cce9c9
								
							
						
					
					
						commit
						1f865320b0
					
				
					 25 changed files with 690 additions and 39 deletions
				
			
		| 
						 | 
				
			
			@ -1,38 +0,0 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using rjw;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
 | 
			
		||||
namespace RJW_BGS
 | 
			
		||||
{
 | 
			
		||||
    [StaticConstructorOnStartup]
 | 
			
		||||
    internal static class First
 | 
			
		||||
    {
 | 
			
		||||
        static First()
 | 
			
		||||
        {
 | 
			
		||||
            //RJWcopy.Racegroupdictbuilder();
 | 
			
		||||
            //Prints all found race dicts (debugging only)
 | 
			
		||||
            //logAllFoundRaceGroupGenes
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static void logAllFoundRaceGroupGenes()
 | 
			
		||||
        {
 | 
			
		||||
            foreach (RaceGroupDef def in DefDatabase<RaceGroupDef>.AllDefs)
 | 
			
		||||
            {
 | 
			
		||||
                Log.Message("defName = " + def.defName);
 | 
			
		||||
                if (def.raceNames != null)
 | 
			
		||||
                {
 | 
			
		||||
                    foreach (string race in def.raceNames)
 | 
			
		||||
                    {
 | 
			
		||||
                        Log.Message(race);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										29
									
								
								Source/First.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								Source/First.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using rjw;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
 | 
			
		||||
using rjw.Modules.Interactions.Internals.Implementation;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    [StaticConstructorOnStartup]
 | 
			
		||||
    internal static class First
 | 
			
		||||
    {
 | 
			
		||||
        static First()
 | 
			
		||||
        {
 | 
			
		||||
            AddtoIPartPreferenceRule();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //Modified code from https://gitgud.io/lutepickle/rjw_menstruation/-/tree/main/1.4/source/RJW_Menstruation/RJW_Menstruation
 | 
			
		||||
        private static void AddtoIPartPreferenceRule()
 | 
			
		||||
        {
 | 
			
		||||
            List<IPartPreferenceRule> partPreferenceRules = Unprivater.GetProtectedValue<List<IPartPreferenceRule>>("_partKindUsageRules", typeof(PartPreferenceDetectorService));
 | 
			
		||||
            partPreferenceRules.Add(new Interactions.GenesPartKindUsageRule());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -71,5 +71,8 @@ namespace RJW_Genes
 | 
			
		|||
		// Special
 | 
			
		||||
		public static readonly GeneDef rjw_genes_orgasm_rush;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_aphrodisiac_pheromones;
 | 
			
		||||
 | 
			
		||||
		// LifeForce
 | 
			
		||||
		public static readonly GeneDef rjw_genes_lifeforce;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,5 +33,35 @@ namespace RJW_Genes
 | 
			
		|||
			}
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Get total fluidamount a persom has.
 | 
			
		||||
		public static float GetTotalFluidAmount(Pawn pawn, float multiplier = 1f)
 | 
			
		||||
		{
 | 
			
		||||
			var partBPR = Genital_Helper.get_genitalsBPR(pawn);
 | 
			
		||||
			var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR);
 | 
			
		||||
			float total_cum = 0;
 | 
			
		||||
			if (!parts.NullOrEmpty())
 | 
			
		||||
			{
 | 
			
		||||
				CompHediffBodyPart CompHediff;
 | 
			
		||||
 | 
			
		||||
				foreach (Hediff part in parts)
 | 
			
		||||
				{
 | 
			
		||||
					if (GenitaliaChanger.IsArtificial(part))
 | 
			
		||||
						continue;
 | 
			
		||||
 | 
			
		||||
					if (rjw.Genital_Helper.is_penis(part))
 | 
			
		||||
					{
 | 
			
		||||
						CompHediff = part.TryGetComp<rjw.CompHediffBodyPart>();
 | 
			
		||||
						if (CompHediff != null)
 | 
			
		||||
						{
 | 
			
		||||
							total_cum += CompHediff.FluidAmmount * multiplier;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
			return total_cum;
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,6 +14,41 @@ namespace RJW_Genes
 | 
			
		|||
            return pawn.genes.HasGene(GeneDefOf.rjw_genes_mechbreeder);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool HasLifeForce(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (pawn.genes == null)
 | 
			
		||||
            {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            return pawn.genes.HasGene(GeneDefOf.rjw_genes_lifeforce);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool HasLowLifeForce(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (HasLifeForce(pawn))
 | 
			
		||||
            {
 | 
			
		||||
                Gene_LifeForce gene = pawn.genes.GetFirstGeneOfType<Gene_LifeForce>();
 | 
			
		||||
                if (gene.Resource.Value < gene.targetValue)
 | 
			
		||||
                {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool HasCriticalLifeForce(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (HasLifeForce(pawn))
 | 
			
		||||
            {
 | 
			
		||||
                Gene_LifeForce gene = pawn.genes.GetFirstGeneOfType<Gene_LifeForce>();
 | 
			
		||||
                if (gene.Resource.Value < gene.MinLevelForAlert)
 | 
			
		||||
                {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool IsInsectIncubator(Pawn pawn)
 | 
			
		||||
        {
 | 
			
		||||
            if (pawn.genes == null)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										83
									
								
								Source/Genes/Life_Force/GeneGizmo_ResourceLifeForce.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								Source/Genes/Life_Force/GeneGizmo_ResourceLifeForce.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,83 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	//Copied from GeneGizmo_ResourceHemogen, with small modifications 
 | 
			
		||||
	public class GeneGizmo_ResourceLifeForce : GeneGizmo_Resource
 | 
			
		||||
    {
 | 
			
		||||
        public GeneGizmo_ResourceLifeForce(Gene_Resource gene, List<IGeneResourceDrain> drainGenes, Color barColor, Color barhighlightColor) : base(gene, drainGenes, barColor, barhighlightColor)
 | 
			
		||||
        {
 | 
			
		||||
            this.draggableBar = true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms)
 | 
			
		||||
        {
 | 
			
		||||
            return base.GizmoOnGUI(topLeft, maxWidth, parms);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override string GetTooltip()
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
			this.tmpDrainGenes.Clear();
 | 
			
		||||
			string text = string.Format("{0}: {1} / {2}\n", this.gene.ResourceLabel.CapitalizeFirst().Colorize(ColoredText.TipSectionTitleColor), this.gene.ValueForDisplay, this.gene.MaxForDisplay);
 | 
			
		||||
			if (this.gene.pawn.IsColonistPlayerControlled || this.gene.pawn.IsPrisonerOfColony)
 | 
			
		||||
			{
 | 
			
		||||
				if (this.gene.targetValue <= 0f)
 | 
			
		||||
				{
 | 
			
		||||
					text += "NeverConsumeCum";
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					text = text + ("ConsumeCumBelow" + ": ") + this.gene.PostProcessValue(this.gene.targetValue);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (!this.drainGenes.NullOrEmpty<IGeneResourceDrain>())
 | 
			
		||||
			{
 | 
			
		||||
				float num = 0f;
 | 
			
		||||
				foreach (IGeneResourceDrain geneResourceDrain in this.drainGenes)
 | 
			
		||||
				{
 | 
			
		||||
					if (geneResourceDrain.CanOffset)
 | 
			
		||||
					{
 | 
			
		||||
						this.tmpDrainGenes.Add(new Pair<IGeneResourceDrain, float>(geneResourceDrain, geneResourceDrain.ResourceLossPerDay));
 | 
			
		||||
						num += geneResourceDrain.ResourceLossPerDay;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				if (num != 0f)
 | 
			
		||||
				{
 | 
			
		||||
					string text2 = (num < 0f) ? "RegenerationRate".Translate() : "DrainRate".Translate();
 | 
			
		||||
					text = string.Concat(new string[]
 | 
			
		||||
					{
 | 
			
		||||
				text,
 | 
			
		||||
				"\n\n",
 | 
			
		||||
				text2,
 | 
			
		||||
				": ",
 | 
			
		||||
				"PerDay".Translate(Mathf.Abs(this.gene.PostProcessValue(num))).Resolve()
 | 
			
		||||
					});
 | 
			
		||||
					foreach (Pair<IGeneResourceDrain, float> pair in this.tmpDrainGenes)
 | 
			
		||||
					{
 | 
			
		||||
						text = string.Concat(new string[]
 | 
			
		||||
						{
 | 
			
		||||
					text,
 | 
			
		||||
					"\n  - ",
 | 
			
		||||
					pair.First.DisplayLabel.CapitalizeFirst(),
 | 
			
		||||
					": ",
 | 
			
		||||
					"PerDay".Translate(this.gene.PostProcessValue(-pair.Second).ToStringWithSign()).Resolve()
 | 
			
		||||
						});
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (!this.gene.def.resourceDescription.NullOrEmpty())
 | 
			
		||||
			{
 | 
			
		||||
				text = text + "\n\n" + this.gene.def.resourceDescription.Formatted(this.gene.pawn.Named("PAWN")).Resolve();
 | 
			
		||||
			}
 | 
			
		||||
			return text;
 | 
			
		||||
		}
 | 
			
		||||
		private List<Pair<IGeneResourceDrain, float>> tmpDrainGenes = new List<Pair<IGeneResourceDrain, float>>();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										138
									
								
								Source/Genes/Life_Force/Gene_LifeForce.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										138
									
								
								Source/Genes/Life_Force/Gene_LifeForce.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,138 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class Gene_LifeForce : Gene_Resource, IGeneResourceDrain
 | 
			
		||||
	{
 | 
			
		||||
		public override void ExposeData()
 | 
			
		||||
		{
 | 
			
		||||
			base.ExposeData();
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public bool ShouldConsumeLifeForceNow()
 | 
			
		||||
		{
 | 
			
		||||
			return this.Value < this.targetValue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Same as Gene_Hemogen
 | 
			
		||||
		public override IEnumerable<Gizmo> GetGizmos()
 | 
			
		||||
		{
 | 
			
		||||
			foreach (Gizmo gizmo in base.GetGizmos())
 | 
			
		||||
			{
 | 
			
		||||
				yield return gizmo;
 | 
			
		||||
			}
 | 
			
		||||
			IEnumerator<Gizmo> enumerator = null;
 | 
			
		||||
			foreach (Gizmo gizmo2 in GeneResourceDrainUtility.GetResourceDrainGizmos(this))
 | 
			
		||||
			{
 | 
			
		||||
				yield return gizmo2;
 | 
			
		||||
			}
 | 
			
		||||
			enumerator = null;
 | 
			
		||||
			yield break;
 | 
			
		||||
			yield break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//Depending on how low the value is it will increase sexdrive and if it reaches zero it will create a random rape mental break.
 | 
			
		||||
		//Not using base.Tick() as it is used to start mental breaks, but we have another way to do it.
 | 
			
		||||
		public override void Tick()
 | 
			
		||||
		{
 | 
			
		||||
			//base.Tick();
 | 
			
		||||
			if (this.CanOffset && this.Resource != null)
 | 
			
		||||
            {
 | 
			
		||||
				this.Resource.Value -= this.ResourceLossPerDay / 60000;
 | 
			
		||||
				if (this.Resource.Value <= 0 && this.pawn.IsHashIntervalTick(300))
 | 
			
		||||
				{
 | 
			
		||||
					if (ModsConfig.BiotechActive && this.def.mentalBreakDef != null && 
 | 
			
		||||
						this.pawn.Spawned && !this.pawn.InMentalState && !this.pawn.Downed && 
 | 
			
		||||
						this.def.mentalBreakDef.Worker.BreakCanOccur(this.pawn))
 | 
			
		||||
                    {
 | 
			
		||||
						this.def.mentalBreakDef.Worker.TryStart(this.pawn, "MentalStateReason_Gene".Translate() + ": " + this.LabelCap, false);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
            }
 | 
			
		||||
			//GeneResourceDrainUtility.TickResourceDrain(this);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public Gene_Resource Resource
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return this;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public Pawn Pawn
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return this.pawn;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public bool CanOffset
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return this.pawn.Spawned && this.Active;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public float ResourceLossPerDay
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return this.def.resourceLossPerDay;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public string DisplayLabel
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return this.def.resourceLabel;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override float InitialResourceMax
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return 1f;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override float MinLevelForAlert
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return 0.15f;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		public override float MaxLevelOffset
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return base.MaxLevelOffset;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		protected override Color BarColor
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return Color.grey;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		protected override Color BarHighlightColor
 | 
			
		||||
		{
 | 
			
		||||
			get
 | 
			
		||||
			{
 | 
			
		||||
				return Color.white;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										38
									
								
								Source/Genes/Life_Force/JobGiver_LifeForce_RandomRape.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								Source/Genes/Life_Force/JobGiver_LifeForce_RandomRape.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using Verse;
 | 
			
		||||
using Verse.AI;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class JobGiver_LifeForce_RandomRape : JobGiver_RandomRape
 | 
			
		||||
    {
 | 
			
		||||
		protected override Job TryGiveJob(Pawn pawn)
 | 
			
		||||
		{
 | 
			
		||||
			if (!can_rape(pawn, false))
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			Pawn pawn2 = this.find_victim(pawn, pawn.Map);
 | 
			
		||||
			if (pawn2 == null)
 | 
			
		||||
			{
 | 
			
		||||
				return null;
 | 
			
		||||
			}
 | 
			
		||||
			return JobMaker.MakeJob(JobDefOf.rjw_genes_lifeforce_randomrape, pawn2);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		//same as xxx.canrape from rjw, but without last requirements.
 | 
			
		||||
		public static bool can_rape(Pawn pawn, bool forced = false)
 | 
			
		||||
		{
 | 
			
		||||
			return RJWSettings.rape_enabled && (xxx.is_mechanoid(pawn) || ((xxx.can_fuck(pawn) || 
 | 
			
		||||
				(!xxx.is_male(pawn) && xxx.get_vulnerability(pawn) < RJWSettings.nonFutaWomenRaping_MaxVulnerability && 
 | 
			
		||||
				xxx.can_be_fucked(pawn))) && (!xxx.is_human(pawn) || ((pawn.ageTracker.Growth >= 1f || pawn.ageTracker.CurLifeStage.reproductive)))));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										32
									
								
								Source/Genes/Life_Force/LifeForceMentalBreakWorker.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								Source/Genes/Life_Force/LifeForceMentalBreakWorker.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using Verse.AI;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class LifeForceMentalBreakWorker : MentalBreakWorker
 | 
			
		||||
	{
 | 
			
		||||
		public override bool BreakCanOccur(Pawn pawn)
 | 
			
		||||
		{
 | 
			
		||||
			if (pawn.Spawned && base.BreakCanOccur(pawn))
 | 
			
		||||
			{
 | 
			
		||||
				if (!GeneUtility.HasLifeForce(pawn))
 | 
			
		||||
                {
 | 
			
		||||
					return false;
 | 
			
		||||
                }
 | 
			
		||||
				Gene_LifeForce gene = pawn.genes.GetFirstGeneOfType<Gene_LifeForce>();
 | 
			
		||||
				if( gene.Resource.Value <= 0)
 | 
			
		||||
                {
 | 
			
		||||
					return true;
 | 
			
		||||
                }
 | 
			
		||||
			}
 | 
			
		||||
			return false;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										23
									
								
								Source/Genes/Life_Force/LifeForceMentalState.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Source/Genes/Life_Force/LifeForceMentalState.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
using System;
 | 
			
		||||
using Verse;
 | 
			
		||||
using Verse.AI;
 | 
			
		||||
using rjw;
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	public class LifeForceMentalState : MentalState
 | 
			
		||||
	{
 | 
			
		||||
		public override void MentalStateTick()
 | 
			
		||||
		{
 | 
			
		||||
			if (this.pawn.IsHashIntervalTick(150) && !GeneUtility.HasCriticalLifeForce(this.pawn))
 | 
			
		||||
			{
 | 
			
		||||
				Pawn_JobTracker jobs = this.pawn.jobs;
 | 
			
		||||
				if (!(((jobs != null) ? jobs.curDriver : null) is JobDriver_Sex))
 | 
			
		||||
				{
 | 
			
		||||
					base.RecoverFromState();
 | 
			
		||||
					return;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			base.MentalStateTick();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								Source/Genes/Life_Force/LifeForceMentalStateWorker.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Source/Genes/Life_Force/LifeForceMentalStateWorker.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
using System;
 | 
			
		||||
using Verse;
 | 
			
		||||
using Verse.AI;
 | 
			
		||||
using rjw;
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	// Token: 0x020000FB RID: 251
 | 
			
		||||
	public class LifeForceMentalStateWorker : MentalStateWorker
 | 
			
		||||
	{
 | 
			
		||||
		public override bool StateCanOccur(Pawn pawn)
 | 
			
		||||
		{
 | 
			
		||||
			return base.StateCanOccur(pawn) && (xxx.is_human(pawn) && JobGiver_LifeForce_RandomRape.can_rape(pawn));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										36
									
								
								Source/Genes/Life_Force/Patch_LifeForce.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Source/Genes/Life_Force/Patch_LifeForce.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
using HarmonyLib;
 | 
			
		||||
using rjw;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
	
 | 
			
		||||
	[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))]
 | 
			
		||||
	public static class Patch_LifeForce
 | 
			
		||||
	{
 | 
			
		||||
		
 | 
			
		||||
		public static void Postfix(SexProps props)
 | 
			
		||||
		{
 | 
			
		||||
			// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation)
 | 
			
		||||
			if (props.pawn == null || !props.hasPartner())
 | 
			
		||||
				return;
 | 
			
		||||
 | 
			
		||||
			if (GeneUtility.HasLifeForce(props.pawn))
 | 
			
		||||
			{
 | 
			
		||||
				if (props.sexType == xxx.rjwSextype.Oral || props.sexType == xxx.rjwSextype.Fellatio || props.sexType == xxx.rjwSextype.Sixtynine)
 | 
			
		||||
                {
 | 
			
		||||
					Pawn_GeneTracker genes = props.pawn.genes;
 | 
			
		||||
					Gene_LifeForce gene = genes.GetFirstGeneOfType<Gene_LifeForce>();
 | 
			
		||||
					gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.partner); //total amount may need to be modified to be balanced
 | 
			
		||||
				}
 | 
			
		||||
            }
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										56
									
								
								Source/Interactions/GenesPartKindUsageRule.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								Source/Interactions/GenesPartKindUsageRule.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,56 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using rjw;
 | 
			
		||||
using rjw.Modules.Interactions.Contexts;
 | 
			
		||||
using rjw.Modules.Interactions.Enums;
 | 
			
		||||
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
 | 
			
		||||
using rjw.Modules.Shared;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes.Interactions
 | 
			
		||||
{
 | 
			
		||||
    public class GenesPartKindUsageRule : IPartPreferenceRule
 | 
			
		||||
    {
 | 
			
		||||
		public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context)
 | 
			
		||||
		{
 | 
			
		||||
			Pawn pawn = context.Internals.Dominant.Pawn;
 | 
			
		||||
			if (GeneUtility.HasCriticalLifeForce(pawn))
 | 
			
		||||
			{
 | 
			
		||||
				Log.Message("Critical");
 | 
			
		||||
				yield return new Weighted<LewdablePartKind>(50f, LewdablePartKind.Mouth);
 | 
			
		||||
			}
 | 
			
		||||
			else if (GeneUtility.HasLowLifeForce(pawn))
 | 
			
		||||
			{
 | 
			
		||||
				Log.Message("Low");
 | 
			
		||||
				yield return new Weighted<LewdablePartKind>(10f, LewdablePartKind.Mouth);
 | 
			
		||||
			}
 | 
			
		||||
			else if (GeneUtility.HasLifeForce(pawn))
 | 
			
		||||
			{
 | 
			
		||||
				Log.Message("normal");
 | 
			
		||||
				yield return new Weighted<LewdablePartKind>(2f, LewdablePartKind.Mouth);
 | 
			
		||||
			}
 | 
			
		||||
			yield break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context)
 | 
			
		||||
		{
 | 
			
		||||
			Pawn pawn = context.Internals.Submissive.Pawn;
 | 
			
		||||
			if (GeneUtility.HasCriticalLifeForce(pawn))
 | 
			
		||||
			{
 | 
			
		||||
				Log.Message("Critical");
 | 
			
		||||
				yield return new Weighted<LewdablePartKind>(50f, LewdablePartKind.Mouth);
 | 
			
		||||
			}
 | 
			
		||||
			else if (GeneUtility.HasLowLifeForce(pawn))
 | 
			
		||||
			{
 | 
			
		||||
				Log.Message("Low");
 | 
			
		||||
				yield return new Weighted<LewdablePartKind>(10f, LewdablePartKind.Mouth);
 | 
			
		||||
			}
 | 
			
		||||
			else if (GeneUtility.HasLifeForce(pawn))
 | 
			
		||||
			{
 | 
			
		||||
				Log.Message("normal");
 | 
			
		||||
				yield return new Weighted<LewdablePartKind>(2f, LewdablePartKind.Mouth);
 | 
			
		||||
			}
 | 
			
		||||
			yield break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								Source/JobDefOf.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Source/JobDefOf.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    [DefOf]
 | 
			
		||||
    public static class JobDefOf
 | 
			
		||||
    {
 | 
			
		||||
        public static readonly JobDef rjw_genes_lifeforce_randomrape;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -60,7 +60,7 @@
 | 
			
		|||
    </Reference>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Compile Include="Animal_Inheritance\First.cs" />
 | 
			
		||||
    <Compile Include="First.cs" />
 | 
			
		||||
    <Compile Include="Animal_Inheritance\Harmony_Init.cs" />
 | 
			
		||||
    <Compile Include="Animal_Inheritance\InheritanceUtility.cs" />
 | 
			
		||||
    <Compile Include="Animal_Inheritance\PatchRJWBestialityPregnancyUtility.cs" />
 | 
			
		||||
| 
						 | 
				
			
			@ -114,12 +114,21 @@
 | 
			
		|||
    <Compile Include="Genes\Genitalia\Gene_DemonicGenitalia.cs" />
 | 
			
		||||
    <Compile Include="Genes\Genitalia\Gene_EquineGenitalia.cs" />
 | 
			
		||||
    <Compile Include="Genes\Genitalia\GenitaliaChanger.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\GeneGizmo_ResourceLifeForce.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\LifeForceMentalState.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\LifeForceMentalStateWorker.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\JobGiver_LifeForce_RandomRape.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\LifeForceMentalBreakWorker.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Gene_LifeForce.cs" />
 | 
			
		||||
    <Compile Include="Genes\RJW_Gene.cs" />
 | 
			
		||||
    <Compile Include="Genes\Genitalia\GenitaliaUtility.cs" />
 | 
			
		||||
    <Compile Include="Genes\Special\Gene_Aphrodisiac_Pheromones_.cs" />
 | 
			
		||||
    <Compile Include="Genes\Life_Force\Patch_LifeForce.cs" />
 | 
			
		||||
    <Compile Include="Genes\Special\Patch_OrgasmRush.cs" />
 | 
			
		||||
    <Compile Include="HarmonyInit.cs" />
 | 
			
		||||
    <Compile Include="HediffDefOf.cs" />
 | 
			
		||||
    <Compile Include="Interactions\GenesPartKindUsageRule.cs" />
 | 
			
		||||
    <Compile Include="JobDefOf.cs" />
 | 
			
		||||
    <Compile Include="Properties\AssemblyInfo.cs" />
 | 
			
		||||
    <Compile Include="RJW_Genes.cs" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue