Documenting Fertilin-Backup-Inheritance and minor cleanups

This commit is contained in:
Vegapnk 2023-01-22 15:59:00 +01:00
parent 94a51be2f7
commit 0261ec87f8
4 changed files with 40 additions and 21 deletions

View file

@ -10,7 +10,7 @@
<stages> <stages>
<li> <li>
<label>cock eaten</label> <label>cock eaten</label>
<description>My cock was eaten directly of my body, I am devestated.</description> <description>My cock was eaten directly of my body, I am devestated. This is not what good head feels like. </description>
<baseMoodEffect>-30</baseMoodEffect> <baseMoodEffect>-30</baseMoodEffect>
</li> </li>
</stages> </stages>

View file

@ -87,6 +87,7 @@ namespace RJW_Genes
public static readonly GeneDef rjw_genes_drainer; public static readonly GeneDef rjw_genes_drainer;
public static readonly GeneDef rjw_genes_seduce; public static readonly GeneDef rjw_genes_seduce;
public static readonly GeneDef rjw_genes_paralysingkiss; public static readonly GeneDef rjw_genes_paralysingkiss;
public static readonly GeneDef rjw_genes_cockeater;
// Cosmetic // Cosmetic
public static readonly GeneDef rjw_genes_succubus_tail; public static readonly GeneDef rjw_genes_succubus_tail;

View file

@ -12,7 +12,7 @@ namespace RJW_Genes
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested) protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{ {
if (GeneUtility.HasLifeForce(pawn) && GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_cum_eater)) if (GeneUtility.HasLifeForce(pawn) && GeneUtility.IsCumEater(pawn))
{ {
float num = ingested.stackCount * FERTILIN_PER_UNIT / 100; float num = ingested.stackCount * FERTILIN_PER_UNIT / 100;
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(pawn), num); GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(pawn), num);

View file

@ -11,15 +11,16 @@ namespace RJW_Genes
/// This Patch is applied to add a absorption gene for fertilin if it has none, but it does have the fertilin gene /// This Patch is applied to add a absorption gene for fertilin if it has none, but it does have the fertilin gene
/// First tries to get one from the parents else chooses one of them at random /// First tries to get one from the parents else chooses one of them at random
/// the genes are determined and "simply added". /// the genes are determined and "simply added".
///
/// This fixes the potential problem that Pawns could inherit Fertilin, but no gene to gain Fertilin.
/// </summary> /// </summary>
[HarmonyPatch(typeof(PregnancyUtility), "GetInheritedGeneSet", new Type[] [HarmonyPatch(typeof(PregnancyUtility), "GetInheritedGeneSet", new Type[]
{ {
typeof(Pawn), typeof(Pawn),
typeof(Pawn), typeof(Pawn)
//typeof(bool)
} }
)] )]
public static class PatchVanillaPregnancyFertilin public static class Patch_Vanilla_Inheritance_Fertilin
{ {
[HarmonyPostfix] [HarmonyPostfix]
public static void InheritedGenes(Pawn father, Pawn mother, ref GeneSet __result) public static void InheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)
@ -27,36 +28,53 @@ namespace RJW_Genes
//Also make a setting for this //Also make a setting for this
if (__result.GenesListForReading.Contains(GeneDefOf.rjw_genes_lifeforce)) if (__result.GenesListForReading.Contains(GeneDefOf.rjw_genes_lifeforce))
{ {
List<GeneDef> gene_list = __result.GenesListForReading; List<GeneDef> babies_genes = __result.GenesListForReading;
//If no absorption gene get one from the parents, else a random one //If there is no absorption gene get one from the parents, else a random one
if(!(gene_list.Contains(GeneDefOf.rjw_genes_drainer) || gene_list.Contains(GeneDefOf.rjw_genes_cum_eater) if(!Has_Fertilin_Source_Gene(babies_genes))
|| gene_list.Contains(GeneDefOf.rjw_genes_vaginal_absorber) || gene_list.Contains(GeneDefOf.rjw_genes_anal_absorber)))
{ {
List<GeneDef> absorption_genes_list = new List<GeneDef> { GeneDefOf.rjw_genes_drainer, GeneDefOf.rjw_genes_cum_eater if (RJW_Genes_Settings.rjw_genes_detailed_debug)
, GeneDefOf.rjw_genes_vaginal_absorber, GeneDefOf.rjw_genes_anal_absorber }; ModLog.Message($"Child of ({father.Name};{mother.Name}) has Genes with LifeForce-Resource but no Source-Gene, adding one of parents random if possible or any random otherwise.");
// Gather Parents Source-Genes
List<GeneDef> absorption_genes_parents = new List<GeneDef>(); List<GeneDef> absorption_genes_parents = new List<GeneDef>();
foreach (GeneDef geneDef in absorption_genes_list) foreach (GeneDef geneDef in FertilinSourceGenes)
{ {
if(mother.genes != null && mother.genes.HasGene(geneDef)) if(mother.genes != null && mother.genes.HasGene(geneDef))
{
absorption_genes_parents.Add(geneDef); absorption_genes_parents.Add(geneDef);
}
if (father.genes != null && father.genes.HasGene(geneDef)) if (father.genes != null && father.genes.HasGene(geneDef))
{
absorption_genes_parents.Add(geneDef); absorption_genes_parents.Add(geneDef);
}
} }
// Parents had Genes - Pick a random one of them
if (!absorption_genes_parents.NullOrEmpty()) if (!absorption_genes_parents.NullOrEmpty())
{
__result.AddGene(absorption_genes_parents.RandomElement()); __result.AddGene(absorption_genes_parents.RandomElement());
} // Create a fully random one for your little Cumfueled missbreed
else else
{ __result.AddGene(FertilinSourceGenes.RandomElement());
__result.AddGene(absorption_genes_list.RandomElement());
}
} }
} }
} }
private static List<GeneDef> FertilinSourceGenes = new List<GeneDef>() {
GeneDefOf.rjw_genes_drainer,
GeneDefOf.rjw_genes_cum_eater,
GeneDefOf.rjw_genes_vaginal_absorber,
GeneDefOf.rjw_genes_anal_absorber,
GeneDefOf.rjw_genes_cockeater
};
private static bool Has_Fertilin_Source_Gene(List<GeneDef> genes)
{
foreach (GeneDef gene in genes)
{
if (FertilinSourceGenes.Contains(gene))
{
return true;
}
}
return false;
}
} }
} }