mirror of
				https://github.com/vegapnk/RJW-Genes.git
				synced 2024-08-15 00:23:31 +00:00 
			
		
		
		
	Started on Progenity Gene
This commit is contained in:
		
							parent
							
								
									56f8c2b6b2
								
							
						
					
					
						commit
						ae31f2df3b
					
				
					 7 changed files with 156 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -115,4 +115,43 @@
 | 
			
		|||
    <biostatMet>-1</biostatMet>
 | 
			
		||||
  </GeneDef>
 | 
			
		||||
 | 
			
		||||
  <GeneDef ParentName="BreedingBase">
 | 
			
		||||
    <defName>rjw_genes_hardwired_progenity</defName>
 | 
			
		||||
    <label>Hardwired Progenity</label>
 | 
			
		||||
    <description>Carriers of this gene need to procreate. They suffer negative effects if they are childless, and have increased capabilities if they reach a high amount of offsprings.</description>
 | 
			
		||||
    <iconPath>Genes/Icons/RJW_Genes_PheromoneSpit</iconPath>
 | 
			
		||||
    <displayOrderInCategory>70</displayOrderInCategory>
 | 
			
		||||
 | 
			
		||||
    <conditionalStatAffecters>
 | 
			
		||||
      <li Class="RJW_Genes.ConditionalStatAffecter_NoChildren">
 | 
			
		||||
        <statFactors>
 | 
			
		||||
          <MoveSpeed>0.7</MoveSpeed>
 | 
			
		||||
        </statFactors>
 | 
			
		||||
        <statOffsets>
 | 
			
		||||
          <WorkSpeedGlobal>-0.5</WorkSpeedGlobal>
 | 
			
		||||
          <Fertility>1.2</Fertility>
 | 
			
		||||
        </statOffsets>
 | 
			
		||||
      </li>
 | 
			
		||||
      <li Class="RJW_Genes.ConditionalStatAffecter_ManyChildren">
 | 
			
		||||
        <statFactors>
 | 
			
		||||
          <MoveSpeed>1.05</MoveSpeed>
 | 
			
		||||
        </statFactors>
 | 
			
		||||
        <statOffsets>
 | 
			
		||||
          <WorkSpeedGlobal>0.1</WorkSpeedGlobal>
 | 
			
		||||
          <Fertility>0.1</Fertility>
 | 
			
		||||
        </statOffsets>
 | 
			
		||||
      </li>
 | 
			
		||||
      <li Class="RJW_Genes.ConditionalStatAffecter_VeryManyChildren">
 | 
			
		||||
        <statFactors>
 | 
			
		||||
          <MoveSpeed>1.1</MoveSpeed>
 | 
			
		||||
        </statFactors>
 | 
			
		||||
        <statOffsets>
 | 
			
		||||
          <WorkSpeedGlobal>0.25</WorkSpeedGlobal>
 | 
			
		||||
        </statOffsets>
 | 
			
		||||
      </li>
 | 
			
		||||
    </conditionalStatAffecters>
 | 
			
		||||
 | 
			
		||||
    <biostatCpx>1</biostatCpx>
 | 
			
		||||
    <biostatMet>0</biostatMet>
 | 
			
		||||
  </GeneDef>
 | 
			
		||||
</Defs>
 | 
			
		||||
							
								
								
									
										8
									
								
								Common/Languages/English/Keyed/StatsReports.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Common/Languages/English/Keyed/StatsReports.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<LanguageData>
 | 
			
		||||
 | 
			
		||||
	<StatsReport_NoChildren>Pawn doesn't have any children.</StatsReport_NoChildren>
 | 
			
		||||
	<StatsReport_ManyChildren>Pawn has a decent amount of children.</StatsReport_ManyChildren>
 | 
			
		||||
	<StatsReport_VeryManyChildren>Pawn has a lot of children.</StatsReport_VeryManyChildren>
 | 
			
		||||
 | 
			
		||||
</LanguageData>
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +73,7 @@ namespace RJW_Genes
 | 
			
		|||
		public static readonly GeneDef rjw_genes_fervent_ovipositor;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_insectbreeder;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_insectincubator;
 | 
			
		||||
		public static readonly GeneDef rjw_genes_hardwired_progenity;
 | 
			
		||||
        
 | 
			
		||||
		// Cum 
 | 
			
		||||
        public static readonly GeneDef rjw_genes_no_cum;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,34 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class ConditionalStatAffecter_ManyChildren : ConditionalStatAffecter
 | 
			
		||||
    {
 | 
			
		||||
        public override string Label => (string)"StatsReport_ManyChildren".Translate();
 | 
			
		||||
 | 
			
		||||
        public const int THRESHOLD_FOR_CHILDREN = 3;
 | 
			
		||||
 | 
			
		||||
        public override bool Applies(StatRequest req)
 | 
			
		||||
        {
 | 
			
		||||
            if (req == null || req.Thing == null || !req.Thing.Spawned) return false;
 | 
			
		||||
 | 
			
		||||
            if (req.Thing is Pawn pawn)
 | 
			
		||||
            {
 | 
			
		||||
                if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_hardwired_progenity))
 | 
			
		||||
                {
 | 
			
		||||
                    // This "middle" Conditional Stat Affecter only fires if the other one does not apply
 | 
			
		||||
                    return pawn.relations.ChildrenCount >= THRESHOLD_FOR_CHILDREN 
 | 
			
		||||
                        && pawn.relations.ChildrenCount < ConditionalStatAffecter_VeryManyChildren.THRESHOLD_FOR_CHILDREN;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// This conditional stat affecter "fires" if the pawn has no children. 
 | 
			
		||||
    /// 
 | 
			
		||||
    /// DevNote: I salvaged this from 1.3.3 Halamyr Conditional Stat Affecters. 
 | 
			
		||||
    /// It seems that with RW 1.5 there was a change how these work, as the req.Pawn seems to be null. 
 | 
			
		||||
    /// Now, the pawn is in req.Thing. 
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class ConditionalStatAffecter_NoChildren : ConditionalStatAffecter
 | 
			
		||||
    {
 | 
			
		||||
        public override string Label => (string)"StatsReport_NoChildren".Translate();
 | 
			
		||||
 | 
			
		||||
        public override bool Applies(StatRequest req)
 | 
			
		||||
        {
 | 
			
		||||
            if (req == null || req.Thing == null || !req.Thing.Spawned) return false;
 | 
			
		||||
 | 
			
		||||
            if (req.Thing is Pawn pawn)
 | 
			
		||||
            {
 | 
			
		||||
                if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_hardwired_progenity))
 | 
			
		||||
                {
 | 
			
		||||
                    return pawn.relations.ChildrenCount == 0;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJW_Genes
 | 
			
		||||
{
 | 
			
		||||
    public class ConditionalStatAffecter_VeryManyChildren : ConditionalStatAffecter
 | 
			
		||||
    {
 | 
			
		||||
        public override string Label => (string)"StatsReport_VeryManyChildren".Translate();
 | 
			
		||||
 | 
			
		||||
        public const int THRESHOLD_FOR_CHILDREN = 8;
 | 
			
		||||
 | 
			
		||||
        public override bool Applies(StatRequest req)
 | 
			
		||||
        {
 | 
			
		||||
            if (req == null || req.Thing == null || !req.Thing.Spawned) return false;
 | 
			
		||||
 | 
			
		||||
            if (req.Thing is Pawn pawn)
 | 
			
		||||
            {
 | 
			
		||||
                if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_hardwired_progenity))
 | 
			
		||||
                {
 | 
			
		||||
                    return pawn.relations.ChildrenCount >= THRESHOLD_FOR_CHILDREN;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -71,6 +71,9 @@
 | 
			
		|||
    <Compile Include="Genes\Breeding\Abilities\CompProperties_AbilityMatingCall.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Abilities\CompProperties_AbilityPheromoneSpit.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\AnimalBreedingHelper.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\ConditionalStatAffecters\ConditionalStatAffecter_NoChildren.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\ConditionalStatAffecters\ConditionalStatAffecter_ManyChildren.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\ConditionalStatAffecters\ConditionalStatAffecter_VeryManyChildren.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Genes\Gene_FerventOvipositor.cs" />
 | 
			
		||||
    <Compile Include="Genes\Breeding\Genes\Gene_InsectIncubator.cs" />
 | 
			
		||||
    <Compile Include="Genes\Cum\Patch_LikesCumflation.cs" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue