Compare commits

..

6 commits

51 changed files with 393 additions and 243 deletions

View file

@ -12,6 +12,7 @@ Features:
- RJW Race-Support Compatibility (#12,#13, Shabakur)
- Animal Gene Inheritance Gene-Chance Multiplier per Setting (#13, Shabakur)
- Lots of Debug-Only Logging for Animal Gene Inheritance
- Mod-Settings
Succubus:
@ -22,6 +23,7 @@ Fixes:
- Futa Gene only triggers if Pawn is not a futa already (#2)
- Genitalia Resizing triggers on 20th Birthday (#11)
- RJW-Gene-Inheritance Settings now do things (#13, Shabakur)
- Check for Animals in Orgasm Rush, no Orgasm Rush for and from Animals (#15)
# 1.0.1 (2022-12-20)

View file

@ -78,7 +78,7 @@
<defName>rjw_genes_cockeater</defName>
<label>Cockeater</label>
<labelShortAdj>cockeater</labelShortAdj>
<description>Carriers of this gene are able eat cocks to restore their fertilin supply.</description>
<description>Carriers of this gene are able eat cocks to restore their fertilin supply. Cocks are consumed during that process.</description>
<iconPath>Things/Mote/Heart</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite>
<displayOrderInCategory>11</displayOrderInCategory>
@ -154,7 +154,7 @@
<GeneDef>
<defName>rjw_genes_cum_eater</defName>
<label>Cum eater</label>
<description>Carriers of this gene are able to absorb fertilin through eating cum.</description>
<description>Carriers of this gene are able to absorb fertilin through eating cum. This includes oral sex, eating cum for food or sucking out cumflated pawns. </description>
<iconPath>Things/Mote/Heart</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite>
<displayOrderInCategory>1</displayOrderInCategory>
@ -187,7 +187,7 @@
<GeneDef>
<defName>rjw_genes_drainer</defName>
<label>vitality drainer</label>
<description>Carriers of this gene are able to absorb a great amount of fertilin by draining the vitality of the partner.</description>
<description>Carriers of this gene are able to absorb a great amount of fertilin by draining the vitality of the partner. This is done passively through having sex with a non-drained pawn that does not have this gene.</description>
<iconPath>Things/Mote/Heart</iconPath>
<prerequisite>rjw_genes_lifeforce</prerequisite>
<displayOrderInCategory>4</displayOrderInCategory>

View file

@ -45,13 +45,13 @@
<defName>rjw_genes_succubus_drained</defName>
<hediffClass>HediffWithComps</hediffClass>
<label>Drained</label>
<description>The vitality of this pawn has been drained.</description>
<description>The vitality of this pawn has been drained. Cannot be drained again until fully recovered.</description>
<defaultLabelColor>(1,0,0.5)</defaultLabelColor>
<maxSeverity>1.0</maxSeverity>
<initialSeverity>1.0</initialSeverity>
<comps>
<li Class="HediffCompProperties_SeverityPerDay">
<severityPerDay>-1.0</severityPerDay>
<severityPerDay>-0.25</severityPerDay>
</li>
</comps>
<stages>
@ -63,6 +63,10 @@
<offset>-0.1</offset>
</li>
</capMods>
<restFallFactorOffset>0.1</restFallFactorOffset>
<statOffsets>
<WorkSpeedGlobal>-0.1</WorkSpeedGlobal>
</statOffsets>
</li>
<li>
<minSeverity>0.5</minSeverity>
@ -73,6 +77,11 @@
<offset>-0.2</offset>
</li>
</capMods>
<hungerRateFactorOffset>0.05</hungerRateFactorOffset>
<restFallFactorOffset>0.20</restFallFactorOffset>
<statOffsets>
<WorkSpeedGlobal>-0.1</WorkSpeedGlobal>
</statOffsets>
</li>
<li>
<minSeverity>0.8</minSeverity>
@ -80,9 +89,15 @@
<capMods>
<li>
<capacity>Consciousness</capacity>
<offset>-0.4</offset>
<offset>-0.3</offset>
</li>
</capMods>
<statOffsets>
<WorkSpeedGlobal>-0.2</WorkSpeedGlobal>
</statOffsets>
<vomitMtbDays>0.05</vomitMtbDays>
<hungerRateFactorOffset>0.1</hungerRateFactorOffset>
<restFallFactorOffset>0.35</restFallFactorOffset>
</li>
</stages>
</HediffDef>

View file

@ -11,7 +11,7 @@
<JobDef>
<defName>rjw_genes_lifeforce_healpussy</defName>
<driverClass>RJW_Genes.JobDriver_CastAbilityAfterSex</driverClass>
<reportString>Healing someone with sex.</reportString>
<reportString>Tending someones wounds with sex.</reportString>
<casualInterruptible>false</casualInterruptible>
</JobDef>

View file

@ -10,7 +10,7 @@
<stages>
<li>
<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>
</li>
</stages>

View file

@ -11,7 +11,7 @@ using rjw;
namespace RJW_BGS
{
[HarmonyPatch(typeof(Hediff_BasePregnancy), "Initialize")]
public static class PatchRJWBestialityPregnancyUtility
public static class Patch_RJW_BestialityPregnancyUtility
{
[HarmonyPostfix]
public static void AddGenes(Pawn mother, Pawn dad, ref Hediff_BasePregnancy __instance)

View file

@ -7,7 +7,7 @@ using rjw;
namespace RJW_BGS
{
[HarmonyPatch(typeof(Hediff_InsectEgg), "GiveBirth")]
public static class PatchRJWHediffInsect_Egg
public static class Patch_RJW_HediffInsect_Egg
{
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)

View file

@ -19,7 +19,7 @@ namespace RJW_BGS
//typeof(bool)
}
)]
public static class PatchVanillaPregnancyUtility
public static class Patch_Vanilla_PregnancyUtility
{
[HarmonyPostfix]
public static void AnimalInheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)

View file

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

View file

@ -38,6 +38,7 @@ namespace RJW_Genes
}
}
public static bool HasLowLifeForce(Pawn pawn)
{
if (HasLifeForce(pawn))
@ -118,5 +119,7 @@ namespace RJW_Genes
public static bool HasParalysingKiss(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_paralysingkiss); }
public static bool HasSeduce(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_seduce); }
public static bool IsSexualDrainer(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_drainer); }
public static bool IsCumEater(Pawn pawn) { return HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_cum_eater); }
}
}

View file

@ -1,16 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using UnityEngine;
using Verse;
using RimWorld;
using rjw;
using rjw.Modules.Interactions.Helpers;
namespace RJW_Genes
{
/// <summary>
/// The CockEater Ability bites off the first found non-artifical cock of an target pawn.
/// It will restore {MINIMUM_LIFEFORCE_GAIN} multiplied by up to 2-times the Cock-Size.
/// Consuming a "towering" cock will give 2*{MINIMUM_LIFEFORCE_GAIN}, resulting in default 0.5f LifeForce.
/// This number is reduced for consuming animals by Settings.
///
/// Balancing note: With the Cock-Eaters a drain of 0.08 is normal per day. This means 1 average cock should hold for 3-4 days of fertilin-fuel and half a day for an animal.
/// </summary>
public class CompAbilityEffect_CockEater : CompAbilityEffect
{
private new CompProperties_AbilityCockEater Props
@ -20,16 +21,20 @@ namespace RJW_Genes
return (CompProperties_AbilityCockEater)this.props;
}
}
public const float MINIMUM_LIFEFORCE_GAIN = 0.25f;
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
{
base.Apply(target, dest);
Pawn pawn = target.Pawn;
if (pawn == null)
Pawn CockBiter = this.parent.pawn;
Pawn CockBittenPawn = target.Pawn;
if (CockBittenPawn == null)
{
return;
}
var partBPR = Genital_Helper.get_genitalsBPR(pawn);
var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR);
var partBPR = Genital_Helper.get_genitalsBPR(CockBittenPawn);
var parts = Genital_Helper.get_PartsHediffList(CockBittenPawn, partBPR);
if (!parts.NullOrEmpty())
{
foreach (Hediff part in parts)
@ -39,50 +44,67 @@ namespace RJW_Genes
if (Genital_Helper.is_penis(part))
{
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(this.parent.pawn), part.Severity); ;
pawn.health.RemoveHediff(part);
pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.rjw_genes_cock_eaten, pawn, null);
break; //Only one penis at the time
float gained_lifeforce = MINIMUM_LIFEFORCE_GAIN * (1 + part.Severity);
if (CockBittenPawn.IsAnimal())
{
gained_lifeforce *= RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor;
}
// Increase LifeForce for Biter
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(CockBiter), gained_lifeforce);
// Handle Damage for Bitten
CockBittenPawn.health.RemoveHediff(part);
CockBittenPawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.rjw_genes_cock_eaten, CockBittenPawn, null);
//Only one penis at the time
break;
}
}
}
}
/// <summary>
/// For validity, there are a few checks:
/// 1. Target has Penis
/// 2. Target is either Colonist / Prisoner
/// 3. If the Target is an enemy, it must be downed.
/// </summary>
public override bool Valid(LocalTargetInfo target, bool throwMessages = false)
{
Pawn pawn = target.Pawn;
if (pawn != null)
Pawn CockBiteTarget = target.Pawn;
if (CockBiteTarget != null)
{
bool flag = pawn.Faction == this.parent.pawn.Faction || pawn.IsPrisonerOfColony;
bool flag2 = pawn.HostileTo(this.parent.pawn);
bool flag3 = pawn.Downed;
if (!flag && !(flag2 && flag3))
bool CockBiteTargetIsColonistOrPrisoner = CockBiteTarget.Faction == this.parent.pawn.Faction || CockBiteTarget.IsPrisonerOfColony;
bool CockBiteTargetIsHostile = CockBiteTarget.HostileTo(this.parent.pawn);
bool CockBiteTargetIsDowned = CockBiteTarget.Downed;
if (!CockBiteTargetIsColonistOrPrisoner && !(CockBiteTargetIsHostile && CockBiteTargetIsDowned))
{
if (throwMessages)
{
if(flag2 && !flag3)
if(CockBiteTargetIsHostile && !CockBiteTargetIsDowned)
{
Messages.Message(pawn.Name + " is hostile, but not downed.", pawn, MessageTypeDefOf.RejectInput, false);
Messages.Message(CockBiteTarget.Name + " is hostile, but not downed.", CockBiteTarget, MessageTypeDefOf.RejectInput, false);
}
else if (!flag)
else if (!CockBiteTargetIsColonistOrPrisoner)
{
Messages.Message(pawn.Name + " is not a part of the colony or hostile.", pawn, MessageTypeDefOf.RejectInput, false);
Messages.Message(CockBiteTarget.Name + " is not a part of the colony or hostile.", CockBiteTarget, MessageTypeDefOf.RejectInput, false);
}
}
return false;
}
if (!Genital_Helper.has_penis_fertile(pawn))
if (!Genital_Helper.has_penis_fertile(CockBiteTarget))
{
if (throwMessages)
{
Messages.Message(pawn.Name + " has no penis", pawn, MessageTypeDefOf.RejectInput, false);
Messages.Message(CockBiteTarget.Name + " has no penis", CockBiteTarget, MessageTypeDefOf.RejectInput, false);
}
return false;
}
}
return base.Valid(target, throwMessages);
}
public override bool GizmoDisabled(out string reason)
{
Pawn_GeneTracker genes = this.parent.pawn.genes;

View file

@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
using Verse;
using UnityEngine;
using RimWorld;
using rjw;
using rjw.Modules.Interactions.Helpers;
namespace RJW_Genes
{
@ -31,11 +25,8 @@ namespace RJW_Genes
bool any_wound_tended = AbilityUtility.Heal(pawn, this.Props.tendQualityRange);
if (any_wound_tended)
{
MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, "Sex healed wounds", 3.65f);
//pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.Pussy_Healed, pawn, null);
MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, "Sex tended wounds", 3.65f);
}
//this.AfterSex(any_wound_tended);
//FleckMaker.AttachedOverlay(pawn, FleckDefOf.FlashHollow, Vector3.zero, 1.5f, -1f);
}
//Not yet implemented, but the heal should also trigger after normal sex
@ -77,7 +68,7 @@ namespace RJW_Genes
}
return false;
}
//AbilityUtility.ValidateHasTendableWound(pawn, throwMessages, this.parent);
//TODO: Only make pawns targetable that have tendable wounds
}
return base.Valid(target, throwMessages);

View file

@ -1,23 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using RimWorld;
using Verse;
namespace RJW_Genes
{
/// <summary>
/// This class checks for pawns with LifeForce and Cumeater Gene to add Fertilin when eating cum (the Item from RJW-Sexperience).
/// </summary>
public class IngestionOutcomeDoer_LifeForceOffset : IngestionOutcomeDoer
{
{
public const float FERTILIN_PER_UNIT = 1f;
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 * this.FertilinPerUnit / 100;
float num = ingested.stackCount * FERTILIN_PER_UNIT / 100;
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(pawn), num);
}
}
public float FertilinPerUnit = 1f;
}
}

View file

@ -39,7 +39,7 @@ namespace RJW_Genes
{
return null;
}
int num = Mathf.RoundToInt(((gene_lifeforce.targetValue - gene_lifeforce.Value) * 100 + 10) / ingestionOutcomeDoer.FertilinPerUnit);
int num = Mathf.RoundToInt(((gene_lifeforce.targetValue - gene_lifeforce.Value) * 100 + 10) / IngestionOutcomeDoer_LifeForceOffset.FERTILIN_PER_UNIT);
if (gatheredCum != null && num > 0)
{
Job job = JobMaker.MakeJob(RimWorld.JobDefOf.Ingest, gatheredCum);

View file

@ -1,57 +0,0 @@
using HarmonyLib;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
namespace RJW_Genes
{
//[HarmonyPatch(typeof(JobDriver_Sex), nameof(JobDriver_Sex.ChangePsyfocus))]
public static class Patch_SexTicks_ChangePsyfocus
{
//Using ChangePsyfocus as it is something that fires every 60 ticks
public static void Postfix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target)
{
if (__instance.Sexprops.sexType == xxx.rjwSextype.Cunnilingus)
{
if (target != null)
{
Pawn pawn2 = target as Pawn;
if (pawn2 != null)
{
//We need to know who the pawn on top is and if reverse we need to make the sub the pawn on top
if (__instance.Sexprops.isRevese)
{
DrinkCumflation(pawn2, pawn);
}
else
{
//
DrinkCumflation(pawn, pawn2);
return;
}
}
}
}
}
public static void DrinkCumflation(Pawn dom, Pawn sub)
{
if (GeneUtility.HasLifeForce(sub) && GeneUtility.HasGeneNullCheck(sub,GeneDefOf.rjw_genes_cum_eater)&& dom.health.hediffSet.HasHediff(HediffDef.Named("Cumflation")))
{
Hediff cumflation = dom.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Cumflation"));
Gene_LifeForce gene_LifeForce = sub.genes.GetFirstGeneOfType<Gene_LifeForce>();
cumflation.Severity -= 0.1f;
gene_LifeForce.Resource.Value += 0.05f;
}
}
//Maybe I can store gene and hediff so I dont need to look them up every time
}
}

View file

@ -1,62 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using HarmonyLib;
using RimWorld;
using Verse;
namespace RJW_Genes
{
/// <summary>
/// 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
/// the genes are determined and "simply added".
/// </summary>
[HarmonyPatch(typeof(PregnancyUtility), "GetInheritedGeneSet", new Type[]
{
typeof(Pawn),
typeof(Pawn),
//typeof(bool)
}
)]
public static class PatchVanillaPregnancyFertilin
{
[HarmonyPostfix]
public static void InheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)
{
//Also make a setting for this
if (__result.GenesListForReading.Contains(GeneDefOf.rjw_genes_lifeforce))
{
List<GeneDef> gene_list = __result.GenesListForReading;
//If 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)
|| 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
, GeneDefOf.rjw_genes_vaginal_absorber, GeneDefOf.rjw_genes_anal_absorber };
List<GeneDef> absorption_genes_parents = new List<GeneDef>();
foreach (GeneDef geneDef in absorption_genes_list)
{
if(mother.genes != null && mother.genes.HasGene(geneDef))
{
absorption_genes_parents.Add(geneDef);
}
if (father.genes != null && father.genes.HasGene(geneDef))
{
absorption_genes_parents.Add(geneDef);
}
}
if (!absorption_genes_parents.NullOrEmpty())
{
__result.AddGene(absorption_genes_parents.RandomElement());
}
else
{
__result.AddGene(absorption_genes_list.RandomElement());
}
}
}
}
}
}

View file

@ -1,18 +1,19 @@
using HarmonyLib;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
namespace RJW_Genes
{
/// <summary>
/// This Patch hooks after "SatisfyPersonal"(i.E. when the pawn finished fucking) and covers LifeForceGain.
/// If the pawn has LifeForce, all relevant Genes are checked and applied.
/// </summary>
[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))]
public static class Patch_LifeForce
public static class Patch_SatisfyPersonal_LifeForceGain
{
public const float LIFEFORCE_GAINED_FROM_DRAINER_GENE = 0.25f;
public static void Postfix(SexProps props)
{
// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation)
@ -28,23 +29,22 @@ namespace RJW_Genes
//Summary//
//We use the positions of the pawn (dom or sub) and based on that which interactions will transfer fertilin
//By checking isreceiver we know if the succubus is the dom or the sub and if the situation is reverse we also swap the function we use
//
float absorb_factor = 0f;
if (GeneUtility.HasLifeForce(props.partner))
{
Pawn succubus = props.partner;
Pawn PawnWithLifeForce = props.partner;
if (!props.isRevese)
{
if (props.isReceiver)
{
// Scenario Dom Succubus, normal
absorb_factor = BaseDom(props, succubus);
absorb_factor = BaseDom(props, PawnWithLifeForce);
}
else
{
// Scenario Sub Succubus, normal
absorb_factor = BaseSub(props, succubus);
absorb_factor = BaseSub(props, PawnWithLifeForce);
}
}
else
@ -52,32 +52,40 @@ namespace RJW_Genes
if (props.isReceiver)
{
// Scenario Dom Succubus, Reverse
absorb_factor = BaseSub(props, succubus);
absorb_factor = BaseSub(props, PawnWithLifeForce);
}
else
{
// Scenario Sub Succubus, Reverse
absorb_factor = BaseDom(props, succubus);
absorb_factor = BaseDom(props, PawnWithLifeForce);
}
}
//If we remove this check fertelin is always lost, but the succubus doesn't always gain any
// If we remove this check fertilin is always lost, but the succubus doesn't always gain any
if (absorb_factor != 0f)
{
TransferFertilin(props, absorb_factor);
}
if (GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_drainer) && !props.pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_succubus_drained))
// Handle Gene: Sexual_Drainer
// to be drained, a pawn must not-be-drained-already and drainers cannot be drained either.
if (GeneUtility.IsSexualDrainer(PawnWithLifeForce)
&& !props.pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_succubus_drained)
&& !GeneUtility.IsSexualDrainer(props.pawn))
{
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
ModLog.Message($"{props.pawn.Name} has been (sexually) drained by {PawnWithLifeForce.Name}");
props.pawn.health.AddHediff(HediffDefOf.rjw_genes_succubus_drained);
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(succubus), 0.25f);
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(PawnWithLifeForce), LIFEFORCE_GAINED_FROM_DRAINER_GENE);
}
}
}
public static void TransferFertilin(SexProps props, float absorb_percentage = 1f)
{
Pawn_GeneTracker genes = props.partner.genes;
Gene_LifeForce gene = genes.GetFirstGeneOfType<Gene_LifeForce>();
Hediff fertilin_lost = props.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_fertilin_lost);
//Around quarter get ejected everytime pawn cums
float multiplier = Rand.Range(0.10f, 0.40f);
@ -99,8 +107,15 @@ namespace RJW_Genes
multiplier *= absorb_percentage;
//Currently taking the sum of all penises, maybe I should just consider one at random
float valuechange = TotalFertilinAmount(props, multiplier);
if (props.partner.IsAnimal())
{
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
ModLog.Message($"Fertilin-Source of {props.pawn.Name} was an Animal, Fertilin-Gain is being adjusted by {RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor}%");
valuechange *= RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor;
}
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(props.partner), valuechange);
//gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier;
}
public static float TotalFertilinAmount(SexProps props, float multiplier)
@ -120,39 +135,51 @@ namespace RJW_Genes
return total_fluid;
}
public static float BaseDom(SexProps props, Pawn succubus)
/// <summary>
/// Handles the Case that the Life-Force wielder initiated the Sex (They are "Dom").
/// </summary>
/// <param name="props">The summary of the sex act, used for checking conditions.</param>
/// <param name="PawnWithLifeForce">The pawn that might gain LifeForce through this method.</param>
/// <returns>A factor between 0 and 1 how much of output-fertilin will be used for input-lifeforce</returns>
public static float BaseDom(SexProps props, Pawn PawnWithLifeForce)
{
float absorb_factor = 0f;
if (props.sexType == xxx.rjwSextype.Sixtynine && GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_cum_eater))
if (props.sexType == xxx.rjwSextype.Sixtynine && GeneUtility.IsCumEater(PawnWithLifeForce))
{
absorb_factor += 1f;
}
return absorb_factor;
}
public static float BaseSub(SexProps props, Pawn succubus)
/// <summary>
/// Handles the Case that the Life-Force wielder got initiated into sex (They are "Sub").
/// </summary>
/// <param name="props">The summary of the sex act, used for checking conditions.</param>
/// <param name="PawnWithLifeForce">The pawn that might gain LifeForce through this method.</param>
/// <returns>A factor between 0 and 1 how much of output-fertilin will be used for input-lifeforce</returns>
public static float BaseSub(SexProps props, Pawn PawnWithLifeForce)
{
float absorb_factor = 0f;
if ((props.sexType == xxx.rjwSextype.Oral || props.sexType == xxx.rjwSextype.Fellatio || props.sexType == xxx.rjwSextype.Sixtynine)
&& GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_cum_eater))
&& GeneUtility.IsCumEater(PawnWithLifeForce))
{
absorb_factor += 1f;
}
else if (props.sexType == xxx.rjwSextype.Vaginal && GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_vaginal_absorber))
else if (props.sexType == xxx.rjwSextype.Vaginal && GeneUtility.HasGeneNullCheck(PawnWithLifeForce, GeneDefOf.rjw_genes_vaginal_absorber))
{
absorb_factor += 1f;
}
else if (props.sexType == xxx.rjwSextype.Anal && GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_anal_absorber))
else if (props.sexType == xxx.rjwSextype.Anal && GeneUtility.HasGeneNullCheck(PawnWithLifeForce, GeneDefOf.rjw_genes_anal_absorber))
{
absorb_factor += 1f;
}
else if (props.sexType == xxx.rjwSextype.DoublePenetration)
{
if (GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_vaginal_absorber))
if (GeneUtility.HasGeneNullCheck(PawnWithLifeForce, GeneDefOf.rjw_genes_vaginal_absorber))
{
absorb_factor += 0.5f;
}
if (GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_anal_absorber))
if (GeneUtility.HasGeneNullCheck(PawnWithLifeForce, GeneDefOf.rjw_genes_anal_absorber))
{
absorb_factor += 0.5f;
}

View file

@ -0,0 +1,62 @@
using HarmonyLib;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
namespace RJW_Genes
{
/// <summary>
/// This patch enables cum-eater pawns to drain cumflations for more fertilin drain by passively having sex.
/// It is hooked after RJWs Change-Psyfocus so that pawns that are having prolonged sex (e.g. by overdrive) can fully drain the cumflation over time.
///
/// It is conditionally loaded only when LicentiaLabs is enabled, as this is the necessary source for cumflation-hediffs.
/// The patched function is: [HarmonyPatch(typeof(JobDriver_Sex), nameof(JobDriver_Sex.ChangePsyfocus))]
/// </summary>
public static class Patch_SexTicks_ChangePsyfocus
{
public const float LIFEFORCE_GAIN_PER_TICK = 0.05f;
public const float CUMFLATION_SEVERITY_LOSS_PER_TICK = 0.1f;
//Using ChangePsyfocus as it is something that fires every 60 ticks
public static void Postfix(ref JobDriver_Sex __instance, ref Pawn pawn, ref Thing target)
{
SexProps props = __instance.Sexprops;
if (props != null && props.sexType == xxx.rjwSextype.Cunnilingus && props.partner != null && target != null)
{
Pawn pawn2 = target as Pawn;
// Case 1: Pawn is "drinking" and has CumEater Gene
if (props.isRevese && GeneUtility.IsCumEater(pawn))
{
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
ModLog.Message($"{pawn.Name} is draining {pawn2.Name}'s cumflation for additional fertilin (CumEater-Gene ChangePsyFocus-Trigger).");
DrinkCumflation(pawn2, pawn);
}
// Case 2: Pawn2 is "drinking" and has CumEater Gene
else if (GeneUtility.IsCumEater(pawn2))
{
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
ModLog.Message($"{pawn.Name} is draining {pawn2.Name}'s cumflation for additional fertilin (CumEater-Gene ChangePsyFocus-Trigger).");
DrinkCumflation(pawn, pawn2);
}
}
}
public static void DrinkCumflation(Pawn source, Pawn consumer)
{
if (GeneUtility.HasLifeForce(consumer) && GeneUtility.IsCumEater(consumer)
&& source.health.hediffSet.HasHediff(HediffDef.Named("Cumflation")))
{
Hediff cumflation = source.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Cumflation"));
Gene_LifeForce gene_LifeForce = consumer.genes.GetFirstGeneOfType<Gene_LifeForce>();
cumflation.Severity = Math.Max(0f,cumflation.Severity - CUMFLATION_SEVERITY_LOSS_PER_TICK);
gene_LifeForce.Resource.Value += LIFEFORCE_GAIN_PER_TICK;
}
}
}
}

View file

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using HarmonyLib;
using RimWorld;
using Verse;
namespace RJW_Genes
{
/// <summary>
/// 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
/// the genes are determined and "simply added".
///
/// This fixes the potential problem that Pawns could inherit Fertilin, but no gene to gain Fertilin.
/// </summary>
[HarmonyPatch(typeof(PregnancyUtility), "GetInheritedGeneSet", new Type[]
{
typeof(Pawn),
typeof(Pawn)
}
)]
public static class Patch_Vanilla_Inheritance_Fertilin
{
[HarmonyPostfix]
public static void InheritedGenes(Pawn father, Pawn mother, ref GeneSet __result)
{
//Also make a setting for this
if (__result.GenesListForReading.Contains(GeneDefOf.rjw_genes_lifeforce))
{
List<GeneDef> babies_genes = __result.GenesListForReading;
//If there is no absorption gene get one from the parents, else a random one
if(!Has_Fertilin_Source_Gene(babies_genes))
{
if (RJW_Genes_Settings.rjw_genes_detailed_debug)
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>();
foreach (GeneDef geneDef in FertilinSourceGenes)
{
if(mother.genes != null && mother.genes.HasGene(geneDef))
absorption_genes_parents.Add(geneDef);
if (father.genes != null && father.genes.HasGene(geneDef))
absorption_genes_parents.Add(geneDef);
}
// Parents had Genes - Pick a random one of them
if (!absorption_genes_parents.NullOrEmpty())
__result.AddGene(absorption_genes_parents.RandomElement());
// Create a fully random one for your little Cumfueled missbreed
else
__result.AddGene(FertilinSourceGenes.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;
}
}
}

View file

@ -19,8 +19,12 @@ namespace RJW_Genes
public static void Postfix(SexProps props)
{
// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation)
if (props.pawn == null || !props.hasPartner())
// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Masturbation or other nieche-cases)
if (props == null || props.pawn == null || !props.hasPartner())
return;
// Exit for Animals - Animals can't get or trigger Orgasm Rushes. Fixes #15
if (props.pawn.IsAnimal() || props.partner.IsAnimal())
return;
if (props.pawn.genes != null && props.pawn.genes.HasGene(GeneDefOf.rjw_genes_orgasm_rush))

View file

@ -27,6 +27,7 @@ namespace RJW_Genes
// Gene: Generous Donor [Postfix Patch]
harmony.Patch(AccessTools.Method(typeof(LicentiaLabs.CumflationHelper), nameof(LicentiaLabs.CumflationHelper.TransferNutrition)),
postfix: new HarmonyMethod(typeof(Patch_TransferNutrition), nameof(Patch_TransferNutrition.Postfix)));
// Gene: CumEater [Postfix Patch]
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)));
}

View file

@ -65,14 +65,14 @@
<ItemGroup>
<Compile Include="Animal_Inheritance\Harmony_Init.cs" />
<Compile Include="Animal_Inheritance\InheritanceUtility.cs" />
<Compile Include="Animal_Inheritance\PatchRJWBestialityPregnancyUtility.cs" />
<Compile Include="Animal_Inheritance\PatchRJWHediffInsect_Egg.cs" />
<Compile Include="Animal_Inheritance\PatchVanillaPregnancyUtility.cs" />
<Compile Include="Animal_Inheritance\RaceGeneDef.cs" />
<Compile Include="Animal_Inheritance\RaceGeneDef_Helper.cs" />
<Compile Include="Animal_Inheritance\RJW_BGSSettings.cs" />
<Compile Include="Animal_Inheritance\RJW_BGSSettingsController.cs" />
<Compile Include="Animal_Inheritance\BestialityGeneInheritanceDef.cs" />
<Compile Include="Animal_Inheritance\Patches\Patch_RJW_BestialityPregnancyUtility.cs" />
<Compile Include="Animal_Inheritance\Patches\Patch_RJW_HediffInsect_Egg.cs" />
<Compile Include="Animal_Inheritance\Patches\Patch_Vanilla_PregnancyUtility.cs" />
<Compile Include="Animal_Inheritance\Defs\RaceGeneDef.cs" />
<Compile Include="Animal_Inheritance\Defs\RaceGeneDef_Helper.cs" />
<Compile Include="Animal_Inheritance\Settings\RJW_BGSSettings.cs" />
<Compile Include="Animal_Inheritance\Settings\RJW_BGSSettingsController.cs" />
<Compile Include="Animal_Inheritance\Defs\BestialityGeneInheritanceDef.cs" />
<Compile Include="Common\ModLog.cs" />
<Compile Include="GeneDefOf.cs" />
<Compile Include="Genes\Breeding\Gene_MechBreeder.cs" />
@ -121,60 +121,62 @@
<Compile Include="Genes\Genitalia\Gene_EquineGenitalia.cs" />
<Compile Include="Genes\Genitalia\GenitaliaChanger.cs" />
<Compile Include="Genes\Life_Force\Abilities\AbilityUtility.cs" />
<Compile Include="Genes\Life_Force\Alert_LowFertilin.cs" />
<Compile Include="Genes\Life_Force\UI\Alert_LowFertilin.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_Seduce.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_LifeForceCost.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_CockEater.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompProperties_Seduce.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityCockEater.cs" />
<Compile Include="Genes\Life_Force\Gene_LifeForceDrain.cs" />
<Compile Include="Genes\Life_Force\Genes\Gene_LifeForceDrain.cs" />
<Compile Include="Genes\Life_Force\HediffCompProperties_SeverityFromFertilin.cs" />
<Compile Include="Genes\Life_Force\HediffComp_SeverityFromFertilin.cs" />
<Compile Include="Genes\Life_Force\IncidentWorker_SuccubusDreamVisit.cs" />
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusDreamVisit.cs" />
<Compile Include="Genes\Life_Force\IngestionOutcomeDoer_LifeForceOffset.cs" />
<Compile Include="Genes\Life_Force\JobGiver_TryQuickieWith.cs" />
<Compile Include="Genes\Life_Force\JobGivers\JobGiver_TryQuickieWith.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_Flirt.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_SexOnSpotReceiver.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_SexOnSpot.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_Seduced.cs" />
<Compile Include="Genes\Life_Force\JobGiver_Flirt.cs" />
<Compile Include="Genes\Life_Force\LordJob_SuccubusVisit.cs" />
<Compile Include="Genes\Life_Force\JobGivers\JobGiver_Flirt.cs" />
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" />
<Compile Include="Genes\Life_Force\LordToil_Flirt.cs" />
<Compile Include="Genes\Life_Force\Patch_SexTicks_ChangePsyfocus.cs" />
<Compile Include="Genes\Life_Force\Patch_Vanilla_Inheritance_Fertilin.cs" />
<Compile Include="Genes\Life_Force\ThinkNode_ConditionalCannotInteract.cs" />
<Compile Include="Genes\Life_Force\ThinkNode_ConditionalLowLifeForce.cs" />
<Compile Include="Genes\Life_Force\ThinkNode_ConditionalCritcalLifeForce.cs" />
<Compile Include="Genes\Life_Force\JobGiver_GetLifeForce.cs" />
<Compile Include="Genes\Life_Force\ThinkNode_NewFlirtTarget.cs" />
<Compile Include="Genes\Life_Force\Patches\Patch_SexTicks_ChangePsyfocus.cs" />
<Compile Include="Genes\Life_Force\Patches\Patch_Vanilla_Inheritance_Fertilin.cs" />
<Compile Include="Genes\Life_Force\ThinkNodes\ThinkNode_ConditionalCannotInteract.cs" />
<Compile Include="Genes\Life_Force\ThinkNodes\ThinkNode_ConditionalLowLifeForce.cs" />
<Compile Include="Genes\Life_Force\ThinkNodes\ThinkNode_ConditionalCritcalLifeForce.cs" />
<Compile Include="Genes\Life_Force\JobGivers\JobGiver_GetLifeForce.cs" />
<Compile Include="Genes\Life_Force\ThinkNodes\ThinkNode_NewFlirtTarget.cs" />
<Compile Include="Genes\Special\Patch_AgeDrain.cs" />
<Compile Include="Interactions\CompAbility_SexInteractionRequirements.cs" />
<Compile Include="Interactions\SuccubusTailjob\CompAbility_SexInteractionRequirements.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompAbilityEffect_PussyHeal.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityLifeForceCost.cs" />
<Compile Include="Interactions\CompProperties_SexInteractionRequirements.cs" />
<Compile Include="Interactions\SuccubusTailjob\CompProperties_SexInteractionRequirements.cs" />
<Compile Include="Genes\Life_Force\Abilities\CompProperties_AbilityPussyHeal.cs" />
<Compile Include="Genes\Life_Force\GeneGizmo_ResourceLifeForce.cs" />
<Compile Include="Genes\Life_Force\UI\GeneGizmo_ResourceLifeForce.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_CastAbilityAfterSex.cs" />
<Compile Include="Genes\Life_Force\LifeForceMentalState.cs" />
<Compile Include="Genes\Life_Force\LifeForceMentalStateWorker.cs" />
<Compile Include="Genes\Life_Force\JobGiver_LifeForce_RandomRape.cs" />
<Compile Include="Genes\Life_Force\LifeForceMentalBreakWorker.cs" />
<Compile Include="Genes\Life_Force\Gene_LifeForce.cs" />
<Compile Include="Genes\Life_Force\MentalStates\LifeForceMentalState.cs" />
<Compile Include="Genes\Life_Force\MentalStates\LifeForceMentalStateWorker.cs" />
<Compile Include="Genes\Life_Force\JobGivers\JobGiver_LifeForce_RandomRape.cs" />
<Compile Include="Genes\Life_Force\MentalStates\LifeForceMentalBreakWorker.cs" />
<Compile Include="Genes\Life_Force\Genes\Gene_LifeForce.cs" />
<Compile Include="Genes\RJW_Gene.cs" />
<Compile Include="Genes\Genitalia\GenitaliaUtility.cs" />
<Compile Include="Genes\Special\Gene_Aphrodisiac_Pheromones.cs" />
<Compile Include="Genes\Life_Force\Patch_LifeForce.cs" />
<Compile Include="Genes\Life_Force\Patches\Patch_SatisfyPersonal_LifeForceGain.cs" />
<Compile Include="Genes\Special\Patch_OrgasmRush.cs" />
<Compile Include="Genes\Special\Patch_Youth_Fountain.cs" />
<Compile Include="HarmonyInit.cs" />
<Compile Include="HediffDefOf.cs" />
<Compile Include="Interactions\CustomSexInteraction_Helper.cs" />
<Compile Include="Interactions\GenesPartKindUsageRule.cs" />
<Compile Include="Interactions\SubSuccubusTailCustomRequirementHandler.cs" />
<Compile Include="Interactions\DomSuccubusTailCustomRequirementHandler.cs" />
<Compile Include="Interactions\SuccubusTailjob\CustomSexInteraction_Helper.cs" />
<Compile Include="Interactions\SuccubusTailjob\GenesPartKindUsageRule.cs" />
<Compile Include="Interactions\SuccubusTailjob\SubSuccubusTailCustomRequirementHandler.cs" />
<Compile Include="Interactions\SuccubusTailjob\DomSuccubusTailCustomRequirementHandler.cs" />
<Compile Include="JobDefOf.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RJW_Genes.cs" />
<Compile Include="Settings\RJW_Genes_Settings.cs" />
<Compile Include="Settings\RJW_Genes_SettingsController.cs" />
<Compile Include="ThoughtDefOf.cs" />
</ItemGroup>
<ItemGroup>

View file

@ -0,0 +1,38 @@
using System;
using Verse;
using UnityEngine;
namespace RJW_Genes
{
public class RJW_Genes_Settings : ModSettings
{
public static void DoWindowContents(Rect inRect)
{
//Copied from RJW settings mostly
Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f);
Rect rect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + 300f);
//Widgets.BeginScrollView(outRect, ref RJWSettings.scrollPosition, rect, true);
Listing_Standard listing_Standard = new Listing_Standard();
listing_Standard.maxOneColumn = true;
listing_Standard.ColumnWidth = rect.width / 2.05f;
listing_Standard.Begin(rect);
listing_Standard.Gap(24f);
listing_Standard.Label("Fertlin-Gain from Animals" + ": " +
Math.Round((double)(RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor * 100f), 0).ToString() + "%", -1f, "of fertilin gained (compared to human-baseline).");
RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor = listing_Standard.Slider(RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, 0f, 3f);
listing_Standard.Gap(5f);
listing_Standard.CheckboxLabeled("detailed-debug", ref rjw_genes_detailed_debug, "Adds detailed information to the log about interactions and genes.", 0f, 1f);
listing_Standard.End();
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look<float>(ref RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, "rjw_genes_fertilin_from_animals_factor", RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, true);
Scribe_Values.Look<bool>(ref RJW_Genes_Settings.rjw_genes_detailed_debug, "rjw_genes_detailed_debug", RJW_Genes_Settings.rjw_genes_detailed_debug, true);
}
public static bool rjw_genes_detailed_debug = false;
public static float rjw_genes_fertilin_from_animals_factor = 0.1f;
}
}

View file

@ -0,0 +1,22 @@
using Verse;
using UnityEngine;
namespace RJW_Genes
{
public class RJW_Genes_SettingsController : Mod
{
public RJW_Genes_SettingsController(ModContentPack content) : base(content)
{
base.GetSettings<RJW_Genes_Settings>();
}
public override string SettingsCategory()
{
return "RJW Genes - General";
}
public override void DoSettingsWindowContents(Rect inRect)
{
RJW_Genes_Settings.DoWindowContents(inRect);
}
}
}