Drainers cannot be drained - increased negative effects of drain

This commit is contained in:
Vegapnk 2023-01-22 16:38:48 +01:00
parent 0261ec87f8
commit 38e7b32dba
3 changed files with 38 additions and 18 deletions

View file

@ -78,7 +78,7 @@
<defName>rjw_genes_cockeater</defName> <defName>rjw_genes_cockeater</defName>
<label>Cockeater</label> <label>Cockeater</label>
<labelShortAdj>cockeater</labelShortAdj> <labelShortAdj>cockeater</labelShortAdj>
<description>Carriers of this gene are able eat cocks to restore their fertilin supply.</description> <description>Carriers of this gene are able eat cocks to restore their fertilin supply. Cocks are consumed during that process.</description>
<iconPath>Things/Mote/Heart</iconPath> <iconPath>Things/Mote/Heart</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite> <prerequisite>rjw_genes_lifeforce</prerequisite>
<displayOrderInCategory>11</displayOrderInCategory> <displayOrderInCategory>11</displayOrderInCategory>
@ -154,7 +154,7 @@
<GeneDef> <GeneDef>
<defName>rjw_genes_cum_eater</defName> <defName>rjw_genes_cum_eater</defName>
<label>Cum eater</label> <label>Cum eater</label>
<description>Carriers of this gene are able to absorb fertilin through eating cum.</description> <description>Carriers of this gene are able to absorb fertilin through eating cum. This includes oral sex, eating cum for food or sucking out cumflated pawns. </description>
<iconPath>Things/Mote/Heart</iconPath> <iconPath>Things/Mote/Heart</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite> <prerequisite>rjw_genes_lifeforce</prerequisite>
<displayOrderInCategory>1</displayOrderInCategory> <displayOrderInCategory>1</displayOrderInCategory>
@ -187,7 +187,7 @@
<GeneDef> <GeneDef>
<defName>rjw_genes_drainer</defName> <defName>rjw_genes_drainer</defName>
<label>vitality drainer</label> <label>vitality drainer</label>
<description>Carriers of this gene are able to absorb a great amount of fertilin by draining the vitality of the partner.</description> <description>Carriers of this gene are able to absorb a great amount of fertilin by draining the vitality of the partner. This is done passively through having sex with a non-drained pawn that does not have this gene.</description>
<iconPath>Things/Mote/Heart</iconPath> <iconPath>Things/Mote/Heart</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite> <prerequisite>rjw_genes_lifeforce</prerequisite>
<displayOrderInCategory>4</displayOrderInCategory> <displayOrderInCategory>4</displayOrderInCategory>

View file

@ -45,13 +45,13 @@
<defName>rjw_genes_succubus_drained</defName> <defName>rjw_genes_succubus_drained</defName>
<hediffClass>HediffWithComps</hediffClass> <hediffClass>HediffWithComps</hediffClass>
<label>Drained</label> <label>Drained</label>
<description>The vitality of this pawn has been drained.</description> <description>The vitality of this pawn has been drained. Cannot be drained again until fully recovered.</description>
<defaultLabelColor>(1,0,0.5)</defaultLabelColor> <defaultLabelColor>(1,0,0.5)</defaultLabelColor>
<maxSeverity>1.0</maxSeverity> <maxSeverity>1.0</maxSeverity>
<initialSeverity>1.0</initialSeverity> <initialSeverity>1.0</initialSeverity>
<comps> <comps>
<li Class="HediffCompProperties_SeverityPerDay"> <li Class="HediffCompProperties_SeverityPerDay">
<severityPerDay>-1.0</severityPerDay> <severityPerDay>-0.25</severityPerDay>
</li> </li>
</comps> </comps>
<stages> <stages>
@ -63,6 +63,10 @@
<offset>-0.1</offset> <offset>-0.1</offset>
</li> </li>
</capMods> </capMods>
<restFallFactorOffset>0.1</restFallFactorOffset>
<statOffsets>
<WorkSpeedGlobal>-0.1</WorkSpeedGlobal>
</statOffsets>
</li> </li>
<li> <li>
<minSeverity>0.5</minSeverity> <minSeverity>0.5</minSeverity>
@ -73,6 +77,11 @@
<offset>-0.2</offset> <offset>-0.2</offset>
</li> </li>
</capMods> </capMods>
<hungerRateFactorOffset>0.05</hungerRateFactorOffset>
<restFallFactorOffset>0.20</restFallFactorOffset>
<statOffsets>
<WorkSpeedGlobal>-0.1</WorkSpeedGlobal>
</statOffsets>
</li> </li>
<li> <li>
<minSeverity>0.8</minSeverity> <minSeverity>0.8</minSeverity>
@ -80,9 +89,15 @@
<capMods> <capMods>
<li> <li>
<capacity>Consciousness</capacity> <capacity>Consciousness</capacity>
<offset>-0.4</offset> <offset>-0.3</offset>
</li> </li>
</capMods> </capMods>
<statOffsets>
<WorkSpeedGlobal>-0.2</WorkSpeedGlobal>
</statOffsets>
<vomitMtbDays>0.05</vomitMtbDays>
<hungerRateFactorOffset>0.1</hungerRateFactorOffset>
<restFallFactorOffset>0.35</restFallFactorOffset>
</li> </li>
</stages> </stages>
</HediffDef> </HediffDef>

View file

@ -1,12 +1,8 @@
using HarmonyLib; using HarmonyLib;
using rjw; using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld; using RimWorld;
using Verse; using Verse;
namespace RJW_Genes namespace RJW_Genes
{ {
/// <summary> /// <summary>
@ -16,6 +12,8 @@ namespace RJW_Genes
[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))] [HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))]
public static class Patch_SatisfyPersonal_LifeForceGain public static class Patch_SatisfyPersonal_LifeForceGain
{ {
public const float LIFEFORCE_GAINED_FROM_DRAINER_GENE = 0.25f;
public static void Postfix(SexProps props) public static void Postfix(SexProps props)
{ {
// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation) // ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation)
@ -31,7 +29,6 @@ namespace RJW_Genes
//Summary// //Summary//
//We use the positions of the pawn (dom or sub) and based on that which interactions will transfer fertilin //We use the positions of the pawn (dom or sub) and based on that which interactions will transfer fertilin
//By checking isreceiver we know if the succubus is the dom or the sub and if the situation is reverse we also swap the function we use //By checking isreceiver we know if the succubus is the dom or the sub and if the situation is reverse we also swap the function we use
//
float absorb_factor = 0f; float absorb_factor = 0f;
if (GeneUtility.HasLifeForce(props.partner)) if (GeneUtility.HasLifeForce(props.partner))
{ {
@ -70,10 +67,16 @@ namespace RJW_Genes
TransferFertilin(props, absorb_factor); TransferFertilin(props, absorb_factor);
} }
if (GeneUtility.HasGeneNullCheck(PawnWithLifeForce, GeneDefOf.rjw_genes_drainer) && !props.pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_succubus_drained)) // Handle Gene: Sexual_Drainer
// to be drained, a pawn must not-be-drained-already and drainers cannot be drained either.
if (GeneUtility.IsSexualDrainer(PawnWithLifeForce)
&& !props.pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_succubus_drained)
&& !GeneUtility.IsSexualDrainer(props.pawn))
{ {
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
ModLog.Message($"{props.pawn.Name} has been (sexually) drained by {PawnWithLifeForce.Name}");
props.pawn.health.AddHediff(HediffDefOf.rjw_genes_succubus_drained); props.pawn.health.AddHediff(HediffDefOf.rjw_genes_succubus_drained);
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(PawnWithLifeForce), 0.25f); GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(PawnWithLifeForce), LIFEFORCE_GAINED_FROM_DRAINER_GENE);
} }
} }
} }
@ -82,6 +85,7 @@ namespace RJW_Genes
{ {
Pawn_GeneTracker genes = props.partner.genes; Pawn_GeneTracker genes = props.partner.genes;
Gene_LifeForce gene = genes.GetFirstGeneOfType<Gene_LifeForce>(); Gene_LifeForce gene = genes.GetFirstGeneOfType<Gene_LifeForce>();
Hediff fertilin_lost = props.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_fertilin_lost); Hediff fertilin_lost = props.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_fertilin_lost);
//Around quarter get ejected everytime pawn cums //Around quarter get ejected everytime pawn cums
float multiplier = Rand.Range(0.10f, 0.40f); float multiplier = Rand.Range(0.10f, 0.40f);
@ -106,11 +110,12 @@ namespace RJW_Genes
if (props.partner.IsAnimal()) if (props.partner.IsAnimal())
{ {
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
ModLog.Message($"Fertilin-Source of {props.pawn.Name} was an Animal, Fertilin-Gain is being adjusted by {RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor}%");
valuechange *= RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor; valuechange *= RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor;
} }
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(props.partner), valuechange); GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(props.partner), valuechange);
//gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier;
} }
public static float TotalFertilinAmount(SexProps props, float multiplier) public static float TotalFertilinAmount(SexProps props, float multiplier)
@ -139,7 +144,7 @@ namespace RJW_Genes
public static float BaseDom(SexProps props, Pawn PawnWithLifeForce) public static float BaseDom(SexProps props, Pawn PawnWithLifeForce)
{ {
float absorb_factor = 0f; float absorb_factor = 0f;
if (props.sexType == xxx.rjwSextype.Sixtynine && GeneUtility.HasGeneNullCheck(PawnWithLifeForce, GeneDefOf.rjw_genes_cum_eater)) if (props.sexType == xxx.rjwSextype.Sixtynine && GeneUtility.IsCumEater(PawnWithLifeForce))
{ {
absorb_factor += 1f; absorb_factor += 1f;
} }
@ -156,7 +161,7 @@ namespace RJW_Genes
{ {
float absorb_factor = 0f; float absorb_factor = 0f;
if ((props.sexType == xxx.rjwSextype.Oral || props.sexType == xxx.rjwSextype.Fellatio || props.sexType == xxx.rjwSextype.Sixtynine) if ((props.sexType == xxx.rjwSextype.Oral || props.sexType == xxx.rjwSextype.Fellatio || props.sexType == xxx.rjwSextype.Sixtynine)
&& GeneUtility.HasGeneNullCheck(PawnWithLifeForce, GeneDefOf.rjw_genes_cum_eater)) && GeneUtility.IsCumEater(PawnWithLifeForce))
{ {
absorb_factor += 1f; absorb_factor += 1f;
} }