mirror of
https://github.com/vegapnk/RJW-Genes.git
synced 2024-08-15 00:23:31 +00:00
Compare commits
No commits in common. "b12e9afbc09f12f134895e43af27ad297e62213f" and "9ca57bdfa87572aa1c67497c0cfabf9ae5cc681f" have entirely different histories.
b12e9afbc0
...
9ca57bdfa8
23 changed files with 67 additions and 828 deletions
57
CHANGELOG.md
57
CHANGELOG.md
|
@ -1,8 +1,6 @@
|
||||||
# 2.2.0 (dd-mm-2024)
|
# 2.2.0 (dd-mm-2024)
|
||||||
|
|
||||||
## Explanations
|
**Genetic Diseases**
|
||||||
|
|
||||||
**Genetic Diseases**:
|
|
||||||
|
|
||||||
This update introduces genetic diseases that are shared on sex.
|
This update introduces genetic diseases that are shared on sex.
|
||||||
Infection is handled when sex finishes, so a coitus-interruptus will not result in infections.
|
Infection is handled when sex finishes, so a coitus-interruptus will not result in infections.
|
||||||
|
@ -22,65 +20,14 @@ Most of the genes so far were positive or neutral,
|
||||||
so I got some fair requests to introduce negative genes to keep xenotypes balanced.
|
so I got some fair requests to introduce negative genes to keep xenotypes balanced.
|
||||||
I know that this is some overlap with the STD mod, but well ... you are free to turn things off?
|
I know that this is some overlap with the STD mod, but well ... you are free to turn things off?
|
||||||
|
|
||||||
**Genetic Infectors**:
|
|
||||||
|
|
||||||
These Genes can apply a genetic disease, but are not genetic diseases themselves.
|
|
||||||
A single infector gene can have multiple resulting diseases, see this extension example:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<li Class="RJW_Genes.GeneticInfectorExtension">
|
|
||||||
<infectionChance>0.05</infectionChance>
|
|
||||||
<infectionGenes>
|
|
||||||
<li>rjw_genes_size_blinded</li>
|
|
||||||
<li>rjw_genes_infectious_bisexuality</li>
|
|
||||||
</infectionGenes>
|
|
||||||
</li>
|
|
||||||
```
|
|
||||||
|
|
||||||
The infection-chance is applied per gene - for the example above there would be a 5% chance to apply `size_blinded` and 5% chance to apply `infectious_bisexuality`.
|
|
||||||
Multiple infections can happen on a single sex.
|
|
||||||
The `infectionGenes` can be any gene, this is not limited to genetic diseases (e.g. ugly or something).
|
|
||||||
|
|
||||||
*Infectors* are always applied even if the genetic disease spread is turned off.
|
|
||||||
The created genetic diseases will follow the logic outlined above.
|
|
||||||
|
|
||||||
**Disease Immunity**:
|
|
||||||
|
|
||||||
Pawns can be immune to genetic diseases.
|
|
||||||
|
|
||||||
This is either done with a specialised gene (`rjw_genes_genetic_disease_immunity`)
|
|
||||||
or by genes giving specific immunities.
|
|
||||||
|
|
||||||
Any gene can give immunity against any genetic disease using an extension:
|
|
||||||
|
|
||||||
```xml
|
|
||||||
<li Class="RJW_Genes.ImmunityAgainstGenesExtension">
|
|
||||||
<givesImmunityAgainst>
|
|
||||||
<li>rjw_genes_size_blinded</li>
|
|
||||||
</givesImmunityAgainst>
|
|
||||||
</li>
|
|
||||||
```
|
|
||||||
|
|
||||||
These extensions can be slapped on any gene,
|
|
||||||
but they are meant mostly to have infectors immune against their own diseases.
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
**Additions:**
|
**Additions:**
|
||||||
|
|
||||||
- Passive Gene: Genetic Disease Immunity. cannot get infected by any genetic diseases, and won't be affected by some other genes (see relevant genes)
|
- Passive Gene: *Genetic Disease Immunity* - cannot get infected by any genetic diseases, and won't be affected by some other genes (see relevant genes)
|
||||||
- Disease Gene: Vulnerability. Pawn is likelier to be raped
|
- Disease Gene: Vulnerability. Pawn is likelier to be raped
|
||||||
- Disease Gene: Infectious Hypersexuality
|
- Disease Gene: Infectious Hypersexuality
|
||||||
- Disease Gene: Infectious Homosexuality & Bisexuality
|
- Disease Gene: Infectious Homosexuality & Bisexuality
|
||||||
- Disease Gene: Infectious lower fertility
|
|
||||||
- Disease Gene: Infectious higher sex need
|
|
||||||
- Disease Gene: Fluctual Sexual Need. (Configurable) Chance to reset sex-need to near-zero and gain a bit of rest-need.
|
- Disease Gene: Fluctual Sexual Need. (Configurable) Chance to reset sex-need to near-zero and gain a bit of rest-need.
|
||||||
- Disease Gene: Size Blinded. Pawns have a higher chance for hooking up with pawns with a big cock, lower chance for small cocks.
|
- Disease Gene: Size Blinded. Pawns have a higher chance for hooking up with pawns with a big cock, lower chance for small cocks.
|
||||||
- Infector Gene: Genetic Stretcher. Pawns can infect other pawns with *Size Blinded*
|
|
||||||
- Gene: Hardwired Progenity. Pawns with this get a malus on having no-children, and bonus on having a lot.
|
|
||||||
- Gene: Sexual Genetic Swap. Pawns have a chance to switch a random gene with their sexpartner.
|
|
||||||
- (Archite) Gene: Sexual Genetic Thief. Pawns have a chance to steal a gene from their sexpartner. Genetic Disease Immunity shields against this.
|
|
||||||
- Pawns will have negative thoughts about pawns with more genetic diseases than themselves.
|
|
||||||
|
|
||||||
**Fixes:**
|
**Fixes:**
|
||||||
|
|
||||||
|
|
|
@ -115,41 +115,4 @@
|
||||||
<biostatMet>-1</biostatMet>
|
<biostatMet>-1</biostatMet>
|
||||||
</GeneDef>
|
</GeneDef>
|
||||||
|
|
||||||
<GeneDef ParentName="BreedingBase">
|
|
||||||
<defName>rjw_genes_hardwired_progenity</defName>
|
|
||||||
<label>Hardwired Progenity</label>
|
|
||||||
<description>Carriers of this gene need to procreate. They suffer negative effects if they are childless, and have increased capabilities if they reach a high amount of offsprings.</description>
|
|
||||||
<iconPath>Genes/Icons/RJW_Genes_PheromoneSpit</iconPath>
|
|
||||||
<displayOrderInCategory>70</displayOrderInCategory>
|
|
||||||
|
|
||||||
<conditionalStatAffecters>
|
|
||||||
<li Class="RJW_Genes.ConditionalStatAffecter_NoChildren">
|
|
||||||
<statOffsets>
|
|
||||||
<WorkSpeedGlobal>-0.1</WorkSpeedGlobal>
|
|
||||||
<Fertility>1.2</Fertility>
|
|
||||||
<SexFrequency>1.2</SexFrequency>
|
|
||||||
<MentalBreakThreshold>-0.15</MentalBreakThreshold>
|
|
||||||
<GlobalLearningFactor>-0.1</GlobalLearningFactor>
|
|
||||||
</statOffsets>
|
|
||||||
</li>
|
|
||||||
<li Class="RJW_Genes.ConditionalStatAffecter_ManyChildren">
|
|
||||||
<statOffsets>
|
|
||||||
<MoveSpeed>0.05</MoveSpeed>
|
|
||||||
<WorkSpeedGlobal>0.1</WorkSpeedGlobal>
|
|
||||||
<Fertility>0.1</Fertility>
|
|
||||||
<SexFrequency>0.4</SexFrequency>
|
|
||||||
</statOffsets>
|
|
||||||
</li>
|
|
||||||
<li Class="RJW_Genes.ConditionalStatAffecter_VeryManyChildren">
|
|
||||||
<statOffsets>
|
|
||||||
<MoveSpeed>0.15</MoveSpeed>
|
|
||||||
<WorkSpeedGlobal>0.25</WorkSpeedGlobal>
|
|
||||||
<MentalBreakThreshold>0.25</MentalBreakThreshold>
|
|
||||||
</statOffsets>
|
|
||||||
</li>
|
|
||||||
</conditionalStatAffecters>
|
|
||||||
|
|
||||||
<biostatCpx>1</biostatCpx>
|
|
||||||
<biostatMet>0</biostatMet>
|
|
||||||
</GeneDef>
|
|
||||||
</Defs>
|
</Defs>
|
|
@ -85,69 +85,6 @@
|
||||||
</modExtensions>
|
</modExtensions>
|
||||||
</GeneDef>
|
</GeneDef>
|
||||||
|
|
||||||
<GeneDef ParentName="RJWGeneDisease">
|
|
||||||
<defName>rjw_genes_infectious_low_fertility</defName>
|
|
||||||
<label>infectious low fertility vulnerability</label>
|
|
||||||
<description>Carriers of this genetic disease have lower fertility.</description>
|
|
||||||
<biostatCpx>1</biostatCpx>
|
|
||||||
<biostatMet>1</biostatMet>
|
|
||||||
<marketValueFactor>0.9</marketValueFactor>
|
|
||||||
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
|
|
||||||
<displayOrderInCategory>5</displayOrderInCategory>
|
|
||||||
|
|
||||||
<statOffsets>
|
|
||||||
<Fertility>-0.15</Fertility>
|
|
||||||
</statOffsets>
|
|
||||||
|
|
||||||
<modExtensions>
|
|
||||||
<li Class="RJW_Genes.GeneticDiseaseExtension">
|
|
||||||
<infectionChance>0.05</infectionChance>
|
|
||||||
</li>
|
|
||||||
</modExtensions>
|
|
||||||
</GeneDef>
|
|
||||||
|
|
||||||
<GeneDef ParentName="RJWGeneDisease">
|
|
||||||
<defName>rjw_genes_infectious_increased_sex_need</defName>
|
|
||||||
<label>infectious increased sexneed</label>
|
|
||||||
<description>Carriers of this genetic disease need more sex.</description>
|
|
||||||
<biostatCpx>0</biostatCpx>
|
|
||||||
<biostatMet>1</biostatMet>
|
|
||||||
<marketValueFactor>0.9</marketValueFactor>
|
|
||||||
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
|
|
||||||
<displayOrderInCategory>5</displayOrderInCategory>
|
|
||||||
|
|
||||||
<statOffsets>
|
|
||||||
<SexFrequency>0.15</SexFrequency>
|
|
||||||
</statOffsets>
|
|
||||||
|
|
||||||
<modExtensions>
|
|
||||||
<li Class="RJW_Genes.GeneticDiseaseExtension">
|
|
||||||
<infectionChance>0.08</infectionChance>
|
|
||||||
</li>
|
|
||||||
</modExtensions>
|
|
||||||
</GeneDef>
|
|
||||||
|
|
||||||
<GeneDef ParentName="RJWGeneDisease">
|
|
||||||
<defName>rjw_genes_infectious_major_increased_sex_need</defName>
|
|
||||||
<label>major infectious increased sexneed</label>
|
|
||||||
<description>Carriers of this genetic disease need a lot more sex.</description>
|
|
||||||
<biostatCpx>1</biostatCpx>
|
|
||||||
<biostatMet>2</biostatMet>
|
|
||||||
<marketValueFactor>0.85</marketValueFactor>
|
|
||||||
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
|
|
||||||
<displayOrderInCategory>5</displayOrderInCategory>
|
|
||||||
|
|
||||||
<statOffsets>
|
|
||||||
<SexFrequency>1.0</SexFrequency>
|
|
||||||
</statOffsets>
|
|
||||||
|
|
||||||
<modExtensions>
|
|
||||||
<li Class="RJW_Genes.GeneticDiseaseExtension">
|
|
||||||
<infectionChance>0.03</infectionChance>
|
|
||||||
</li>
|
|
||||||
</modExtensions>
|
|
||||||
</GeneDef>
|
|
||||||
|
|
||||||
<GeneDef ParentName="RJWGeneDisease">
|
<GeneDef ParentName="RJWGeneDisease">
|
||||||
<defName>rjw_genes_infectious_hypersexuality</defName>
|
<defName>rjw_genes_infectious_hypersexuality</defName>
|
||||||
<label>infectious hypersexuality</label>
|
<label>infectious hypersexuality</label>
|
||||||
|
@ -265,27 +202,4 @@
|
||||||
</modExtensions>
|
</modExtensions>
|
||||||
</GeneDef>
|
</GeneDef>
|
||||||
|
|
||||||
<GeneDef ParentName="RJWGeneDisease">
|
|
||||||
<defName>rjw_genes_stretcher</defName>
|
|
||||||
<label>genetic stretcher</label>
|
|
||||||
<description>Pawns with this gene have a chance to alter the genes of their sexual partners to prefer large cocks.</description>
|
|
||||||
<iconPath>UI/Icons/ColonistBar/Idle</iconPath>
|
|
||||||
<biostatCpx>1</biostatCpx>
|
|
||||||
<biostatMet>0</biostatMet>
|
|
||||||
<displayOrderInCategory>12</displayOrderInCategory>
|
|
||||||
<modExtensions>
|
|
||||||
<li Class="RJW_Genes.ImmunityAgainstGenesExtension">
|
|
||||||
<givesImmunityAgainst>
|
|
||||||
<li>rjw_genes_size_blinded</li>
|
|
||||||
</givesImmunityAgainst>
|
|
||||||
</li>
|
|
||||||
<li Class="RJW_Genes.GeneticInfectorExtension">
|
|
||||||
<infectionChance>0.05</infectionChance>
|
|
||||||
<infectionGenes>
|
|
||||||
<li>rjw_genes_size_blinded</li>
|
|
||||||
</infectionGenes>
|
|
||||||
</li>
|
|
||||||
</modExtensions>
|
|
||||||
</GeneDef>
|
|
||||||
|
|
||||||
</Defs>
|
</Defs>
|
|
@ -140,7 +140,7 @@
|
||||||
|
|
||||||
<GeneDef ParentName="SpecialBase">
|
<GeneDef ParentName="SpecialBase">
|
||||||
<defName>rjw_genes_sex_tamer</defName>
|
<defName>rjw_genes_sex_tamer</defName>
|
||||||
<label>sexual tamer</label>
|
<label>Sexual Tamer</label>
|
||||||
<labelShortAdj>sextamer</labelShortAdj>
|
<labelShortAdj>sextamer</labelShortAdj>
|
||||||
<description>Bestiality has a chance to tame animals or advance their training.</description>
|
<description>Bestiality has a chance to tame animals or advance their training.</description>
|
||||||
<iconPath>Genes/Icons/RJW_Genes_SexualTamer</iconPath>
|
<iconPath>Genes/Icons/RJW_Genes_SexualTamer</iconPath>
|
||||||
|
@ -149,35 +149,4 @@
|
||||||
<biostatMet>-1</biostatMet>
|
<biostatMet>-1</biostatMet>
|
||||||
</GeneDef>
|
</GeneDef>
|
||||||
|
|
||||||
<GeneDef ParentName="SpecialBase">
|
|
||||||
<defName>rjw_genes_sexual_genetic_swap</defName>
|
|
||||||
<label>sexual genetic swap</label>
|
|
||||||
<description>Carriers with this gene may switch a gene with their sex-partner. Switched Genes are always endogenes.</description>
|
|
||||||
<iconPath>UI/Icons/Genes/Gene_PsychicBonding</iconPath>
|
|
||||||
<displayOrderInCategory>20</displayOrderInCategory>
|
|
||||||
<biostatCpx>3</biostatCpx>
|
|
||||||
<biostatMet>0</biostatMet>
|
|
||||||
<modExtensions>
|
|
||||||
<li Class="RJW_Genes.ChanceExtension">
|
|
||||||
<chance>0.1</chance>
|
|
||||||
</li>
|
|
||||||
</modExtensions>
|
|
||||||
</GeneDef>
|
|
||||||
|
|
||||||
<GeneDef ParentName="SpecialBase">
|
|
||||||
<defName>rjw_genes_sexual_genetic_thief</defName>
|
|
||||||
<label>sexual gene thief</label>
|
|
||||||
<description>Carriers with this gene may steal a gene from their sex-partner. Stolen genes are always xenogenes.</description>
|
|
||||||
<iconPath>UI/Icons/Genes/Gene_PsychicBonding</iconPath>
|
|
||||||
<displayOrderInCategory>21</displayOrderInCategory>
|
|
||||||
<biostatCpx>5</biostatCpx>
|
|
||||||
<biostatMet>-2</biostatMet>
|
|
||||||
<biostatArc>1</biostatArc>
|
|
||||||
<modExtensions>
|
|
||||||
<li Class="RJW_Genes.ChanceExtension">
|
|
||||||
<chance>0.2</chance>
|
|
||||||
</li>
|
|
||||||
</modExtensions>
|
|
||||||
</GeneDef>
|
|
||||||
|
|
||||||
</Defs>
|
</Defs>
|
|
@ -24,26 +24,4 @@
|
||||||
</stages>
|
</stages>
|
||||||
</ThoughtDef>
|
</ThoughtDef>
|
||||||
|
|
||||||
<ThoughtDef>
|
|
||||||
<defName>rjw_genes_has_more_diseases</defName>
|
|
||||||
<thoughtClass>Thought_SituationalSocial</thoughtClass>
|
|
||||||
<workerClass>RJW_Genes.ThoughtWorker_HasMoreDiseasesThanMe_Social</workerClass>
|
|
||||||
<validWhileDespawned>true</validWhileDespawned>
|
|
||||||
|
|
||||||
<stages>
|
|
||||||
<li>
|
|
||||||
<label>carries more genetic diseases than me</label>
|
|
||||||
<baseOpinionOffset>-3</baseOpinionOffset>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label>carries more way genetic diseases than me</label>
|
|
||||||
<baseOpinionOffset>-8</baseOpinionOffset>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label>the genetic diseases on this fellow are off charts</label>
|
|
||||||
<baseOpinionOffset>-18</baseOpinionOffset>
|
|
||||||
</li>
|
|
||||||
</stages>
|
|
||||||
</ThoughtDef>
|
|
||||||
|
|
||||||
</Defs>
|
</Defs>
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LanguageData>
|
|
||||||
|
|
||||||
<StatsReport_NoChildren>Pawn doesn't have any children.</StatsReport_NoChildren>
|
|
||||||
<StatsReport_ManyChildren>Pawn has a decent amount of children.</StatsReport_ManyChildren>
|
|
||||||
<StatsReport_VeryManyChildren>Pawn has a lot of children.</StatsReport_VeryManyChildren>
|
|
||||||
|
|
||||||
</LanguageData>
|
|
|
@ -1,15 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
public class ChanceExtension : DefModExtension
|
|
||||||
{
|
|
||||||
public float chance;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -73,7 +73,6 @@ namespace RJW_Genes
|
||||||
public static readonly GeneDef rjw_genes_fervent_ovipositor;
|
public static readonly GeneDef rjw_genes_fervent_ovipositor;
|
||||||
public static readonly GeneDef rjw_genes_insectbreeder;
|
public static readonly GeneDef rjw_genes_insectbreeder;
|
||||||
public static readonly GeneDef rjw_genes_insectincubator;
|
public static readonly GeneDef rjw_genes_insectincubator;
|
||||||
public static readonly GeneDef rjw_genes_hardwired_progenity;
|
|
||||||
|
|
||||||
// Cum
|
// Cum
|
||||||
public static readonly GeneDef rjw_genes_no_cum;
|
public static readonly GeneDef rjw_genes_no_cum;
|
||||||
|
@ -105,8 +104,6 @@ namespace RJW_Genes
|
||||||
public static readonly GeneDef rjw_genes_hormonal_saliva;
|
public static readonly GeneDef rjw_genes_hormonal_saliva;
|
||||||
public static readonly GeneDef rjw_genes_cocoonweaver;
|
public static readonly GeneDef rjw_genes_cocoonweaver;
|
||||||
public static readonly GeneDef rjw_genes_sex_tamer;
|
public static readonly GeneDef rjw_genes_sex_tamer;
|
||||||
public static readonly GeneDef rjw_genes_sexual_genetic_swap;
|
|
||||||
public static readonly GeneDef rjw_genes_sexual_genetic_thief;
|
|
||||||
|
|
||||||
// Cosmetic
|
// Cosmetic
|
||||||
public static readonly GeneDef rjw_genes_succubus_tail;
|
public static readonly GeneDef rjw_genes_succubus_tail;
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
using RimWorld;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
public class ConditionalStatAffecter_ManyChildren : ConditionalStatAffecter
|
|
||||||
{
|
|
||||||
public override string Label => (string)"StatsReport_ManyChildren".Translate();
|
|
||||||
|
|
||||||
public const int THRESHOLD_FOR_CHILDREN = 3;
|
|
||||||
|
|
||||||
public override bool Applies(StatRequest req)
|
|
||||||
{
|
|
||||||
if (req == null || req.Thing == null || !req.Thing.Spawned) return false;
|
|
||||||
|
|
||||||
if (req.Thing is Pawn pawn)
|
|
||||||
{
|
|
||||||
// Do nothing if Pawn is Baby or Child (#25)
|
|
||||||
if (!pawn.ageTracker.Adult)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_hardwired_progenity))
|
|
||||||
{
|
|
||||||
// This "middle" Conditional Stat Affecter only fires if the other one does not apply
|
|
||||||
return pawn.relations.ChildrenCount >= THRESHOLD_FOR_CHILDREN
|
|
||||||
&& pawn.relations.ChildrenCount < ConditionalStatAffecter_VeryManyChildren.THRESHOLD_FOR_CHILDREN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
using RimWorld;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This conditional stat affecter "fires" if the pawn has no children.
|
|
||||||
///
|
|
||||||
/// DevNote: I salvaged this from 1.3.3 Halamyr Conditional Stat Affecters.
|
|
||||||
/// It seems that with RW 1.5 there was a change how these work, as the req.Pawn seems to be null.
|
|
||||||
/// Now, the pawn is in req.Thing.
|
|
||||||
/// </summary>
|
|
||||||
public class ConditionalStatAffecter_NoChildren : ConditionalStatAffecter
|
|
||||||
{
|
|
||||||
public override string Label => (string)"StatsReport_NoChildren".Translate();
|
|
||||||
|
|
||||||
public override bool Applies(StatRequest req)
|
|
||||||
{
|
|
||||||
if (req == null || req.Thing == null || !req.Thing.Spawned) return false;
|
|
||||||
|
|
||||||
if (req.Thing is Pawn pawn)
|
|
||||||
{
|
|
||||||
// Do nothing if Pawn is Baby or Child (#25)
|
|
||||||
if (!pawn.ageTracker.Adult)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_hardwired_progenity))
|
|
||||||
{
|
|
||||||
return pawn.relations.ChildrenCount == 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
using RimWorld;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
public class ConditionalStatAffecter_VeryManyChildren : ConditionalStatAffecter
|
|
||||||
{
|
|
||||||
public override string Label => (string)"StatsReport_VeryManyChildren".Translate();
|
|
||||||
|
|
||||||
public const int THRESHOLD_FOR_CHILDREN = 8;
|
|
||||||
|
|
||||||
public override bool Applies(StatRequest req)
|
|
||||||
{
|
|
||||||
if (req == null || req.Thing == null || !req.Thing.Spawned) return false;
|
|
||||||
|
|
||||||
if (req.Thing is Pawn pawn)
|
|
||||||
{
|
|
||||||
// Do nothing if Pawn is Baby or Child (#25)
|
|
||||||
if (!pawn.ageTracker.Adult)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_hardwired_progenity))
|
|
||||||
{
|
|
||||||
return pawn.relations.ChildrenCount >= THRESHOLD_FOR_CHILDREN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
public class GeneticInfectorExtension : DefModExtension
|
|
||||||
{
|
|
||||||
public float infectionChance;
|
|
||||||
|
|
||||||
public List<string> infectionGenes;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
public class ImmunityAgainstGenesExtension : DefModExtension
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A list of the exact defnames of disease-genes that this extension will make immune against.
|
|
||||||
/// Must perfectly match!
|
|
||||||
/// </summary>
|
|
||||||
public List<string> givesImmunityAgainst;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,145 +0,0 @@
|
||||||
using rjw;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
public static class DiseaseHelper
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks for a pawn if it is immune against a disease.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pawn">The pawn for which immunity is checked</param>
|
|
||||||
/// <param name="disease">The genetic disease that is checked against</param>
|
|
||||||
/// <returns>True if the pawn is immune, false if the pawn can be infected by it.</returns>
|
|
||||||
public static bool IsImmuneAgainstGeneticDisease(Pawn pawn, GeneDef disease)
|
|
||||||
{
|
|
||||||
// Case 1: Something is null / not working, return Immune (to have less follow up effects)
|
|
||||||
if (pawn == null || pawn.genes == null) return true;
|
|
||||||
if (disease == null) return true;
|
|
||||||
// Case 1.B: Dead people can spread, but not receive, diseases.
|
|
||||||
if (pawn.Dead) return true;
|
|
||||||
|
|
||||||
// Case 2: The pawn has general genetic immunity to diseases
|
|
||||||
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_genetic_disease_immunity))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Case 3: The pawn already has the genetic disease
|
|
||||||
if (GeneUtility.HasGeneNullCheck(pawn, disease))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Case 4: Check all genes if one of them has the Immunity Extension that covers the GeneDef
|
|
||||||
List<Gene> genes = pawn.genes.GenesListForReading;
|
|
||||||
genes = genes.Where(x => pawn.genes.HasActiveGene(x.def)).ToList();
|
|
||||||
|
|
||||||
foreach (Gene gene in genes)
|
|
||||||
{
|
|
||||||
ImmunityAgainstGenesExtension ext = gene.def.GetModExtension<ImmunityAgainstGenesExtension>();
|
|
||||||
if (ext != null) {
|
|
||||||
foreach (string defname in ext.givesImmunityAgainst)
|
|
||||||
if (disease.defName == defname)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Case 5: Nothing special happens, so return false (not immune)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns all active Genes with the `GeneticDiseaseExtension`.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pawn"></param>
|
|
||||||
/// <returns>List of all active Genes with the `GeneticDiseaseExtension` in pawn</returns>
|
|
||||||
public static List<GeneDef> GetGeneticDiseaseGenes(Pawn pawn)
|
|
||||||
{
|
|
||||||
if (pawn != null && pawn.genes != null)
|
|
||||||
{
|
|
||||||
return pawn.genes
|
|
||||||
.GenesListForReading
|
|
||||||
.ConvertAll(gene => gene.def)
|
|
||||||
.Where(genedef => pawn.genes.HasActiveGene(genedef))
|
|
||||||
.Where(IsGeneticDiseaseGene)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new List<GeneDef>() { };
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<GeneDef> GetGeneticInfectorGenes(Pawn pawn)
|
|
||||||
{
|
|
||||||
if (pawn != null && pawn.genes != null)
|
|
||||||
{
|
|
||||||
return pawn.genes
|
|
||||||
.GenesListForReading
|
|
||||||
.ConvertAll(gene => gene.def)
|
|
||||||
.Where(genedef => pawn.genes.HasActiveGene(genedef))
|
|
||||||
.Where(IsGeneticInfectorGene)
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new List<GeneDef>() { };
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<GeneDef> LookupInfectionGeneDefs(GeneticInfectorExtension infectorExt)
|
|
||||||
{
|
|
||||||
if (infectorExt == null) new List<GeneDef>();
|
|
||||||
|
|
||||||
return RimWorld.GeneUtility
|
|
||||||
.GenesInOrder
|
|
||||||
.Where(genedef => infectorExt.infectionGenes.Contains(genedef.defName))
|
|
||||||
.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks if the performed sex was penetrative.
|
|
||||||
/// Condom check is not done here!
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="props">The sexprops </param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsPenetrativeSex(SexProps props)
|
|
||||||
{
|
|
||||||
if (props == null) return false;
|
|
||||||
|
|
||||||
return props.sexType ==
|
|
||||||
xxx.rjwSextype.Vaginal
|
|
||||||
|| props.sexType == xxx.rjwSextype.Anal
|
|
||||||
|| props.sexType == xxx.rjwSextype.Oral
|
|
||||||
|| props.sexType == xxx.rjwSextype.DoublePenetration
|
|
||||||
|| props.sexType == xxx.rjwSextype.Fellatio
|
|
||||||
|| props.sexType == xxx.rjwSextype.Sixtynine;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsGeneticDiseaseGene(GeneDef geneDef)
|
|
||||||
{
|
|
||||||
if (geneDef == null) return false;
|
|
||||||
GeneticDiseaseExtension diseaseExt = geneDef.GetModExtension<GeneticDiseaseExtension>();
|
|
||||||
return diseaseExt != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool IsGeneticInfectorGene(GeneDef geneDef)
|
|
||||||
{
|
|
||||||
if (geneDef == null) return false;
|
|
||||||
GeneticInfectorExtension infectorExt = geneDef.GetModExtension<GeneticInfectorExtension>();
|
|
||||||
return infectorExt != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float LookupDiseaseInfectionChance(GeneDef geneDef)
|
|
||||||
{
|
|
||||||
if (IsGeneticDiseaseGene(geneDef))
|
|
||||||
{
|
|
||||||
GeneticDiseaseExtension diseaseExt = geneDef.GetModExtension<GeneticDiseaseExtension>();
|
|
||||||
return diseaseExt != null ? diseaseExt.infectionChance : 0.0f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
using HarmonyLib;
|
|
||||||
using rjw;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.Remoting.Lifetime;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
|
|
||||||
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
|
||||||
public class Patch_AfterSexUtility_ApplyGeneticInfectors
|
|
||||||
{
|
|
||||||
public static void Postfix(SexProps props)
|
|
||||||
{
|
|
||||||
if (props == null || props.pawn == null || props.partner == null) return;
|
|
||||||
|
|
||||||
Pawn pawn = props.pawn;
|
|
||||||
Pawn partner = props.partner;
|
|
||||||
|
|
||||||
if (pawn == partner) return;
|
|
||||||
if (pawn.IsAnimal() || partner.IsAnimal()) return;
|
|
||||||
if (pawn.genes == null || partner.genes == null) return;
|
|
||||||
// No Infections on Condom Use
|
|
||||||
if (props.usedCondom) return;
|
|
||||||
|
|
||||||
// Exit early if settings require penetrative sex, but this is not penetrative sex
|
|
||||||
if (!DiseaseHelper.IsPenetrativeSex(props) && RJW_Genes_Settings.rjw_genes_genetic_disease_spread_only_on_penetrative_sex) return;
|
|
||||||
|
|
||||||
TryApplyGeneticInfections(pawn, partner);
|
|
||||||
TryApplyGeneticInfections(partner, pawn);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void TryApplyGeneticInfections(Pawn infector, Pawn partner)
|
|
||||||
{
|
|
||||||
foreach (GeneDef infectorGeneDef in DiseaseHelper.GetGeneticInfectorGenes(infector))
|
|
||||||
{
|
|
||||||
GeneticInfectorExtension diseaseExt = infectorGeneDef.GetModExtension<GeneticInfectorExtension>();
|
|
||||||
if (diseaseExt == null) continue;
|
|
||||||
float application_chance = diseaseExt.infectionChance;
|
|
||||||
|
|
||||||
foreach (GeneDef diseaseGeneDef in DiseaseHelper.LookupInfectionGeneDefs(diseaseExt))
|
|
||||||
{
|
|
||||||
if (DiseaseHelper.IsImmuneAgainstGeneticDisease(partner, diseaseGeneDef))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if ((new Random()).NextDouble() < application_chance)
|
|
||||||
partner.genes.AddGene(diseaseGeneDef, !RJW_Genes_Settings.rjw_genes_genetic_disease_as_endogenes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,7 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
namespace RJW_Genes
|
namespace RJW_Genes.Genes.Diseases.Patches
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
||||||
public class Patch_AftersexUtility_TransferGeneticDiseases
|
public class Patch_AftersexUtility_TransferGeneticDiseases
|
||||||
|
@ -29,28 +29,83 @@ namespace RJW_Genes
|
||||||
if (props.usedCondom) return;
|
if (props.usedCondom) return;
|
||||||
|
|
||||||
// Exit early if settings require penetrative sex, but this is not penetrative sex
|
// Exit early if settings require penetrative sex, but this is not penetrative sex
|
||||||
if (!DiseaseHelper.IsPenetrativeSex(props) && RJW_Genes_Settings.rjw_genes_genetic_disease_spread_only_on_penetrative_sex) return;
|
if (!IsPenetrativeSex(props) && RJW_Genes_Settings.rjw_genes_genetic_disease_spread_only_on_penetrative_sex) return;
|
||||||
|
|
||||||
//ModLog.Debug($"Firing Patch_TransferGeneticDiseases for {pawn} and {partner}");
|
ModLog.Debug($"Firing Patch_TransferGeneticDiseases for {pawn} and {partner}");
|
||||||
TryTransferGeneticDiseases(pawn, partner, props);
|
TryTransferGeneticDiseases(pawn, partner, props);
|
||||||
TryTransferGeneticDiseases(partner, pawn, props);
|
TryTransferGeneticDiseases(partner, pawn, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void TryTransferGeneticDiseases(Pawn infector, Pawn infected, SexProps props)
|
private static void TryTransferGeneticDiseases(Pawn infector, Pawn infected, SexProps props)
|
||||||
{
|
{
|
||||||
|
if (infected.genes.HasActiveGene(GeneDefOf.rjw_genes_genetic_disease_immunity))
|
||||||
foreach (GeneDef disease in DiseaseHelper.GetGeneticDiseaseGenes(infector)) {
|
{
|
||||||
|
ModLog.Debug($"{infected} is immune to genetic diseases");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (infected.Dead)
|
||||||
|
{
|
||||||
|
// Dead people can spread, but not receive, diseases.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (GeneDef disease in GetGeneticDiseaseGenes(infector)) {
|
||||||
ModLog.Debug($"Found genetic disease {disease} in {infector}, trying to infect {infected}");
|
ModLog.Debug($"Found genetic disease {disease} in {infector}, trying to infect {infected}");
|
||||||
|
|
||||||
if (DiseaseHelper.IsImmuneAgainstGeneticDisease(infected,disease))
|
if (infected.genes.HasActiveGene(disease))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((new Random()).NextDouble() <= DiseaseHelper.LookupDiseaseInfectionChance(disease))
|
if ((new Random()).NextDouble() <= LookupDiseaseInfectionChance(disease))
|
||||||
{
|
{
|
||||||
infected.genes.AddGene(disease, !RJW_Genes_Settings.rjw_genes_genetic_disease_as_endogenes);
|
infected.genes.AddGene(disease, !RJW_Genes_Settings.rjw_genes_genetic_disease_as_endogenes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<GeneDef> GetGeneticDiseaseGenes(Pawn pawn)
|
||||||
|
{
|
||||||
|
if (pawn != null && pawn.genes != null)
|
||||||
|
{
|
||||||
|
return pawn.genes
|
||||||
|
.GenesListForReading
|
||||||
|
.ConvertAll(gene => gene.def)
|
||||||
|
.Where(genedef => pawn.genes.HasActiveGene(genedef))
|
||||||
|
.Where(IsGeneticDiseaseGene)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<GeneDef>() { };
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsPenetrativeSex(SexProps props)
|
||||||
|
{
|
||||||
|
if (props == null) return false;
|
||||||
|
|
||||||
|
return props.sexType ==
|
||||||
|
xxx.rjwSextype.Vaginal
|
||||||
|
|| props.sexType == xxx.rjwSextype.Anal
|
||||||
|
|| props.sexType == xxx.rjwSextype.Oral
|
||||||
|
|| props.sexType == xxx.rjwSextype.DoublePenetration
|
||||||
|
|| props.sexType == xxx.rjwSextype.Fellatio
|
||||||
|
|| props.sexType == xxx.rjwSextype.Sixtynine;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsGeneticDiseaseGene(GeneDef geneDef)
|
||||||
|
{
|
||||||
|
if (geneDef == null) return false;
|
||||||
|
GeneticDiseaseExtension diseaseExt = geneDef.GetModExtension<GeneticDiseaseExtension>();
|
||||||
|
return diseaseExt != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float LookupDiseaseInfectionChance(GeneDef geneDef)
|
||||||
|
{
|
||||||
|
if (IsGeneticDiseaseGene(geneDef))
|
||||||
|
{
|
||||||
|
GeneticDiseaseExtension diseaseExt = geneDef.GetModExtension<GeneticDiseaseExtension>();
|
||||||
|
return diseaseExt != null ? diseaseExt.infectionChance : 0.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
using RimWorld;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
public class ThoughtWorker_HasMoreDiseasesThanMe_Social : ThoughtWorker
|
|
||||||
{
|
|
||||||
protected override ThoughtState CurrentSocialStateInternal(Pawn pawn, Pawn other)
|
|
||||||
{
|
|
||||||
// Return for trivial errors
|
|
||||||
if (pawn == null || other == null || pawn == other)
|
|
||||||
return (ThoughtState)false;
|
|
||||||
// Check for position-existance
|
|
||||||
if (pawn.Position == null || other.Position == null || pawn.Map == null || other.Map == null)
|
|
||||||
return (ThoughtState)false;
|
|
||||||
// Do nothing if pawn is carried
|
|
||||||
if (pawn.CarriedBy != null)
|
|
||||||
return (ThoughtState)false;
|
|
||||||
// Do nothing if Pawn is Baby or Child (#25)
|
|
||||||
if (!pawn.ageTracker.Adult)
|
|
||||||
return (ThoughtState)false;
|
|
||||||
if (!other.ageTracker.Adult)
|
|
||||||
return (ThoughtState)false;
|
|
||||||
// Only check if they are spawned humans
|
|
||||||
if (!pawn.Spawned || !other.Spawned)
|
|
||||||
return (ThoughtState)false;
|
|
||||||
if (!pawn.RaceProps.Humanlike)
|
|
||||||
return (ThoughtState)false;
|
|
||||||
if (!other.RaceProps.Humanlike)
|
|
||||||
return (ThoughtState)false;
|
|
||||||
|
|
||||||
// Pawns that have not "met" wont give each other Mali
|
|
||||||
// Known-Each-Other is a key-word for Rimworld that shows they have had any interaction and stored each other in relations.
|
|
||||||
if (!RelationsUtility.PawnsKnowEachOther(pawn, other))
|
|
||||||
return (ThoughtState)false;
|
|
||||||
// If the pawn is not on Map (e.g. caravan), no mali
|
|
||||||
if (!MapUtility.PawnIsOnHomeMap(pawn))
|
|
||||||
return (ThoughtState)false;
|
|
||||||
|
|
||||||
int pawn_diseases = DiseaseHelper.GetGeneticDiseaseGenes(pawn).Count();
|
|
||||||
int other_diseases = DiseaseHelper.GetGeneticDiseaseGenes(other).Count();
|
|
||||||
int disease_diff = other_diseases - pawn_diseases;
|
|
||||||
|
|
||||||
if (disease_diff >= 5)
|
|
||||||
return ThoughtState.ActiveAtStage(2);
|
|
||||||
else if (disease_diff >= 2)
|
|
||||||
return ThoughtState.ActiveAtStage(1);
|
|
||||||
else if (disease_diff >= 1)
|
|
||||||
return ThoughtState.ActiveAtStage(0);
|
|
||||||
else
|
|
||||||
return (ThoughtState)false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -44,6 +44,7 @@ namespace RJW_Genes
|
||||||
if (!MapUtility.PawnIsOnHomeMap(pawn))
|
if (!MapUtility.PawnIsOnHomeMap(pawn))
|
||||||
return (ThoughtState)false;
|
return (ThoughtState)false;
|
||||||
|
|
||||||
|
//ModLog.Debug($"ThoughtWorker Checks Size Blinded {pawn} -> {other}");
|
||||||
|
|
||||||
// Do nothing if there is no size-blinded involved
|
// Do nothing if there is no size-blinded involved
|
||||||
if (!GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_size_blinded))
|
if (!GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_size_blinded))
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
using HarmonyLib;
|
|
||||||
using rjw;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
|
|
||||||
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
|
||||||
public class Patch_GeneticSexSwap
|
|
||||||
{
|
|
||||||
public static void Postfix(SexProps props)
|
|
||||||
{
|
|
||||||
if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pawn pawn = props.pawn;
|
|
||||||
Pawn partner = props.partner;
|
|
||||||
|
|
||||||
if (pawn.genes == null || partner.genes == null) return;
|
|
||||||
|
|
||||||
// If both have the swap gene, nothing happens
|
|
||||||
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_sexual_genetic_swap)
|
|
||||||
&& GeneUtility.HasGeneNullCheck(partner, GeneDefOf.rjw_genes_sexual_genetic_swap))
|
|
||||||
return;
|
|
||||||
// If neither has the swap gene, nothing happens
|
|
||||||
if (!GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_sexual_genetic_swap)
|
|
||||||
&& !GeneUtility.HasGeneNullCheck(partner, GeneDefOf.rjw_genes_sexual_genetic_swap))
|
|
||||||
return;
|
|
||||||
|
|
||||||
ChanceExtension chanceExt = GeneDefOf.rjw_genes_sexual_genetic_swap.GetModExtension<ChanceExtension>();
|
|
||||||
if (chanceExt != null && (new Random()).NextDouble() < chanceExt.chance)
|
|
||||||
SwapOneRandomGene(pawn, partner);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes a random gene from one pawn and adds it too the other as xenogene.
|
|
||||||
/// The "gene swap" gene cannot be swapped!
|
|
||||||
/// </summary>
|
|
||||||
private static void SwapOneRandomGene(Pawn a, Pawn b, bool AddAsXenogene = true)
|
|
||||||
{
|
|
||||||
|
|
||||||
var geneFromA = a.genes.GenesListForReading
|
|
||||||
.Where(gene => a.genes.HasActiveGene(gene.def))
|
|
||||||
.Where(gene => gene.def != GeneDefOf.rjw_genes_sexual_genetic_swap)
|
|
||||||
.RandomElement();
|
|
||||||
var geneFromB = b.genes.GenesListForReading
|
|
||||||
.Where(gene => b.genes.HasActiveGene(gene.def))
|
|
||||||
.Where(gene => gene.def != GeneDefOf.rjw_genes_sexual_genetic_swap)
|
|
||||||
.RandomElement();
|
|
||||||
|
|
||||||
if (geneFromA == null || geneFromB == null) return;
|
|
||||||
|
|
||||||
ModLog.Debug($"Sexual Genetic Swap: Swapping {geneFromA.def} from {a} with {geneFromB.def} from {b}");
|
|
||||||
|
|
||||||
a.genes.AddGene(geneFromB.def, AddAsXenogene);
|
|
||||||
b.genes.AddGene(geneFromA.def, AddAsXenogene);
|
|
||||||
a.genes.RemoveGene(geneFromA);
|
|
||||||
b.genes.RemoveGene(geneFromB);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
using HarmonyLib;
|
|
||||||
using rjw;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Verse;
|
|
||||||
|
|
||||||
namespace RJW_Genes
|
|
||||||
{
|
|
||||||
|
|
||||||
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
|
||||||
public class Patch_GeneticSexThief
|
|
||||||
{
|
|
||||||
public static void Postfix(SexProps props)
|
|
||||||
{
|
|
||||||
if (props == null || props.pawn == null || props.partner == null || props.partner.IsAnimal())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Pawn pawn = props.pawn;
|
|
||||||
Pawn partner = props.partner;
|
|
||||||
|
|
||||||
if (pawn.genes == null || partner.genes == null) return;
|
|
||||||
|
|
||||||
// If both have the swap gene, nothing happens
|
|
||||||
if (GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_sexual_genetic_thief)
|
|
||||||
&& GeneUtility.HasGeneNullCheck(partner, GeneDefOf.rjw_genes_sexual_genetic_thief))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (GeneUtility.HasGeneNullCheck(pawn,GeneDefOf.rjw_genes_sexual_genetic_thief) &&
|
|
||||||
!GeneUtility.HasGeneNullCheck(partner, GeneDefOf.rjw_genes_genetic_disease_immunity))
|
|
||||||
{
|
|
||||||
ChanceExtension chanceExt = GeneDefOf.rjw_genes_sexual_genetic_thief.GetModExtension<ChanceExtension>();
|
|
||||||
if (chanceExt != null && (new Random()).NextDouble() < chanceExt.chance)
|
|
||||||
StealRandomGene(pawn, partner);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GeneUtility.HasGeneNullCheck(partner, GeneDefOf.rjw_genes_sexual_genetic_thief) &&
|
|
||||||
!GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_genetic_disease_immunity))
|
|
||||||
{
|
|
||||||
ChanceExtension chanceExt = GeneDefOf.rjw_genes_sexual_genetic_thief.GetModExtension<ChanceExtension>();
|
|
||||||
if (chanceExt != null && (new Random()).NextDouble() < chanceExt.chance)
|
|
||||||
StealRandomGene(partner, pawn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes a random gene from one pawn and adds it too the other as xenogene.
|
|
||||||
/// </summary>
|
|
||||||
private static void StealRandomGene(Pawn stealer, Pawn victim, bool AddAsXenogene = true)
|
|
||||||
{
|
|
||||||
var stolenGene = victim.genes.GenesListForReading
|
|
||||||
.Where(gene => victim.genes.HasActiveGene(gene.def))
|
|
||||||
.RandomElement();
|
|
||||||
|
|
||||||
if (stolenGene == null) return;
|
|
||||||
|
|
||||||
ModLog.Debug($"Sexual Gene Thief: {stealer} steals {stolenGene.def} from {victim}");
|
|
||||||
|
|
||||||
stealer.genes.AddGene(stolenGene.def, AddAsXenogene);
|
|
||||||
victim.genes.RemoveGene(stolenGene);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,6 +12,7 @@ namespace RJW_Genes
|
||||||
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
[HarmonyPatch(typeof(SexUtility), "Aftersex")]
|
||||||
public class Patch_HormonalSaliva
|
public class Patch_HormonalSaliva
|
||||||
{
|
{
|
||||||
|
// TODO: Reduce to 0.02 after debug.
|
||||||
const float SIZE_INCREMENT_FALLBACK = 0.02f;
|
const float SIZE_INCREMENT_FALLBACK = 0.02f;
|
||||||
const float MAX_BODY_SIZE_FALLBACK = 2.5f;
|
const float MAX_BODY_SIZE_FALLBACK = 2.5f;
|
||||||
const float CUM_MULTIPLIER_FALLBACK = 1.05f;
|
const float CUM_MULTIPLIER_FALLBACK = 1.05f;
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
<Compile Include="Animal_Inheritance\Settings\RJW_BGSSettings.cs" />
|
<Compile Include="Animal_Inheritance\Settings\RJW_BGSSettings.cs" />
|
||||||
<Compile Include="Animal_Inheritance\Settings\RJW_BGSSettingsController.cs" />
|
<Compile Include="Animal_Inheritance\Settings\RJW_BGSSettingsController.cs" />
|
||||||
<Compile Include="Animal_Inheritance\Defs\BestialityGeneInheritanceDef.cs" />
|
<Compile Include="Animal_Inheritance\Defs\BestialityGeneInheritanceDef.cs" />
|
||||||
<Compile Include="Common\Defs\ChanceExtension.cs" />
|
|
||||||
<Compile Include="Common\Defs\DistanceExtension.cs" />
|
<Compile Include="Common\Defs\DistanceExtension.cs" />
|
||||||
<Compile Include="Common\Defs\ModExtensionHelper.cs" />
|
<Compile Include="Common\Defs\ModExtensionHelper.cs" />
|
||||||
<Compile Include="Common\Defs\TickBasedChanceExtension.cs" />
|
<Compile Include="Common\Defs\TickBasedChanceExtension.cs" />
|
||||||
|
@ -72,22 +71,14 @@
|
||||||
<Compile Include="Genes\Breeding\Abilities\CompProperties_AbilityMatingCall.cs" />
|
<Compile Include="Genes\Breeding\Abilities\CompProperties_AbilityMatingCall.cs" />
|
||||||
<Compile Include="Genes\Breeding\Abilities\CompProperties_AbilityPheromoneSpit.cs" />
|
<Compile Include="Genes\Breeding\Abilities\CompProperties_AbilityPheromoneSpit.cs" />
|
||||||
<Compile Include="Genes\Breeding\AnimalBreedingHelper.cs" />
|
<Compile Include="Genes\Breeding\AnimalBreedingHelper.cs" />
|
||||||
<Compile Include="Genes\Breeding\ConditionalStatAffecters\ConditionalStatAffecter_NoChildren.cs" />
|
|
||||||
<Compile Include="Genes\Breeding\ConditionalStatAffecters\ConditionalStatAffecter_ManyChildren.cs" />
|
|
||||||
<Compile Include="Genes\Breeding\ConditionalStatAffecters\ConditionalStatAffecter_VeryManyChildren.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\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\Defs\GeneticInfectorExtension.cs" />
|
|
||||||
<Compile Include="Genes\Diseases\Defs\ImmunityAgainstGenesExtension.cs" />
|
|
||||||
<Compile Include="Genes\Diseases\DiseaseHelper.cs" />
|
|
||||||
<Compile Include="Genes\Diseases\Genes\Gene_FluctualSexualNeed.cs" />
|
<Compile Include="Genes\Diseases\Genes\Gene_FluctualSexualNeed.cs" />
|
||||||
<Compile Include="Genes\Diseases\Patches\Patch_AfterSexUtility_ApplyGeneticInfectors.cs" />
|
|
||||||
<Compile Include="Genes\Diseases\Patches\Patch_AftersexUtility_TransferGeneticDiseases.cs" />
|
<Compile Include="Genes\Diseases\Patches\Patch_AftersexUtility_TransferGeneticDiseases.cs" />
|
||||||
<Compile Include="Genes\Diseases\Patches\Patch_SecondaryRomanceChanceFactor_Gene_SizeBlinded.cs" />
|
<Compile Include="Genes\Diseases\Patches\Patch_SecondaryRomanceChanceFactor_Gene_SizeBlinded.cs" />
|
||||||
<Compile Include="Genes\Diseases\Thoughts\ThoughtWorker_HasMoreDiseasesThanMe_Social.cs" />
|
|
||||||
<Compile Include="Genes\Diseases\Thoughts\ThoughtWorker_SizeBlinded_Social.cs" />
|
<Compile Include="Genes\Diseases\Thoughts\ThoughtWorker_SizeBlinded_Social.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" />
|
||||||
|
@ -189,8 +180,6 @@
|
||||||
<Compile Include="Genes\Special\Defs\AgeTransferExtension.cs" />
|
<Compile Include="Genes\Special\Defs\AgeTransferExtension.cs" />
|
||||||
<Compile Include="Genes\Special\Defs\HormonalSalivaExtension.cs" />
|
<Compile Include="Genes\Special\Defs\HormonalSalivaExtension.cs" />
|
||||||
<Compile Include="Genes\Special\Patches\Patch_AgeDrain.cs" />
|
<Compile Include="Genes\Special\Patches\Patch_AgeDrain.cs" />
|
||||||
<Compile Include="Genes\Special\Patches\Patch_GeneticSexSwap.cs" />
|
|
||||||
<Compile Include="Genes\Special\Patches\Patch_GeneticSexThief.cs" />
|
|
||||||
<Compile Include="Genes\Special\Patches\Patch_HormonalSaliva.cs" />
|
<Compile Include="Genes\Special\Patches\Patch_HormonalSaliva.cs" />
|
||||||
<Compile Include="Genes\Special\Patches\Patch_OrgasmMytosis.cs" />
|
<Compile Include="Genes\Special\Patches\Patch_OrgasmMytosis.cs" />
|
||||||
<Compile Include="Genes\Special\Patches\Patch_SexualTamer.cs" />
|
<Compile Include="Genes\Special\Patches\Patch_SexualTamer.cs" />
|
||||||
|
|
|
@ -16,7 +16,6 @@ namespace RJW_Genes
|
||||||
public static readonly ThoughtDef rjw_genes_pheromone_carrier_nearby;
|
public static readonly ThoughtDef rjw_genes_pheromone_carrier_nearby;
|
||||||
|
|
||||||
public static readonly ThoughtDef rjw_genes_appealing_cock;
|
public static readonly ThoughtDef rjw_genes_appealing_cock;
|
||||||
public static readonly ThoughtDef rjw_genes_has_more_diseases;
|
|
||||||
|
|
||||||
//Others with same names but other defs than in genedefof
|
//Others with same names but other defs than in genedefof
|
||||||
public static readonly InteractionDef rjw_genes_flirt;
|
public static readonly InteractionDef rjw_genes_flirt;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue