First attempt at counter-inflation

This commit is contained in:
Vegapnk 2024-06-06 14:40:42 +02:00
parent 13b565fac6
commit 3feefaaab1
6 changed files with 276 additions and 3 deletions

View file

@ -0,0 +1,173 @@
<?xml version="1.0" encoding="utf-8" ?>
<Defs>
<HediffDef>
<defName>rjw_genes_cumflation_counter</defName>
<hediffClass>HediffWithComps</hediffClass>
<label>cumflation negator</label>
<labelNoun>cumflation negator</labelNoun>
<description>Negates the negative effects usually produced by being cumflated.</description>
<defaultLabelColor>(240,200,110)</defaultLabelColor>
<scenarioCanAdd>false</scenarioCanAdd>
<maxSeverity>1.0</maxSeverity>
<isBad>false</isBad>
<tendable>false</tendable>
<comps>
<li Class="HediffCompProperties_SeverityPerDay">
<severityPerDay>-0.75</severityPerDay>
</li>
</comps>
<stages>
<li>
<label>a little</label>
<becomeVisible>false</becomeVisible>
</li>
<li>
<label>slight</label>
<minSeverity>0.2</minSeverity>
<statOffsets>
<Vulnerability>-0.1</Vulnerability>
</statOffsets>
<capMods>
<li>
<capacity>Moving</capacity>
<offset>0.1</offset>
</li>
</capMods>
</li>
<li>
<label>moderate</label>
<minSeverity>0.4</minSeverity>
<statOffsets>
<Vulnerability>-0.3</Vulnerability>
</statOffsets>
<capMods>
<li>
<capacity>Moving</capacity>
<offset>0.3</offset>
</li>
</capMods>
<painOffset>-0.1</painOffset>
</li>
<li>
<label>intense</label>
<minSeverity>0.65</minSeverity>
<statOffsets>
<Vulnerability>+0.5</Vulnerability>
</statOffsets>
<capMods>
<li>
<capacity>Moving</capacity>
<offset>0.6</offset>
</li>
</capMods>
<painOffset>-0.3</painOffset>
</li>
<li>
<label>extreme</label>
<minSeverity>0.9</minSeverity>
<statOffsets>
<Vulnerability>-0.7</Vulnerability>
</statOffsets>
<capMods>
<li>
<capacity>Moving</capacity>
<offset>1.0</offset>
</li>
</capMods>
<painOffset>-0.5</painOffset>
</li>
</stages>
</HediffDef>
<HediffDef>
<defName>rjw_genes_cumstuffed_counter</defName>
<hediffClass>HediffWithComps</hediffClass>
<label>cumstuffed negator</label>
<labelNoun>cumstuffed negated</labelNoun>
<description>Negates the negative effects that one would suffer from being cumstuffed.</description>
<defaultLabelColor>(240,200,110)</defaultLabelColor>
<scenarioCanAdd>false</scenarioCanAdd>
<maxSeverity>1.0</maxSeverity>
<isBad>false</isBad>
<tendable>false</tendable>
<comps>
<li Class="HediffCompProperties_SeverityPerDay">
<severityPerDay>-0.75</severityPerDay>
</li>
<li Class="LicentiaLabs.Hediffs.HediffCompProperties_VomitCumMtb">
<mtbDaysPerStage>
<li>0</li>
<li>0</li>
<li>0.75</li>
<li>0.5</li>
<li>0.2</li>
</mtbDaysPerStage>
</li>
</comps>
<stages>
<li>
<label>slightly bloated</label>
<becomeVisible>false</becomeVisible>
</li>
<li>
<label>bloated</label>
<minSeverity>0.2</minSeverity>
<hungerRateFactor>0.95</hungerRateFactor>
<statOffsets>
<Vulnerability>-0.05</Vulnerability>
</statOffsets>
<capMods>
<li>
<capacity>Moving</capacity>
<offset>0.03</offset>
</li>
</capMods>
</li>
<li>
<label>full</label>
<minSeverity>0.4</minSeverity>
<hungerRateFactor>0.9</hungerRateFactor>
<statOffsets>
<Vulnerability>-0.1</Vulnerability>
</statOffsets>
<capMods>
<li>
<capacity>Moving</capacity>
<offset>0.1</offset>
</li>
</capMods>
</li>
<li>
<label>stuffed</label>
<minSeverity>0.6</minSeverity>
<hungerRateFactor>0.75</hungerRateFactor>
<statOffsets>
<Vulnerability>-0.15</Vulnerability>
</statOffsets>
<capMods>
<li>
<capacity>Moving</capacity>
<offset>0.2</offset>
</li>
</capMods>
<painOffset>-0.15</painOffset>
</li>
<li>
<label>overstuffed</label>
<minSeverity>0.8</minSeverity>
<hungerRateFactor>0.5</hungerRateFactor>
<statOffsets>
<Vulnerability>-0.2</Vulnerability>
</statOffsets>
<capMods>
<li>
<capacity>Moving</capacity>
<offset>0.3</offset>
</li>
</capMods>
<painOffset>-0.3</painOffset>
</li>
</stages>
</HediffDef>
</Defs>

View file

@ -18,7 +18,7 @@ namespace RJW_Genes
/// Patched File: https://gitgud.io/John-the-Anabaptist/licentia-labs/-/blob/master/Source/LicentiaLabs/LicentiaLabs/Cumflation.cs /// Patched File: https://gitgud.io/John-the-Anabaptist/licentia-labs/-/blob/master/Source/LicentiaLabs/LicentiaLabs/Cumflation.cs
/// </summary> /// </summary>
/// ///
class Patch_Cumflation class Patch_CumflationImmunity
{ {
// This patch does not need the normal Harmony Targetting, // This patch does not need the normal Harmony Targetting,
// as it needs to be added only on demand (See HarmonyInit.cs) // as it needs to be added only on demand (See HarmonyInit.cs)

View file

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using rjw;
using RimWorld;
using Verse;
using static LicentiaLabs.Licentia;
using static HarmonyLib.Code;
namespace RJW_Genes
{
/// <summary>
/// Changes LicentiaLabs (if Present) to add a cumflation-counter hediff, when the pawn is cumflated.
/// The counter hediff takes away the negative stats of the original hediff.
/// This code is exercised / loaded in the HarmonyInit.
/// Patched File: https://gitgud.io/John-the-Anabaptist/licentia-labs/-/blob/master/Source/LicentiaLabs/LicentiaLabs/Cumflation.cs
/// </summary>
///
class Patch_LikesCumflation
{
// This patch does not need the normal Harmony Targetting,
// as it needs to be added only on demand (See HarmonyInit.cs)
public static void PostFix(SexProps props)
{
if (props == null || props.pawn == null || props.partner == null) return;
if (props.pawn.genes != null && props.pawn.genes.HasActiveGene(GeneDefOf.rjw_genes_likes_cumflation) )
{
AddOrIncreaseCumflationCounterHediff(props.pawn);
}
if (props.partner.genes != null && props.partner.genes.HasActiveGene(GeneDefOf.rjw_genes_likes_cumflation))
{
AddOrIncreaseCumflationCounterHediff(props.partner);
}
}
public static void AddOrIncreaseCumflationCounterHediff(Pawn inflated)
{
//Hediff cumstuffed_hediff = inflated.health.hediffSet.GetFirstHediffOfDef(LicentiaLabs.Licentia.HediffDefs.Cumstuffed);
Hediff cumstuffed_hediff = LicentiaLabs.CumflationHelper.GetCumflationHediff(inflated, LicentiaLabs.Licentia.HediffDefs.Cumstuffed, "stomach");
if (cumstuffed_hediff != null && cumstuffed_hediff.Severity >= 0.01) {
ModLog.Message($"{inflated} got cumstuffed and gets the counter-part");
var bodyPartRecord = inflated.RaceProps.body.AllParts.Find(bpr => bpr.def.defName.Contains("stomach") || bpr.def.defName.Contains("stomach".ToLower()));
var counter_hediff = CreateOrGetCumflationCounterHediff(inflated, HediffDefOf.rjw_genes_cumstuffed_counter, bodyPartRecord);
counter_hediff.Severity = cumstuffed_hediff.Severity;
}
else if (cumstuffed_hediff != null)
{
ModLog.Message("cumstuffed_hediff was too un-sever");
}
else
ModLog.Message("cumstuffed_hediff was null");
Hediff cumflation_hediff = inflated.health.hediffSet.GetFirstHediffOfDef(LicentiaLabs.Licentia.HediffDefs.Cumflation);
if (cumflation_hediff != null && cumflation_hediff.Severity >= 0.01)
{
ModLog.Message($"{inflated} got cumflated and gets the counter-part");
var bodyPartRecord = Genital_Helper.get_genitalsBPR(inflated);
var counter_hediff = CreateOrGetCumflationCounterHediff(inflated, HediffDefOf.rjw_genes_cumstuffed_counter, bodyPartRecord);
counter_hediff.Severity = cumstuffed_hediff.Severity;
}
else if (cumflation_hediff != null)
{
ModLog.Message("Cumflation Hediff was too un-sever");
}
else
ModLog.Message("Cumflation Hediff was null");
}
public static Hediff CreateOrGetCumflationCounterHediff(Pawn inflated, HediffDef counterCumflationDef, BodyPartRecord bodyPartRecord)
{
Hediff cumflationHediff = inflated.health.hediffSet.GetFirstHediffOfDef(counterCumflationDef);
if (cumflationHediff == null)
{
cumflationHediff = HediffMaker.MakeHediff(counterCumflationDef, inflated, bodyPartRecord);
cumflationHediff.Severity = 0;
inflated.health.AddHediff(cumflationHediff, bodyPartRecord);
} else {
ModLog.Message("Did not find a correct Counter-CumflationDef ");
}
return cumflationHediff;
}
}
}

View file

@ -57,13 +57,16 @@ namespace RJW_Genes
{ {
// Gene: Cumflation Immunity [Prefix Patch] // Gene: Cumflation Immunity [Prefix Patch]
harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.Cumflation)), harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.Cumflation)),
prefix: new HarmonyMethod(typeof(Patch_Cumflation), nameof(Patch_Cumflation.Prefix))); prefix: new HarmonyMethod(typeof(Patch_CumflationImmunity), nameof(Patch_CumflationImmunity.Prefix)));
// Gene: Generous Donor [Postfix Patch] // Gene: Generous Donor [Postfix Patch]
harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.TransferNutrition)), harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.TransferNutrition)),
postfix: new HarmonyMethod(typeof(Patch_TransferNutrition), nameof(Patch_TransferNutrition.Postfix))); postfix: new HarmonyMethod(typeof(Patch_TransferNutrition), nameof(Patch_TransferNutrition.Postfix)));
// Gene: CumEater [Postfix Patch] -- This is not exactly licentia, but the Generous-Donor Gene is only active with Licentia // Gene: CumEater [Postfix Patch] -- This is not exactly licentia, but the Generous-Donor Gene is only active with Licentia
harmony.Patch(AccessTools.Method(typeof(rjw.JobDriver_Sex), nameof(rjw.JobDriver_Sex.ChangePsyfocus)), harmony.Patch(AccessTools.Method(typeof(rjw.JobDriver_Sex), nameof(rjw.JobDriver_Sex.ChangePsyfocus)),
postfix: new HarmonyMethod(typeof(Patch_SexTicks_ChangePsyfocus), nameof(Patch_SexTicks_ChangePsyfocus.Postfix))); postfix: new HarmonyMethod(typeof(Patch_SexTicks_ChangePsyfocus), nameof(Patch_SexTicks_ChangePsyfocus.Postfix)));
// Gene: Likes Cumflation [Postfix Patch]
harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.Cumflation)),
prefix: new HarmonyMethod(typeof(Patch_LikesCumflation), nameof(Patch_LikesCumflation.PostFix)));
} }
}))(); }))();
} }

View file

@ -20,6 +20,9 @@ namespace RJW_Genes
public static readonly HediffDef rjw_genes_orgasmic_mytosis_hediff; public static readonly HediffDef rjw_genes_orgasmic_mytosis_hediff;
public static readonly HediffDef rjw_genes_mytosis_shock_hediff; public static readonly HediffDef rjw_genes_mytosis_shock_hediff;
[MayRequire("LustLicentia.RJWLabs")] public static readonly HediffDef rjw_genes_cumstuffed_counter;
[MayRequire("LustLicentia.RJWLabs")] public static readonly HediffDef rjw_genes_cumflation_counter;
public static readonly HediffDef OvaryAgitator; public static readonly HediffDef OvaryAgitator;
public static readonly HediffDef Bioscaffold; public static readonly HediffDef Bioscaffold;
} }

View file

@ -71,6 +71,7 @@
<Compile Include="Genes\Breeding\AnimalBreedingHelper.cs" /> <Compile Include="Genes\Breeding\AnimalBreedingHelper.cs" />
<Compile Include="Genes\Breeding\Genes\Gene_FerventOvipositor.cs" /> <Compile Include="Genes\Breeding\Genes\Gene_FerventOvipositor.cs" />
<Compile Include="Genes\Breeding\Genes\Gene_InsectIncubator.cs" /> <Compile Include="Genes\Breeding\Genes\Gene_InsectIncubator.cs" />
<Compile Include="Genes\Cum\Patch_LikesCumflation.cs" />
<Compile Include="Genes\Damage\Gene_Elasticity.cs" /> <Compile Include="Genes\Damage\Gene_Elasticity.cs" />
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusVisit.cs" /> <Compile Include="Genes\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusVisit.cs" />
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" /> <Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" />
@ -93,7 +94,7 @@
<Compile Include="Genes\Cum\Gene_NoCum.cs" /> <Compile Include="Genes\Cum\Gene_NoCum.cs" />
<Compile Include="Genes\Cum\Patch_TransferNutrition.cs" /> <Compile Include="Genes\Cum\Patch_TransferNutrition.cs" />
<Compile Include="Genes\Damage\Gene_Unbreakable.cs" /> <Compile Include="Genes\Damage\Gene_Unbreakable.cs" />
<Compile Include="Genes\Cum\Patch_Cumflation.cs" /> <Compile Include="Genes\Cum\Patch_CumflationImmunity.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_ExtraBreasts.cs" /> <Compile Include="Genes\ExtraGenitalia\Gene_ExtraBreasts.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_ExtraAnus.cs" /> <Compile Include="Genes\ExtraGenitalia\Gene_ExtraAnus.cs" />
<Compile Include="Genes\ExtraGenitalia\Gene_Futa.cs" /> <Compile Include="Genes\ExtraGenitalia\Gene_Futa.cs" />