2022-12-27 12:48:38 +00:00
|
|
|
|
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
|
|
|
|
|
{
|
2022-12-28 12:37:27 +00:00
|
|
|
|
|
2022-12-27 12:48:38 +00:00
|
|
|
|
[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))]
|
|
|
|
|
public static class Patch_LifeForce
|
|
|
|
|
{
|
|
|
|
|
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())
|
|
|
|
|
return;
|
|
|
|
|
|
2022-12-29 15:08:22 +00:00
|
|
|
|
// Exit if pawn has fertilin themself, it won't give any if it has lifeforce themself.
|
|
|
|
|
if (GeneUtility.HasLifeForce(props.pawn))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//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
|
|
|
|
|
//
|
2022-12-29 10:20:17 +00:00
|
|
|
|
float absorb_factor = 0f;
|
|
|
|
|
if (GeneUtility.HasLifeForce(props.partner))
|
2022-12-27 12:48:38 +00:00
|
|
|
|
{
|
2022-12-29 15:08:22 +00:00
|
|
|
|
Pawn succubus = props.partner;
|
2022-12-31 10:42:00 +00:00
|
|
|
|
|
2022-12-29 15:08:22 +00:00
|
|
|
|
if (!props.isRevese)
|
2022-12-28 12:37:27 +00:00
|
|
|
|
{
|
2022-12-29 15:08:22 +00:00
|
|
|
|
if (props.isReceiver)
|
|
|
|
|
{
|
|
|
|
|
// Scenario Dom Succubus, normal
|
|
|
|
|
absorb_factor = BaseDom(props, succubus);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Scenario Sub Succubus, normal
|
|
|
|
|
absorb_factor = BaseSub(props, succubus);
|
|
|
|
|
}
|
2022-12-28 12:37:27 +00:00
|
|
|
|
}
|
2022-12-29 15:08:22 +00:00
|
|
|
|
else
|
2022-12-28 12:37:27 +00:00
|
|
|
|
{
|
2022-12-29 15:08:22 +00:00
|
|
|
|
if (props.isReceiver)
|
2022-12-28 12:37:27 +00:00
|
|
|
|
{
|
2022-12-29 15:08:22 +00:00
|
|
|
|
// Scenario Dom Succubus, Reverse
|
|
|
|
|
absorb_factor = BaseSub(props, succubus);
|
2022-12-28 12:37:27 +00:00
|
|
|
|
}
|
2022-12-29 15:08:22 +00:00
|
|
|
|
else
|
2022-12-28 12:37:27 +00:00
|
|
|
|
{
|
2022-12-29 15:08:22 +00:00
|
|
|
|
// Scenario Sub Succubus, Reverse
|
|
|
|
|
absorb_factor = BaseDom(props, succubus);
|
2022-12-28 12:37:27 +00:00
|
|
|
|
}
|
2022-12-27 12:48:38 +00:00
|
|
|
|
}
|
2022-12-29 15:08:22 +00:00
|
|
|
|
|
|
|
|
|
//If we remove this check fertelin is always lost, but the succubus doesn't always gain any
|
|
|
|
|
if (absorb_factor != 0f)
|
|
|
|
|
{
|
2023-01-17 15:44:08 +00:00
|
|
|
|
TransferFertilin(props, absorb_factor);
|
2022-12-29 10:20:17 +00:00
|
|
|
|
}
|
2022-12-31 10:42:00 +00:00
|
|
|
|
|
2023-01-17 15:44:08 +00:00
|
|
|
|
if (GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_drainer) && !props.pawn.health.hediffSet.HasHediff(HediffDefOf.rjw_genes_succubus_drained))
|
2022-12-31 10:42:00 +00:00
|
|
|
|
{
|
2023-01-17 15:44:08 +00:00
|
|
|
|
props.pawn.health.AddHediff(HediffDefOf.rjw_genes_succubus_drained);
|
2023-01-08 14:51:07 +00:00
|
|
|
|
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(succubus), 0.25f);
|
2022-12-31 10:42:00 +00:00
|
|
|
|
}
|
2022-12-28 12:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-01-17 15:44:08 +00:00
|
|
|
|
public static void TransferFertilin(SexProps props, float absorb_percentage = 1f)
|
2022-12-29 15:08:22 +00:00
|
|
|
|
{
|
2022-12-29 10:20:17 +00:00
|
|
|
|
Pawn_GeneTracker genes = props.partner.genes;
|
2022-12-28 12:37:27 +00:00
|
|
|
|
Gene_LifeForce gene = genes.GetFirstGeneOfType<Gene_LifeForce>();
|
2023-01-17 15:44:08 +00:00
|
|
|
|
Hediff fertilin_lost = props.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.rjw_genes_fertilin_lost);
|
2022-12-31 10:42:00 +00:00
|
|
|
|
//Around quarter get ejected everytime pawn cums
|
|
|
|
|
float multiplier = Rand.Range(0.10f, 0.40f);
|
|
|
|
|
|
|
|
|
|
|
2023-01-17 15:44:08 +00:00
|
|
|
|
//Create a new ferilin_lost hediff or increase it
|
2022-12-31 10:42:00 +00:00
|
|
|
|
if (fertilin_lost == null)
|
2022-12-29 15:08:22 +00:00
|
|
|
|
{
|
2023-01-17 15:44:08 +00:00
|
|
|
|
Hediff new_fertilin_lost = HediffMaker.MakeHediff(HediffDefOf.rjw_genes_fertilin_lost, props.pawn);
|
2022-12-31 10:42:00 +00:00
|
|
|
|
props.pawn.health.AddHediff(new_fertilin_lost);
|
|
|
|
|
new_fertilin_lost.Severity = multiplier;
|
2022-12-29 10:20:17 +00:00
|
|
|
|
}
|
2022-12-29 15:08:22 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2022-12-31 10:42:00 +00:00
|
|
|
|
multiplier *= 1 - fertilin_lost.Severity;
|
|
|
|
|
fertilin_lost.Severity += multiplier;
|
|
|
|
|
}
|
2023-01-17 15:44:08 +00:00
|
|
|
|
|
|
|
|
|
multiplier *= absorb_percentage;
|
2022-12-29 15:08:22 +00:00
|
|
|
|
//Currently taking the sum of all penises, maybe I should just consider one at random
|
2023-01-17 15:44:08 +00:00
|
|
|
|
float valuechange = TotalFertilinAmount(props, multiplier);
|
2023-01-08 14:51:07 +00:00
|
|
|
|
GeneUtility.OffsetLifeForce(GeneUtility.GetLifeForceGene(props.partner), valuechange);
|
2022-12-31 10:42:00 +00:00
|
|
|
|
//gene.Resource.Value += CumUtility.GetTotalFluidAmount(props.pawn) / 100 * absorb_factor * multiplier;
|
2022-12-29 15:08:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-17 15:44:08 +00:00
|
|
|
|
public static float TotalFertilinAmount(SexProps props, float multiplier)
|
|
|
|
|
{
|
|
|
|
|
float total_fluid = CumUtility.GetTotalFluidAmount(props.pawn) / 100;
|
|
|
|
|
|
|
|
|
|
//More in the tank means more to give
|
|
|
|
|
if (props.pawn.Has(Quirk.Messy))
|
|
|
|
|
{
|
|
|
|
|
total_fluid *= 2;
|
|
|
|
|
}
|
|
|
|
|
if (props.pawn.RaceProps.Animal)
|
|
|
|
|
{
|
|
|
|
|
total_fluid *= 0.1f; //Should make this settable in settings
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return total_fluid;
|
|
|
|
|
}
|
2022-12-29 15:08:22 +00:00
|
|
|
|
|
|
|
|
|
public static float BaseDom(SexProps props, Pawn succubus)
|
|
|
|
|
{
|
|
|
|
|
float absorb_factor = 0f;
|
2023-01-17 15:44:08 +00:00
|
|
|
|
if (props.sexType == xxx.rjwSextype.Sixtynine && GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_cum_eater))
|
2022-12-29 15:08:22 +00:00
|
|
|
|
{
|
|
|
|
|
absorb_factor += 1f;
|
|
|
|
|
}
|
|
|
|
|
return absorb_factor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static float BaseSub(SexProps props, Pawn succubus)
|
|
|
|
|
{
|
|
|
|
|
float absorb_factor = 0f;
|
2023-01-17 15:44:08 +00:00
|
|
|
|
if ((props.sexType == xxx.rjwSextype.Oral || props.sexType == xxx.rjwSextype.Fellatio || props.sexType == xxx.rjwSextype.Sixtynine)
|
|
|
|
|
&& GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_cum_eater))
|
2022-12-29 15:08:22 +00:00
|
|
|
|
{
|
|
|
|
|
absorb_factor += 1f;
|
|
|
|
|
}
|
|
|
|
|
else if (props.sexType == xxx.rjwSextype.Vaginal && GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_vaginal_absorber))
|
|
|
|
|
{
|
|
|
|
|
absorb_factor += 1f;
|
|
|
|
|
}
|
|
|
|
|
else if (props.sexType == xxx.rjwSextype.Anal && GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_anal_absorber))
|
|
|
|
|
{
|
|
|
|
|
absorb_factor += 1f;
|
|
|
|
|
}
|
|
|
|
|
else if (props.sexType == xxx.rjwSextype.DoublePenetration)
|
|
|
|
|
{
|
|
|
|
|
if (GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_vaginal_absorber))
|
|
|
|
|
{
|
|
|
|
|
absorb_factor += 0.5f;
|
|
|
|
|
}
|
|
|
|
|
if (GeneUtility.HasGeneNullCheck(succubus, GeneDefOf.rjw_genes_anal_absorber))
|
|
|
|
|
{
|
|
|
|
|
absorb_factor += 0.5f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (props.sexType == xxx.rjwSextype.Scissoring || props.sexType == xxx.rjwSextype.Cunnilingus)
|
|
|
|
|
{
|
|
|
|
|
//with vaginal cum absorbtion
|
|
|
|
|
//absorb_factor += 1f;
|
|
|
|
|
}
|
|
|
|
|
return absorb_factor;
|
2022-12-27 12:48:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|