mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Log lust changes
This commit is contained in:
parent
8b2d1b3dc7
commit
02bcd44a90
4 changed files with 211 additions and 209 deletions
|
@ -1,4 +1,7 @@
|
|||
using HarmonyLib;
|
||||
extern alias BaseSexperience;
|
||||
using BaseSexperience::RJWSexperience.ExtensionMethods;
|
||||
using BaseSexperience::RJWSexperience;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
using Verse;
|
||||
|
||||
|
@ -15,11 +18,11 @@ namespace RJWSexperience.Ideology
|
|||
if (ModLister.HasActiveModWithName("RJW Sexperience"))
|
||||
{
|
||||
//Log.Message("[RJWSexperience.Ideology] Found RJWSexperience, patching");
|
||||
harmony.Patch(AccessTools.Method(typeof(ExtensionMethods.PawnExtensions), nameof(ExtensionMethods.PawnExtensions.IsIncest)),
|
||||
harmony.Patch(AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsIncest)),
|
||||
prefix: new HarmonyMethod(typeof(Sexperience_Patch_IsIncest), nameof(Sexperience_Patch_IsIncest.Prefix)),
|
||||
postfix: null
|
||||
);
|
||||
harmony.Patch(AccessTools.Method(typeof(RJWSexperience.RJWUtility), nameof(RJWSexperience.RJWUtility.ThrowVirginHIstoryEvent)),
|
||||
harmony.Patch(AccessTools.Method(typeof(RJWUtility), nameof(RJWUtility.ThrowVirginHIstoryEvent)),
|
||||
prefix: null,
|
||||
postfix: new HarmonyMethod(typeof(Sexperience_Patch_ThrowVirginHIstoryEvent), nameof(Sexperience_Patch_ThrowVirginHIstoryEvent.Postfix))
|
||||
);
|
||||
|
|
|
@ -84,6 +84,8 @@
|
|||
<ProjectReference Include="..\RJWSexperience\RJWSexperience.csproj">
|
||||
<Project>{9c728e06-573b-4b04-a07f-acbf60cb424d}</Project>
|
||||
<Name>RJWSexperience</Name>
|
||||
<Private>False</Private>
|
||||
<Aliases>BaseSexperience</Aliases>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
@ -1,220 +1,218 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
using RimWorld;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using UnityEngine;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
[HarmonyPatch(typeof(JobDriver_Sex), "Orgasm")]
|
||||
public static class RJW_Patch_Orgasm
|
||||
{
|
||||
public static void Postfix(JobDriver_Sex __instance)
|
||||
{
|
||||
if (__instance.Sexprops.sexType != xxx.rjwSextype.Masturbation && !(__instance is JobDriver_Masturbate))
|
||||
{
|
||||
if (__instance.Sexprops.isRape)
|
||||
{
|
||||
__instance.pawn?.skills?.Learn(VariousDefOf.SexSkill, 0.05f, true);
|
||||
}
|
||||
{
|
||||
__instance.pawn?.skills?.Learn(VariousDefOf.SexSkill, 0.35f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(WhoringHelper), "WhoreAbilityAdjustmentMin")]
|
||||
public static class RJW_Patch_WhoreAbilityAdjustmentMin
|
||||
{
|
||||
public static void Postfix(Pawn whore, ref float __result)
|
||||
{
|
||||
__result *= whore.GetSexStat();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(WhoringHelper), "WhoreAbilityAdjustmentMax")]
|
||||
public static class RJW_Patch_WhoreAbilityAdjustmentMax
|
||||
{
|
||||
public static void Postfix(Pawn whore, ref float __result)
|
||||
{
|
||||
__result *= whore.GetSexStat();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(SexUtility), "SatisfyPersonal")]
|
||||
public static class RJW_Patch_SatisfyPersonal
|
||||
{
|
||||
private const float base_sat_per_fuck = 0.4f;
|
||||
|
||||
public static void Prefix(SexProps props, ref float satisfaction)
|
||||
{
|
||||
satisfaction = Mathf.Max(base_sat_per_fuck, satisfaction * props.partner.GetSexStat());
|
||||
}
|
||||
|
||||
public static void Postfix(SexProps props, ref float satisfaction)
|
||||
{
|
||||
Pawn pawn = props.pawn;
|
||||
Pawn partner = props.partner;
|
||||
UpdateLust(props, satisfaction);
|
||||
|
||||
if (props.sexType == xxx.rjwSextype.Masturbation || partner == null)
|
||||
{
|
||||
Building_CumBucket cumbucket = pawn.GetAdjacentBuilding<Building_CumBucket>();
|
||||
cumbucket?.AddCum(pawn.GetCumVolume());
|
||||
}
|
||||
|
||||
RJWUtility.UpdateSatisfactionHIstory(pawn, partner, props, satisfaction);
|
||||
pawn.records?.Increment(VariousDefOf.OrgasmCount);
|
||||
}
|
||||
|
||||
private static void UpdateLust(SexProps props, float satisfaction)
|
||||
{
|
||||
float? lust = props.pawn.records?.GetValue(VariousDefOf.Lust);
|
||||
|
||||
if (lust == null)
|
||||
return;
|
||||
|
||||
float lustDelta;
|
||||
|
||||
if (props.sexType != xxx.rjwSextype.Masturbation || props.partner != null)
|
||||
{
|
||||
lustDelta = Mathf.Clamp((satisfaction - base_sat_per_fuck) * RJWUtility.LustIncrementFactor(lust ?? 0), -0.5f, 0.5f); // If the sex is satisfactory, lust grows up. Declines at the opposite.
|
||||
}
|
||||
else
|
||||
{
|
||||
lustDelta = Mathf.Clamp(satisfaction * satisfaction * RJWUtility.LustIncrementFactor(lust ?? 0), 0, 0.5f); // Masturbation always increases lust.
|
||||
}
|
||||
|
||||
rjw.Modules.Shared.Logs.LogManager.GetLogger<RjwSexperienceMod>().Message($"{props.pawn.NameShortColored}'s lust changed by {lustDelta} (from {lust})");
|
||||
props.pawn.records.AddTo(VariousDefOf.Lust, lustDelta);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(SexUtility), "TransferNutrition")]
|
||||
public static class RJW_Patch_TransferNutrition
|
||||
{
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
TryFeedCum(props);
|
||||
}
|
||||
|
||||
private static void TryFeedCum(SexProps props)
|
||||
{
|
||||
if (!Genital_Helper.has_penis_fertile(props.pawn))
|
||||
return;
|
||||
|
||||
if (!PawnsPenisIsInPartnersMouth(props))
|
||||
return;
|
||||
|
||||
props.partner.AteCum(props.pawn.GetCumVolume(), true);
|
||||
}
|
||||
|
||||
private static bool PawnsPenisIsInPartnersMouth(SexProps props)
|
||||
{
|
||||
var interaction = rjw.Modules.Interactions.Helpers.InteractionHelper.GetWithExtension(props.dictionaryKey);
|
||||
|
||||
if (props.pawn == props.GetInteractionInitiator())
|
||||
{
|
||||
if (!interaction.DominantHasTag(GenitalTag.CanPenetrate) && !interaction.DominantHasFamily(GenitalFamily.Penis))
|
||||
return false;
|
||||
var requirement = interaction.SelectorExtension.submissiveRequirement;
|
||||
if (!requirement.mouth && !requirement.beak && !requirement.mouthORbeak)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!interaction.SubmissiveHasTag(GenitalTag.CanPenetrate) && !interaction.SubmissiveHasFamily(GenitalFamily.Penis))
|
||||
return false;
|
||||
var requirement = interaction.SelectorExtension.dominantRequirement;
|
||||
if (!requirement.mouth && !requirement.beak && !requirement.mouthORbeak)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Nymph_Generator), "set_skills")]
|
||||
public static class RJW_Patch_Nymph_set_skills
|
||||
{
|
||||
public static void Postfix(Pawn pawn)
|
||||
{
|
||||
SkillRecord sexskill = pawn.skills.GetSkill(VariousDefOf.SexSkill);
|
||||
if (sexskill != null)
|
||||
{
|
||||
sexskill.passion = Passion.Major;
|
||||
sexskill.Level = (int)Utility.RandGaussianLike(7f, 20.99f);
|
||||
sexskill.xpSinceLastLevel = sexskill.XpRequiredForLevelUp * Rand.Range(0.10f, 0.90f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AfterSexUtility), "UpdateRecords")]
|
||||
public static class RJW_Patch_UpdateRecords
|
||||
{
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
RJWUtility.UpdateSextypeRecords(props);
|
||||
RJWUtility.UpdatePartnerHistory(props.pawn, props.partner, props);
|
||||
RJWUtility.UpdatePartnerHistory(props.partner, props.pawn, props);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
|
||||
public static class RJW_Patch_LogSextype
|
||||
{
|
||||
public static void Postfix(JobDriver_SexBaseInitiator __instance)
|
||||
{
|
||||
if (__instance.Partner != null)
|
||||
{
|
||||
__instance.pawn.PoptheCherry(__instance.Partner, __instance.Sexprops);
|
||||
__instance.Partner.PoptheCherry(__instance.pawn, __instance.Sexprops);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HarmonyPatch(typeof(JobDriver_Sex), "Orgasm")]
|
||||
public static class RJW_Patch_Orgasm
|
||||
{
|
||||
public static void Postfix(JobDriver_Sex __instance)
|
||||
{
|
||||
if (__instance.Sexprops.sexType != xxx.rjwSextype.Masturbation && !(__instance is JobDriver_Masturbate))
|
||||
{
|
||||
if (__instance.Sexprops.isRape)
|
||||
{
|
||||
__instance.pawn?.skills?.Learn(VariousDefOf.SexSkill, 0.05f, true);
|
||||
}
|
||||
{
|
||||
__instance.pawn?.skills?.Learn(VariousDefOf.SexSkill, 0.35f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(WhoringHelper), "WhoreAbilityAdjustmentMin")]
|
||||
public static class RJW_Patch_WhoreAbilityAdjustmentMin
|
||||
{
|
||||
public static void Postfix(Pawn whore, ref float __result)
|
||||
{
|
||||
__result *= whore.GetSexStat();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(WhoringHelper), "WhoreAbilityAdjustmentMax")]
|
||||
public static class RJW_Patch_WhoreAbilityAdjustmentMax
|
||||
{
|
||||
public static void Postfix(Pawn whore, ref float __result)
|
||||
{
|
||||
__result *= whore.GetSexStat();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(SexUtility), "SatisfyPersonal")]
|
||||
public static class RJW_Patch_SatisfyPersonal
|
||||
{
|
||||
private const float base_sat_per_fuck = 0.4f;
|
||||
|
||||
public static void Prefix(SexProps props, ref float satisfaction)
|
||||
{
|
||||
Pawn pawn = props.pawn;
|
||||
Pawn partner = props.partner;
|
||||
satisfaction = Mathf.Max(base_sat_per_fuck, satisfaction * partner.GetSexStat());
|
||||
}
|
||||
|
||||
public static void Postfix(SexProps props, ref float satisfaction)
|
||||
{
|
||||
Pawn pawn = props.pawn;
|
||||
Pawn partner = props.partner;
|
||||
float? lust = pawn.records?.GetValue(VariousDefOf.Lust);
|
||||
xxx.rjwSextype sextype = props.sexType;
|
||||
if (lust != null)
|
||||
{
|
||||
if (sextype != xxx.rjwSextype.Masturbation || partner != null) pawn.records.AddTo(VariousDefOf.Lust, Mathf.Clamp((satisfaction - base_sat_per_fuck) * RJWUtility.LustIncrementFactor(lust ?? 0), -0.5f, 0.5f)); // If the sex is satisfactory, lust grows up. Declines at the opposite.
|
||||
else pawn.records.AddTo(VariousDefOf.Lust, Mathf.Clamp(satisfaction * satisfaction * RJWUtility.LustIncrementFactor(lust ?? 0), 0, 0.5f)); // Masturbation always increases lust.
|
||||
}
|
||||
|
||||
if (sextype == xxx.rjwSextype.Masturbation || partner == null)
|
||||
{
|
||||
Building_CumBucket cumbucket = (Building_CumBucket)pawn.GetAdjacentBuilding<Building_CumBucket>();
|
||||
if (cumbucket != null)
|
||||
{
|
||||
cumbucket.AddCum(pawn.GetCumVolume());
|
||||
}
|
||||
}
|
||||
|
||||
RJWUtility.UpdateSatisfactionHIstory(pawn, partner, props, satisfaction);
|
||||
pawn.records?.Increment(VariousDefOf.OrgasmCount);
|
||||
|
||||
}
|
||||
[HarmonyPatch(typeof(WorkGiver_CleanSelf), "JobOnThing")]
|
||||
public static class RJW_Patch_CleanSelf_JobOnThing
|
||||
{
|
||||
public static bool Prefix(Pawn pawn, Thing t, bool forced, ref Job __result)
|
||||
{
|
||||
Building_CumBucket bucket = pawn.GetAdjacentBuilding<Building_CumBucket>();
|
||||
if (bucket == null) bucket = pawn.FindClosestBucket();
|
||||
if (bucket != null)
|
||||
{
|
||||
__result = JobMaker.MakeJob(VariousDefOf.CleanSelfwithBucket, null, bucket, bucket.Position);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(JobGiver_Masturbate), "TryGiveJob")]
|
||||
public static class RJW_Patch_Masturabte_TryGiveJob
|
||||
{
|
||||
public static void Postfix(Pawn pawn, ref Job __result)
|
||||
{
|
||||
if (RJWPreferenceSettings.FapEverywhere && (pawn.Faction?.IsPlayer ?? false) && __result != null)
|
||||
{
|
||||
Building_CumBucket bucket = pawn.FindClosestBucket();
|
||||
if (bucket != null)
|
||||
{
|
||||
__result.Clear();
|
||||
__result = JobMaker.MakeJob(xxx.Masturbate, null, null, bucket.RandomAdjacentCell8Way());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(SexUtility), "TransferNutrition")]
|
||||
public static class RJW_Patch_TransferNutrition
|
||||
{
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
TryFeedCum(props);
|
||||
}
|
||||
|
||||
private static void TryFeedCum(SexProps props)
|
||||
{
|
||||
if (!Genital_Helper.has_penis_fertile(props.pawn))
|
||||
return;
|
||||
|
||||
if (!PawnsPenisIsInPartnersMouth(props))
|
||||
return;
|
||||
|
||||
props.partner.AteCum(props.pawn.GetCumVolume(), true);
|
||||
}
|
||||
|
||||
private static bool PawnsPenisIsInPartnersMouth(SexProps props)
|
||||
{
|
||||
var interaction = rjw.Modules.Interactions.Helpers.InteractionHelper.GetWithExtension(props.dictionaryKey);
|
||||
|
||||
if (props.pawn == props.GetInteractionInitiator())
|
||||
{
|
||||
if (!interaction.DominantHasTag(GenitalTag.CanPenetrate) && !interaction.DominantHasFamily(GenitalFamily.Penis))
|
||||
return false;
|
||||
var requirement = interaction.SelectorExtension.submissiveRequirement;
|
||||
if (!requirement.mouth && !requirement.beak && !requirement.mouthORbeak)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!interaction.SubmissiveHasTag(GenitalTag.CanPenetrate) && !interaction.SubmissiveHasFamily(GenitalFamily.Penis))
|
||||
return false;
|
||||
var requirement = interaction.SelectorExtension.dominantRequirement;
|
||||
if (!requirement.mouth && !requirement.beak && !requirement.mouthORbeak)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Nymph_Generator), "set_skills")]
|
||||
public static class RJW_Patch_Nymph_set_skills
|
||||
{
|
||||
public static void Postfix(Pawn pawn)
|
||||
{
|
||||
SkillRecord sexskill = pawn.skills.GetSkill(VariousDefOf.SexSkill);
|
||||
if (sexskill != null)
|
||||
{
|
||||
sexskill.passion = Passion.Major;
|
||||
sexskill.Level = (int)Utility.RandGaussianLike(7f, 20.99f);
|
||||
sexskill.xpSinceLastLevel = sexskill.XpRequiredForLevelUp * Rand.Range(0.10f, 0.90f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AfterSexUtility), "UpdateRecords")]
|
||||
public static class RJW_Patch_UpdateRecords
|
||||
{
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
RJWUtility.UpdateSextypeRecords(props);
|
||||
RJWUtility.UpdatePartnerHistory(props.pawn, props.partner, props);
|
||||
RJWUtility.UpdatePartnerHistory(props.partner, props.pawn, props);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
|
||||
public static class RJW_Patch_LogSextype
|
||||
{
|
||||
public static void Postfix(JobDriver_SexBaseInitiator __instance)
|
||||
{
|
||||
if (__instance.Partner != null)
|
||||
{
|
||||
__instance.pawn.PoptheCherry(__instance.Partner, __instance.Sexprops);
|
||||
__instance.Partner.PoptheCherry(__instance.pawn, __instance.Sexprops);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPatch(typeof(WorkGiver_CleanSelf), "JobOnThing")]
|
||||
public static class RJW_Patch_CleanSelf_JobOnThing
|
||||
{
|
||||
public static bool Prefix(Pawn pawn, Thing t, bool forced, ref Job __result)
|
||||
{
|
||||
Building_CumBucket bucket = pawn.GetAdjacentBuilding<Building_CumBucket>();
|
||||
if (bucket == null) bucket = pawn.FindClosestBucket();
|
||||
if (bucket != null)
|
||||
{
|
||||
__result = JobMaker.MakeJob(VariousDefOf.CleanSelfwithBucket, null, bucket, bucket.Position);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(JobGiver_Masturbate), "TryGiveJob")]
|
||||
public static class RJW_Patch_Masturabte_TryGiveJob
|
||||
{
|
||||
public static void Postfix(Pawn pawn, ref Job __result)
|
||||
{
|
||||
if (RJWPreferenceSettings.FapEverywhere && (pawn.Faction?.IsPlayer ?? false) && __result != null)
|
||||
{
|
||||
Building_CumBucket bucket = pawn.FindClosestBucket();
|
||||
if (bucket != null)
|
||||
{
|
||||
__result.Clear();
|
||||
__result = JobMaker.MakeJob(xxx.Masturbate, null, null, bucket.RandomAdjacentCell8Way());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace RJWSexperience
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// For ideo patch
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue