mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Added a simple genetic disease that resets the sex need to 0.1
This commit is contained in:
parent
b56c0105a6
commit
aadf7795c0
4 changed files with 88 additions and 9 deletions
|
@ -165,4 +165,25 @@
|
|||
</modExtensions>
|
||||
</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>
|
|
@ -124,6 +124,8 @@ namespace RJW_Genes
|
|||
// Diseases
|
||||
public static readonly GeneDef rjw_genes_genetic_disease_immunity;
|
||||
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
|
||||
public static readonly XenotypeDef rjw_genes_succubus;
|
||||
|
|
57
Source/Genes/Diseases/Genes/Gene_FluctualSexualNeed.cs
Normal file
57
Source/Genes/Diseases/Genes/Gene_FluctualSexualNeed.cs
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -76,6 +76,7 @@
|
|||
<Compile Include="Genes\Cum\Patch_LikesCumflation.cs" />
|
||||
<Compile Include="Genes\Damage\Gene_Elasticity.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\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusVisit.cs" />
|
||||
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" />
|
||||
|
@ -239,9 +240,7 @@
|
|||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Genes\Diseases\Genes\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue