diff --git a/Common/Assemblies/Rjw-Genes.dll b/Common/Assemblies/Rjw-Genes.dll index 1a16956..f579951 100644 Binary files a/Common/Assemblies/Rjw-Genes.dll and b/Common/Assemblies/Rjw-Genes.dll differ diff --git a/Common/Defs/ThinkTreeDefs/ThinkTrees_LifeForce.xml b/Common/Defs/ThinkTreeDefs/ThinkTrees_LifeForce.xml index 7258915..574fe0f 100644 --- a/Common/Defs/ThinkTreeDefs/ThinkTrees_LifeForce.xml +++ b/Common/Defs/ThinkTreeDefs/ThinkTrees_LifeForce.xml @@ -23,7 +23,13 @@
  • -
  • + +
  • + 8 + +
  • + +
  • diff --git a/Common/Defs/ThoughtDefs/Thoughts_LifeForce.xml b/Common/Defs/ThoughtDefs/Thoughts_LifeForce.xml index 16b32a1..bca1f93 100644 --- a/Common/Defs/ThoughtDefs/Thoughts_LifeForce.xml +++ b/Common/Defs/ThoughtDefs/Thoughts_LifeForce.xml @@ -25,7 +25,18 @@
  • - I was seduced into having sex. I regrett what happened. + I was seduced into having sex. I regret what happened. + -10 +
  • + + + + + rjw_critical_fertilin + +
  • + + I'm almost out of fertilin. I'm scared of losing control. -10
  • diff --git a/Common/Languages/English/Keyed/Lifeforce.xml b/Common/Languages/English/Keyed/Lifeforce.xml new file mode 100644 index 0000000..23d3f75 --- /dev/null +++ b/Common/Languages/English/Keyed/Lifeforce.xml @@ -0,0 +1,10 @@ + + + + Pawn doesn't have required fertilin gene. + Not enough fertilin to cast. + + + Low fertilin + A colonist has low fertilin. At this point they are becoming desperate enough to consider rape and bestiality to obtain fertilin (if they didn't already). At zero fertilin they will lose all sense and start raping randomly + \ No newline at end of file diff --git a/Source/GeneDefOf.cs b/Source/GeneDefOf.cs index 2bd18c2..1550c5b 100644 --- a/Source/GeneDefOf.cs +++ b/Source/GeneDefOf.cs @@ -82,10 +82,10 @@ namespace RJW_Genes // Cosmetic public static readonly GeneDef rjw_genes_succubus_tail; + + public static readonly GeneDef rjw_genes_youth_fountain; public static readonly GeneDef rjw_genes_sex_age_drain; - - public static readonly HediffDef rjw_genes_orgasm_rush_hediff; } } diff --git a/Source/Genes/GeneUtility.cs b/Source/Genes/GeneUtility.cs index 3a81943..68e2969 100644 --- a/Source/Genes/GeneUtility.cs +++ b/Source/Genes/GeneUtility.cs @@ -15,21 +15,31 @@ namespace RJW_Genes return pawn.genes.HasGene(genedef); } - public static void OffsetLifeForce(Pawn pawn, float offset, bool applyStatFactor = true) + //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) { - if (!ModsConfig.BiotechActive) - { - return; - } - //if (offset > 0f && applyStatFactor) - //{ - // offset *= pawn.GetStatValue(StatDefOf.HemogenGainFactor, true, -1); - //} Pawn_GeneTracker genes2 = pawn.genes; - Gene_LifeForce gene_LifeFroce = (genes2 != null) ? genes2.GetFirstGeneOfType() : null; - if (gene_LifeFroce != null) + Gene_LifeForce gene_LifeForce = (genes2 != null) ? genes2.GetFirstGeneOfType() : null; + return gene_LifeForce; + } + + public static void OffsetLifeForce(Gene_LifeForce gene_LifeForce, float offset, bool applyStatFactor = true) + { + if (gene_LifeForce != null) { - gene_LifeFroce.Value += offset; + float old_value = gene_LifeForce.Value; + gene_LifeForce.Value += offset; + PostOffSetLifeForce(gene_LifeForce, old_value); + } + } + + public static void PostOffSetLifeForce(Gene_LifeForce gene_LifeForce, float old_value) + { + if (old_value > 0.15f && gene_LifeForce.Resource.Value <= 0.15f) + { + Pawn pawn = gene_LifeForce.Pawn; + + //Give thoughtdef } } diff --git a/Source/Genes/Life_Force/Alert_LowFertilin.cs b/Source/Genes/Life_Force/Alert_LowFertilin.cs new file mode 100644 index 0000000..2fb9fdc --- /dev/null +++ b/Source/Genes/Life_Force/Alert_LowFertilin.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RimWorld.Planet; +using Verse; +using RimWorld; +namespace RJW_Genes +{ + public class Alert_CriticalFertilin : Alert + { + private List Targets + { + get + { + this.CalculateTargets(); + return this.targets; + } + } + + public override string GetLabel() + { + if (this.Targets.Count == 1) + { + return "AlertLowFertilin".Translate() + ": " + this.targetLabels[0]; + } + return "AlertLowFertilin".Translate(); + } + + private void CalculateTargets() + { + this.targets.Clear(); + this.targetLabels.Clear(); + if (!ModsConfig.BiotechActive) + { + return; + } + foreach (Pawn pawn in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive) + { + if (pawn.RaceProps.Humanlike && pawn.Faction == Faction.OfPlayer) + { + Pawn_GeneTracker genes = pawn.genes; + Gene_LifeForce gene_Lifeforce = (genes != null) ? genes.GetFirstGeneOfType() : null; + if (gene_Lifeforce != null && gene_Lifeforce.Value < gene_Lifeforce.MinLevelForAlert) + { + this.targets.Add(pawn); + this.targetLabels.Add(pawn.NameShortColored.Resolve()); + } + } + } + } + + public override TaggedString GetExplanation() + { + return "AlertLowFertilinDesc".Translate() + ":\n" + this.targetLabels.ToLineList(" - "); + } + + public override AlertReport GetReport() + { + return AlertReport.CulpritsAre(this.Targets); + } + + // Token: 0x04004B5C RID: 19292 + private List targets = new List(); + + // Token: 0x04004B5D RID: 19293 + private List targetLabels = new List(); + } +} diff --git a/Source/Genes/Life_Force/CompAbilityEffect_CockEater.cs b/Source/Genes/Life_Force/CompAbilityEffect_CockEater.cs index deddbce..88d0dad 100644 --- a/Source/Genes/Life_Force/CompAbilityEffect_CockEater.cs +++ b/Source/Genes/Life_Force/CompAbilityEffect_CockEater.cs @@ -39,7 +39,7 @@ namespace RJW_Genes if (rjw.Genital_Helper.is_penis(part)) { - GeneUtility.OffsetLifeForce(this.parent.pawn, part.Severity); ; + GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), part.Severity); ; pawn.health.RemoveHediff(part); pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.rjw_genes_cock_eaten, pawn, null); break; //Only one penis at the time diff --git a/Source/Genes/Life_Force/CompAbilityEffect_LifeForceCost.cs b/Source/Genes/Life_Force/CompAbilityEffect_LifeForceCost.cs index 70f9e40..363b414 100644 --- a/Source/Genes/Life_Force/CompAbilityEffect_LifeForceCost.cs +++ b/Source/Genes/Life_Force/CompAbilityEffect_LifeForceCost.cs @@ -37,7 +37,7 @@ namespace RJW_Genes public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) { base.Apply(target, dest); - GeneUtility.OffsetLifeForce(this.parent.pawn, -this.Props.fertilinCost, true); + GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), -this.Props.fertilinCost, true); } // Token: 0x06005D1B RID: 23835 RVA: 0x001FA7E0 File Offset: 0x001F89E0 diff --git a/Source/Genes/Life_Force/CompAbilityEffect_Seduce.cs b/Source/Genes/Life_Force/CompAbilityEffect_Seduce.cs index bf0643d..678ab48 100644 --- a/Source/Genes/Life_Force/CompAbilityEffect_Seduce.cs +++ b/Source/Genes/Life_Force/CompAbilityEffect_Seduce.cs @@ -26,8 +26,8 @@ namespace RJW_Genes Pawn pawn2 = this.parent.pawn; if (pawn != null && pawn2 != null && !pawn.Downed) { - Job job = JobMaker.MakeJob(JobDefOf.rjw_genes_lifeforce_seduced, pawn2);//ChooseJob(pawn, pawn2); - job.mote = MoteMaker.MakeThoughtBubble(pawn, this.parent.def.iconPath, true); //make this image of pawn or else heart + Job job = JobMaker.MakeJob(JobDefOf.rjw_genes_lifeforce_seduced, pawn2); + job.mote = MoteMaker.MakeThoughtBubble(pawn, this.parent.def.iconPath, true); pawn.jobs.StopAll(false, true); pawn.jobs.StartJob(job, JobCondition.InterruptForced, null, false, true, null, null, false, false, null, false, true); } diff --git a/Source/Genes/Life_Force/Gene_LifeForce.cs b/Source/Genes/Life_Force/Gene_LifeForce.cs index dcb61d1..da5c65b 100644 --- a/Source/Genes/Life_Force/Gene_LifeForce.cs +++ b/Source/Genes/Life_Force/Gene_LifeForce.cs @@ -43,7 +43,15 @@ namespace RJW_Genes //base.Tick(); if (this.CanOffset && this.Resource != null) { - this.Resource.Value -= this.ResourceLossPerDay / 60000; + if (this.CanOffset) + { + if (this.Resource == null) + { + return; + } + GeneUtility.OffsetLifeForce(this, -this.ResourceLossPerDay / 60000f); + } + //this.Resource.Value -= this.ResourceLossPerDay / 60000; if (this.Resource.Value <= 0 && this.pawn.IsHashIntervalTick(300)) { if (ModsConfig.BiotechActive && this.def.mentalBreakDef != null && diff --git a/Source/Genes/Life_Force/IngestionOutcomeDoer_LifeForceOffset.cs b/Source/Genes/Life_Force/IngestionOutcomeDoer_LifeForceOffset.cs index 2a22097..65e458e 100644 --- a/Source/Genes/Life_Force/IngestionOutcomeDoer_LifeForceOffset.cs +++ b/Source/Genes/Life_Force/IngestionOutcomeDoer_LifeForceOffset.cs @@ -15,7 +15,7 @@ namespace RJW_Genes if (GeneUtility.HasLifeForce(pawn)) { float num = ingested.stackCount * this.FertilinPerUnit / 100; - GeneUtility.OffsetLifeForce(pawn, num); + GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(pawn), num); } } public float FertilinPerUnit = 1f; diff --git a/Source/Genes/Life_Force/Patch_LifeForce.cs b/Source/Genes/Life_Force/Patch_LifeForce.cs index 1d63ce5..f4eb817 100644 --- a/Source/Genes/Life_Force/Patch_LifeForce.cs +++ b/Source/Genes/Life_Force/Patch_LifeForce.cs @@ -71,7 +71,7 @@ namespace RJW_Genes if (GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_drainer) && !props.pawn.health.hediffSet.HasHediff(HediffDefOf.Succubus_Drained)) { props.pawn.health.AddHediff(HediffDefOf.Succubus_Drained); - GeneUtility.OffsetLifeForce(succubus, 0.25f); + GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(succubus), 0.25f); } } } @@ -103,7 +103,7 @@ namespace RJW_Genes } //Currently taking the sum of all penises, maybe I should just consider one at random float valuechange = CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier; - GeneUtility.OffsetLifeForce(props.partner, valuechange); + GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(props.partner), valuechange); //gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier; } diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index be3ba24..2ad19b6 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -27,14 +27,14 @@ False - ..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll + ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\licentia-labs-master\Assemblies\LicentiaLabs.dll False - ..\..\rjw\1.4\Assemblies\RJW.dll + ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\rjw-master\1.4\Assemblies\RJW.dll @@ -49,11 +49,11 @@ - ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll + ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll False - ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll + ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll @@ -115,6 +115,7 @@ + @@ -128,6 +129,9 @@ + + + diff --git a/Source/ThoughtDefOf.cs b/Source/ThoughtDefOf.cs index 9eeef8b..02a4aac 100644 --- a/Source/ThoughtDefOf.cs +++ b/Source/ThoughtDefOf.cs @@ -12,5 +12,6 @@ namespace RJW_Genes { public static readonly ThoughtDef rjw_genes_cock_eaten; public static readonly ThoughtDef rjw_genes_seduced; + public static readonly ThoughtDef rjw_critical_fertilin; } }