Added a simple genetic disease that resets the sex need to 0.1

This commit is contained in:
Vegapnk 2024-07-03 12:18:17 +02:00
parent b56c0105a6
commit aadf7795c0
4 changed files with 88 additions and 9 deletions

View file

@ -20,7 +20,7 @@
<marketValueFactor>0.95</marketValueFactor> <marketValueFactor>0.95</marketValueFactor>
<label>genetic disease immunity</label> <label>genetic disease immunity</label>
<description>This gene makes the pawn immune against genetic STDs and some other genes that <description>This gene makes the pawn immune against genetic STDs and some other genes that
imply negative side-effects. </description> imply negative side-effects.</description>
<biostatCpx>1</biostatCpx> <biostatCpx>1</biostatCpx>
<biostatMet>-1</biostatMet> <biostatMet>-1</biostatMet>
<iconPath>UI/Icons/Rituals/TrialDefend</iconPath> <iconPath>UI/Icons/Rituals/TrialDefend</iconPath>
@ -38,7 +38,7 @@
<defName>rjw_genes_minor_vulnerability</defName> <defName>rjw_genes_minor_vulnerability</defName>
<label>minor vulnerability</label> <label>minor vulnerability</label>
<description>This gene makes the pawn a bit more vulnerable, and a slightly more attractive <description>This gene makes the pawn a bit more vulnerable, and a slightly more attractive
target for rape. </description> target for rape.</description>
<biostatCpx>1</biostatCpx> <biostatCpx>1</biostatCpx>
<biostatMet>1</biostatMet> <biostatMet>1</biostatMet>
<marketValueFactor>0.85</marketValueFactor> <marketValueFactor>0.85</marketValueFactor>
@ -64,7 +64,7 @@
<defName>rjw_genes_major_vulnerability</defName> <defName>rjw_genes_major_vulnerability</defName>
<label>major vulnerability</label> <label>major vulnerability</label>
<description>This gene makes the pawn more vulnerable, and a more attractive target for <description>This gene makes the pawn more vulnerable, and a more attractive target for
rape. </description> rape.</description>
<biostatCpx>2</biostatCpx> <biostatCpx>2</biostatCpx>
<biostatMet>1</biostatMet> <biostatMet>1</biostatMet>
<iconPath>UI/Icons/ColonistBar/Idle</iconPath> <iconPath>UI/Icons/ColonistBar/Idle</iconPath>
@ -89,7 +89,7 @@
<defName>rjw_genes_infectious_hypersexuality</defName> <defName>rjw_genes_infectious_hypersexuality</defName>
<label>infectious hypersexuality</label> <label>infectious hypersexuality</label>
<description>This gene makes the pawn hypersexual, and has a chance to spread on <description>This gene makes the pawn hypersexual, and has a chance to spread on
intercourse. </description> intercourse.</description>
<iconPath>Genes/Icons/Hypersexual</iconPath> <iconPath>Genes/Icons/Hypersexual</iconPath>
<biostatCpx>2</biostatCpx> <biostatCpx>2</biostatCpx>
<biostatMet>2</biostatMet> <biostatMet>2</biostatMet>
@ -114,7 +114,7 @@
<GeneDef ParentName="RJWGeneDisease"> <GeneDef ParentName="RJWGeneDisease">
<defName>rjw_genes_infectious_bisexuality</defName> <defName>rjw_genes_infectious_bisexuality</defName>
<label>infectious bisexuality</label> <label>infectious bisexuality</label>
<description>This gene makes the pawn bisexual, and has a chance to spread on intercourse. </description> <description>This gene makes the pawn bisexual, and has a chance to spread on intercourse.</description>
<iconPath>UI\Ideoligions\Universal\RoundC</iconPath> <iconPath>UI\Ideoligions\Universal\RoundC</iconPath>
<biostatCpx>1</biostatCpx> <biostatCpx>1</biostatCpx>
<biostatMet>0</biostatMet> <biostatMet>0</biostatMet>
@ -141,7 +141,7 @@
<GeneDef ParentName="RJWGeneDisease"> <GeneDef ParentName="RJWGeneDisease">
<defName>rjw_genes_infectious_homosexuality</defName> <defName>rjw_genes_infectious_homosexuality</defName>
<label>infectious homosexuality</label> <label>infectious homosexuality</label>
<description>This gene makes the pawn homosexual, and has a chance to spread on intercourse. </description> <description>This gene makes the pawn homosexual, and has a chance to spread on intercourse.</description>
<iconPath>UI\Ideoligions\Universal\RoundC</iconPath> <iconPath>UI\Ideoligions\Universal\RoundC</iconPath>
<biostatCpx>1</biostatCpx> <biostatCpx>1</biostatCpx>
<biostatMet>0</biostatMet> <biostatMet>0</biostatMet>
@ -165,4 +165,25 @@
</modExtensions> </modExtensions>
</GeneDef> </GeneDef>
<GeneDef ParentName="RJWGeneDisease">
<defName>rjw_genes_fluctual_sexual_needs</defName>
<label>fluctual sexual needs</label>
<description>Carriers of this genetic disease have a chance to suddenly require sex, gaining a bit of energy to find quick relief.</description>
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
<biostatCpx>1</biostatCpx>
<biostatMet>2</biostatMet>
<displayOrderInCategory>11</displayOrderInCategory>
<geneClass>RJW_Genes.Gene_FluctualSexualNeed</geneClass>
<modExtensions>
<li Class="RJW_Genes.GeneticDiseaseExtension">
<infectionChance>0.1</infectionChance>
</li>
<li Class="RJW_Genes.TickBasedChanceExtension">
<!-- 30k = 1/2 days -->
<tickInterval>30000</tickInterval>
<eventChance>0.15</eventChance>
</li>
</modExtensions>
</GeneDef>
</Defs> </Defs>

View file

@ -124,6 +124,8 @@ namespace RJW_Genes
// Diseases // Diseases
public static readonly GeneDef rjw_genes_genetic_disease_immunity; public static readonly GeneDef rjw_genes_genetic_disease_immunity;
public static readonly GeneDef rjw_genes_minor_vulnerability; public static readonly GeneDef rjw_genes_minor_vulnerability;
public static readonly GeneDef rjw_genes_major_vulnerability;
public static readonly GeneDef rjw_genes_fluctual_sexual_needs;
//Other Defs //Other Defs
public static readonly XenotypeDef rjw_genes_succubus; public static readonly XenotypeDef rjw_genes_succubus;

View file

@ -0,0 +1,57 @@
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using static HarmonyLib.Code;
using static RimWorld.ColonistBar;
namespace RJW_Genes
{
public class Gene_FluctualSexualNeed : Gene
{
int event_interval;
float event_chance;
const float REST_INCREASE = 0.1f;
const float SET_SEXNEED_TO = 0.1f;
public Gene_FluctualSexualNeed() : base()
{
TickBasedChanceExtension tickbasedChanceExt = GeneDefOf.rjw_genes_fluctual_sexual_needs.GetModExtension<TickBasedChanceExtension>();
event_interval = tickbasedChanceExt?.tickInterval ?? 30000; // 30K = 1/2 day
event_chance = tickbasedChanceExt?.eventChance ?? 0.1f;
}
public override void Tick()
{
base.Tick();
if (pawn.IsHashIntervalTick(event_interval) && (new Random()).NextDouble() < event_chance)
{
ModLog.Debug($"Firing Gene_FluctualSexualNeed for {pawn}");
ApplyFluctualSexNeedEffect(pawn);
}
}
public static void ApplyFluctualSexNeedEffect(Pawn pawn)
{
if (pawn == null || pawn.needs == null) return;
var sexneed = pawn.needs.TryGetNeed<rjw.Need_Sex>();
if (sexneed != null)
{
sexneed.CurLevelPercentage = SET_SEXNEED_TO;
}
// Pump up Wake-Ness
if (pawn.needs.rest != null)
pawn.needs.rest.CurLevel += REST_INCREASE;
}
}
}

View file

@ -76,6 +76,7 @@
<Compile Include="Genes\Cum\Patch_LikesCumflation.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\Diseases\Defs\GeneticDiseaseExtension.cs" /> <Compile Include="Genes\Diseases\Defs\GeneticDiseaseExtension.cs" />
<Compile Include="Genes\Diseases\Genes\Gene_FluctualSexualNeed.cs" />
<Compile Include="Genes\Diseases\Patches\Patch_AftersexUtility_TransferGeneticDiseases.cs" /> <Compile Include="Genes\Diseases\Patches\Patch_AftersexUtility_TransferGeneticDiseases.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" />
@ -239,9 +240,7 @@
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Folder Include="Genes\Diseases\Genes\" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<WCFMetadata Include="Connected Services\" /> <WCFMetadata Include="Connected Services\" />
</ItemGroup> </ItemGroup>