A pawn in estrus will prefer partners that can impregnate them, and prefer to use their vagina

This commit is contained in:
lutepickle 2022-04-26 11:49:20 -07:00
parent 9e374f3350
commit 191e4ab5d9
6 changed files with 76 additions and 5 deletions

Binary file not shown.

View File

@ -0,0 +1,33 @@
using Verse;
using rjw;
using rjw.Modules.Interactions.Contexts;
using rjw.Modules.Interactions.Enums;
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
using rjw.Modules.Shared;
using System.Collections.Generic;
namespace RJW_Menstruation.Interactions
{
public class EstrusPartKindUsageRule : IPartPreferenceRule
{
private bool WillingAndAble(Pawn fucker, Pawn fucked)
{
return
(fucked.health?.hediffSet?.HasHediff(VariousDefOf.Hediff_Estrus) ?? false)
&&
PregnancyHelper.CanImpregnate(fucker, fucked);
}
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context)
{
if (WillingAndAble(context.Internals.Submissive.Pawn, context.Internals.Dominant.Pawn))
yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Vagina);
}
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context)
{
if (WillingAndAble(context.Internals.Dominant.Pawn, context.Internals.Submissive.Pawn))
yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Vagina);
}
}
}

View File

@ -1022,6 +1022,14 @@ namespace RJW_Menstruation
}
}
public bool IsInEstrus(bool includeConcealed = false)
{
Pawn pawn = parent.pawn;
if (pawn.Dead) return false;
if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Estrus)) return true;
else return includeConcealed && pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Estrus_Concealed);
}
public void SetEstrus(int days)
{
HediffDef estrusdef;

View File

@ -1,4 +1,9 @@
using HarmonyLib;
using rjw;
using rjw.Modules.Interactions.Internals.Implementation;
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
using rjw.Modules.Shared.Logs;
using System.Collections.Generic;
using System.Reflection;
using Verse;
@ -11,11 +16,16 @@ namespace RJW_Menstruation
{
var har = new Harmony("RJW_Menstruation");
har.PatchAll(Assembly.GetExecutingAssembly());
InjectIntoRjwInteractionServices();
}
private static void InjectIntoRjwInteractionServices()
{
var log = LogManager.GetLogger("StaticConstructorOnStartup");
List<IPartPreferenceRule> partKindUsageRules = Unprivater.GetProtectedValue<List<IPartPreferenceRule>>("_partKindUsageRules", typeof(PartPreferenceDetectorService));
partKindUsageRules.Add(new Interactions.EstrusPartKindUsageRule());
log.Message("Added 1 rule to PartPreferenceDetectorService._partKindUsageRules");
}
}
}

View File

@ -147,6 +147,25 @@ namespace RJW_Menstruation
}
}
[HarmonyPatch(typeof(SexAppraiser), "GetBodyFactor")]
public static class GetBodyFactor_Patch
{
public static void Postfix(ref float __result, Pawn fucker, Pawn fucked)
{
if (!(fucker.health?.hediffSet?.HasHediff(VariousDefOf.Hediff_Estrus) ?? false) || !PregnancyHelper.CanImpregnate(fucked, fucker))
return;
float fert = fucked.health.capacities.GetLevel(xxx.reproduction);
if (fucker.def.defName != fucked.def.defName)
{
if (RJWPregnancySettings.complex_interspecies)
fert *= SexUtility.BodySimilarity(fucker, fucked);
else
fert *= RJWPregnancySettings.interspecies_impregnation_modifier;
}
__result *= (1f + fert / 4);
}
}
[HarmonyPatch(typeof(CompHediffBodyPart), "updatesize")]
public static class Updatesize_Patch
{

View File

@ -61,6 +61,7 @@
<Compile Include="Configurations.cs" />
<Compile Include="Cum.cs" />
<Compile Include="DebugActions.cs" />
<Compile Include="EstrusPartKindUsageRule.cs" />
<Compile Include="HediffComps\HediffComp_InducedOvulator.cs" />
<Compile Include="HediffComps\MenstruationUtility.cs" />
<Compile Include="IngestionOutcomeDoers.cs" />