sexage check Fertilin and FertilinDraingene

Fertilin and all subgenes are only active if pawn is old enough to have sex, 13 if rjw teensex is enabled else 18.
Added a fertilindraingene which greatly increases fertilin burn, but gives a lot of metabolic efficiency
Also moved a few files into subfolders.
This commit is contained in:
Shabakur 2023-01-09 14:14:51 +01:00
parent 2e1e74e0b1
commit 09157e923d
21 changed files with 166 additions and 81 deletions

Binary file not shown.

View File

@ -3,10 +3,10 @@
<GeneDef>
<defName>rjw_genes_lifeforce</defName>
<label>fertilin</label>
<description>Carriers of this gene have a reserve of biological strength powered by a resource called fertilin. The resource can be gained and spent in various ways, all of which are unlocked by other genes.\n\nCarriers lose 10 lifeforce per day from biological entropy.</description>
<description>Carriers of this gene have a reserve of biological strength powered by a resource called fertilin. The resource can be gained and spent in various ways, some of which are unlocked by other genes.\n\nCarriers lose 5 fertilin per day from biological entropy. \n\nGene is inactive until carrier is able to have sex.</description>
<geneClass>RJW_Genes.Gene_LifeForce</geneClass>
<resourceGizmoType>RJW_Genes.GeneGizmo_ResourceLifeForce</resourceGizmoType>
<resourceLabel>lifeforce</resourceLabel>
<resourceLabel>fertilin</resourceLabel>
<resourceGizmoThresholds>
<li>0.25</li>
<li>0.5</li>
@ -28,12 +28,27 @@
</prefixSymbols>
</symbolPack>
<mentalBreakDef>rjw_genes_lifeforce_randomrape</mentalBreakDef>
<minAgeActive>18</minAgeActive>
<resourceLossPerDay>0.05</resourceLossPerDay>
<biostatCpx>1</biostatCpx>
<biostatMet>1</biostatMet>
</GeneDef>
<GeneDef>
<defName>LifeForceDrain</defName>
<label>fertilin drain</label>
<labelShortAdj>draining</labelShortAdj>
<description>Carriers lose an additional 15 fertilin per day from biological entropy.</description>
<resourceLabel>fertilin</resourceLabel>
<geneClass>RJW_Genes.Gene_LifeForceDrain</geneClass>
<iconPath>UI/Icons/Genes/Gene_HemogenDrain</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite>
<resourceLossPerDay>0.15</resourceLossPerDay>
<displayCategory>rjw_genes_fertilin</displayCategory>
<displayOrderInCategory>-1</displayOrderInCategory>
<biostatCpx>1</biostatCpx>
<biostatMet>6</biostatMet>
</GeneDef>
<GeneDef>
<defName>rjw_genes_pussyhealer</defName>
<label>Pussy Healer</label>
@ -41,7 +56,7 @@
<description>Carriers of this gene are able use vaginal sex to tend to other's wounds.</description>
<iconPath>Things/Mote/Heart</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite>
<displayOrderInCategory>10</displayOrderInCategory>
<displayOrderInCategory>9</displayOrderInCategory>
<displayCategory>rjw_genes_fertilin</displayCategory>
<abilities>
<li>rjw_genes_pussyheal</li>
@ -51,7 +66,6 @@
</descriptionHyperlinks>
<biostatCpx>1</biostatCpx>
<biostatMet>-1</biostatMet>
<minAgeActive>18</minAgeActive>
<symbolPack>
<suffixSymbols>
<li><symbol>life</symbol></li>
@ -78,7 +92,6 @@
</descriptionHyperlinks>
<biostatCpx>1</biostatCpx>
<biostatMet>-1</biostatMet>
<minAgeActive>18</minAgeActive>
<symbolPack>
<suffixSymbols>
<li><symbol>life</symbol></li>
@ -95,7 +108,7 @@
<description>Carriers of this gene are able to briefly stun an enemy with a kiss.</description>
<iconPath>Things/Mote/Heart</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite>
<displayOrderInCategory>11</displayOrderInCategory>
<displayOrderInCategory>12</displayOrderInCategory>
<displayCategory>rjw_genes_fertilin</displayCategory>
<abilities>
<li>rjw_genes_paralysingkiss</li>
@ -105,7 +118,6 @@
</descriptionHyperlinks>
<biostatCpx>1</biostatCpx>
<biostatMet>-1</biostatMet>
<minAgeActive>18</minAgeActive>
<symbolPack>
<suffixSymbols>
<li><symbol>stun</symbol></li>
@ -121,7 +133,7 @@
<description>Carriers of this gene are able to seduce a pawn into having sex with them.</description>
<iconPath>Things/Mote/Heart</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite>
<displayOrderInCategory>11</displayOrderInCategory>
<displayOrderInCategory>13</displayOrderInCategory>
<displayCategory>rjw_genes_fertilin</displayCategory>
<abilities>
<li>rjw_genes_seduce</li>
@ -131,7 +143,7 @@
</descriptionHyperlinks>
<biostatCpx>1</biostatCpx>
<biostatMet>-1</biostatMet>
<minAgeActive>18</minAgeActive>
<symbolPack>
<suffixSymbols>
<li><symbol>stun</symbol></li>

View File

@ -18,28 +18,25 @@ namespace RJW_Genes
//Split function so I can offsetlifeforce from gene without needing to look for the gene agian (for the constant drain tick)
public static Gene_LifeForce GetLifeForceGene(Pawn pawn)
{
Pawn_GeneTracker genes2 = pawn.genes;
Gene_LifeForce gene_LifeForce = (genes2 != null) ? genes2.GetFirstGeneOfType<Gene_LifeForce>() : null;
Pawn_GeneTracker genes = pawn.genes;
Gene_LifeForce gene_LifeForce = genes.GetFirstGeneOfType<Gene_LifeForce>();
return gene_LifeForce;
}
public static void OffsetLifeForce(Gene_LifeForce gene_LifeForce, float offset, bool applyStatFactor = true)
{
if (gene_LifeForce != null)
{
float old_value = gene_LifeForce.Value;
gene_LifeForce.Value += offset;
PostOffSetLifeForce(gene_LifeForce, old_value);
}
public static void OffsetLifeForce(IGeneResourceDrain drain, float offset)
{
float old_value = drain.Resource.Value;
drain.Resource.Value += offset;
//PostOffSetLifeForce(drain, old_value);
}
public static void PostOffSetLifeForce(Gene_LifeForce gene_LifeForce, float old_value)
public static void PostOffSetLifeForce(IGeneResourceDrain drain, float old_value)
{
if (old_value > 0.15f && gene_LifeForce.Resource.Value <= 0.15f)
if (old_value > 0.2f && drain.Resource.Value <= 0.2f)
{
Pawn pawn = gene_LifeForce.Pawn;
Pawn pawn = drain.Pawn;
//Give thoughtdef
//Do things
}
}

View File

@ -37,7 +37,7 @@ namespace RJW_Genes
if (GenitaliaChanger.IsArtificial(part))
continue;
if (rjw.Genital_Helper.is_penis(part))
if (Genital_Helper.is_penis(part))
{
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), part.Severity); ;
pawn.health.RemoveHediff(part);
@ -83,5 +83,17 @@ namespace RJW_Genes
}
return base.Valid(target, throwMessages);
}
public override bool GizmoDisabled(out string reason)
{
Pawn_GeneTracker genes = this.parent.pawn.genes;
Gene_LifeForce gene_LifeForce = (genes != null) ? genes.GetFirstGeneOfType<Gene_LifeForce>() : null;
if (gene_LifeForce == null)
{
reason = "AbilityDisabledNoFertilinGene".Translate(this.parent.pawn);
return true;
}
reason = null;
return false;
}
}
}

View File

@ -8,11 +8,9 @@ using Verse.AI;
using RimWorld;
namespace RJW_Genes
{
// Token: 0x02000F66 RID: 3942
public class CompAbilityEffect_LifeForceCost : CompAbilityEffect
{
// Token: 0x17000FFB RID: 4091
// (get) Token: 0x06005D18 RID: 23832 RVA: 0x001FA767 File Offset: 0x001F8967
public new CompProperties_AbilityLifeForceCost Props
{
get
@ -21,8 +19,6 @@ namespace RJW_Genes
}
}
// Token: 0x17000FFC RID: 4092
// (get) Token: 0x06005D19 RID: 23833 RVA: 0x001FA774 File Offset: 0x001F8974
private bool HasEnoughFertilin
{
get
@ -33,14 +29,13 @@ namespace RJW_Genes
}
}
// Token: 0x06005D1A RID: 23834 RVA: 0x001FA7B7 File Offset: 0x001F89B7
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), -this.Props.fertilinCost, true);
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), -this.Props.fertilinCost);
}
// Token: 0x06005D1B RID: 23835 RVA: 0x001FA7E0 File Offset: 0x001F89E0
public override bool GizmoDisabled(out string reason)
{
Pawn_GeneTracker genes = this.parent.pawn.genes;
@ -111,8 +106,7 @@ namespace RJW_Genes
}
return num2;
}
//Modified version of HemogenCost in Ability
}
}

View File

@ -6,18 +6,35 @@ using System.Threading.Tasks;
using UnityEngine;
using Verse;
using RimWorld;
using rjw;
namespace RJW_Genes
{
public class Gene_LifeForce : Gene_Resource, IGeneResourceDrain
{
public override void ExposeData()
//Gene should only be active if sex is allowed for this pawn
public override bool Active
{
base.ExposeData();
get
{
if (this.Overridden)
{
return false;
}
Pawn pawn = this.pawn;
return ((pawn != null) ? pawn.ageTracker : null) == null ||
((float)this.pawn.ageTracker.AgeBiologicalYears >= this.def.minAgeActive && this.pawn.ageTracker.AgeBiologicalYears >= (RJWSettings.AllowYouthSex ? 13f : 18f));
}
}
public bool ShouldConsumeLifeForceNow()
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look<bool>(ref this.StoredCumAllowed, "StoredCumAllowed", true, false);
}
public bool ShouldConsumeLifeForceNow()
{
return this.Value < this.targetValue;
}
@ -43,14 +60,7 @@ namespace RJW_Genes
//base.Tick();
if (this.CanOffset && this.Resource != null)
{
if (this.CanOffset)
{
if (this.Resource == null)
{
return;
}
GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000f);
}
GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000f);
//this.Resource.Value -= this.ResourceLossPerDay / 60000;
if (this.Resource.Value <= 0 && this.pawn.IsHashIntervalTick(300))
{
@ -62,11 +72,9 @@ namespace RJW_Genes
}
}
}
//GeneResourceDrainUtility.TickResourceDrain(this);
}
public bool StoredCumAllowed = true;
public Gene_Resource Resource
{
get
@ -117,7 +125,7 @@ namespace RJW_Genes
{
get
{
return 0.15f;
return 0.2f;
}
}
public override float MaxLevelOffset

View File

@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using Verse;
using RimWorld;
namespace RJW_Genes
{
public class Gene_LifeForceDrain : Gene, IGeneResourceDrain
{
public Gene_Resource Resource
{
get
{
if (this.cachedLifeForceGene == null || !this.cachedLifeForceGene.Active)
{
this.cachedLifeForceGene = this.pawn.genes.GetFirstGeneOfType<Gene_LifeForce>();
}
return this.cachedLifeForceGene;
}
}
public bool CanOffset
{
get
{
return this.Active && this.Resource != null && this.Resource.Active;
}
}
public float ResourceLossPerDay
{
get
{
return this.def.resourceLossPerDay;
}
}
public Pawn Pawn
{
get
{
return this.pawn;
}
}
public string DisplayLabel
{
get
{
return this.Label + " (" + "Gene".Translate() + ")";
}
}
public override void Tick()
{
base.Tick();
if (this.CanOffset && this.Resource != null)
{
GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000);
}
}
public override IEnumerable<Gizmo> GetGizmos()
{
foreach (Gizmo gizmo in GeneResourceDrainUtility.GetResourceDrainGizmos(this))
{
yield return gizmo;
}
IEnumerator<Gizmo> enumerator = null;
yield break;
yield break;
}
[Unsaved(false)]
private Gene_LifeForce cachedLifeForceGene;
private const float MinAgeForDrain = 3f;
}
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using RimWorld;
namespace RJW_Genes
{
public class Interaction_weights
{
public InteractionDef interaction;
public int weight = 1;
}
}

View File

@ -4,7 +4,6 @@ using Verse.AI;
using rjw;
namespace RJW_Genes
{
// Token: 0x020000FB RID: 251
public class LifeForceMentalStateWorker : MentalStateWorker
{
public override bool StateCanOccur(Pawn pawn)

View File

@ -114,17 +114,18 @@
<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\AbilityUtility.cs" />
<Compile Include="Genes\Life_Force\Abilities\AbilityUtility.cs" />
<Compile Include="Genes\Life_Force\Alert_LowFertilin.cs" />
<Compile Include="Genes\Life_Force\CompAbilityEffect_Seduce.cs" />
<Compile Include="Genes\Life_Force\CompAbilityEffect_LifeForceCost.cs" />
<Compile Include="Genes\Life_Force\CompAbilityEffect_CockEater.cs" />
<Compile Include="Genes\Life_Force\CompProperties_Seduce.cs" />
<Compile Include="Genes\Life_Force\CompProperties_AbilityCockEater.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_Seduce.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_LifeForceCost.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_CockEater.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompProperties_Seduce.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityCockEater.cs" />
<Compile Include="Genes\Life_Force\Gene_LifeForceDrain.cs" />
<Compile Include="Genes\Life_Force\IngestionOutcomeDoer_LifeForceOffset.cs" />
<Compile Include="Genes\Life_Force\JobDriver_SexOnSpotReceiver.cs" />
<Compile Include="Genes\Life_Force\JobDriver_SexOnSpot.cs" />
<Compile Include="Genes\Life_Force\JobDriver_Seduced.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_SexOnSpotReceiver.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_SexOnSpot.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_Seduced.cs" />
<Compile Include="Genes\Life_Force\Patch_SexTicks_ChangePsyfocus.cs" />
<Compile Include="Genes\Life_Force\ThinkNode_ConditionalLowLifeForce.cs" />
<Compile Include="Genes\Life_Force\ThinkNode_ConditionalCritcalLifeForce.cs" />
@ -133,14 +134,13 @@
<Compile Include="Genes\Special\Patch_AgeDrain.cs" />
<Compile Include="Genes\Special\Patch_Youth_Fountain.cs" />
<Compile Include="Interactions\CompAbility_SexInteractionRequirements.cs" />
<Compile Include="Genes\Life_Force\CompAbilityEffect_PussyHeal.cs" />
<Compile Include="Genes\Life_Force\CompProperties_AbilityLifeForceCost.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_PussyHeal.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityLifeForceCost.cs" />
<Compile Include="Interactions\CompProperties_SexInteractionRequirements.cs" />
<Compile Include="Genes\Life_Force\CompProperties_AbilityPussyHeal.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityPussyHeal.cs" />
<Compile Include="Genes\Life_Force\GeneGizmo_ResourceLifeForce.cs" />
<Compile Include="Genes\Life_Force\HediffWithComps_tank.cs" />
<Compile Include="Genes\Life_Force\Interactionchances.cs" />
<Compile Include="Genes\Life_Force\JobDriver_CastAbilityAfterSex.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_CastAbilityAfterSex.cs" />
<Compile Include="Genes\Life_Force\LifeForceMentalState.cs" />
<Compile Include="Genes\Life_Force\LifeForceMentalStateWorker.cs" />
<Compile Include="Genes\Life_Force\JobGiver_LifeForce_RandomRape.cs" />