diff --git a/Common/Assemblies/Rjw-Genes.dll b/Common/Assemblies/Rjw-Genes.dll index e4e66e6..1294fcb 100644 Binary files a/Common/Assemblies/Rjw-Genes.dll and b/Common/Assemblies/Rjw-Genes.dll differ diff --git a/Common/Defs/ThinkTreeDefs/ThinkTrees_LifeForce.xml b/Common/Defs/ThinkTreeDefs/ThinkTrees_LifeForce.xml new file mode 100644 index 0000000..7258915 --- /dev/null +++ b/Common/Defs/ThinkTreeDefs/ThinkTrees_LifeForce.xml @@ -0,0 +1,47 @@ + + + + + + SuccubusGetLifeForce + Humanlike_PostMain + 14 + + +
  • + +
  • + +
  • +
  • +
  • +
  • +
  • + +
  • + +
  • +
  • + +
  • + +
  • + +
  • +
    + + + + + + + + + + +
    +
    +
    \ No newline at end of file diff --git a/Source/Genes/Life_Force/Gene_LifeForce.cs b/Source/Genes/Life_Force/Gene_LifeForce.cs index 172c43b..de19281 100644 --- a/Source/Genes/Life_Force/Gene_LifeForce.cs +++ b/Source/Genes/Life_Force/Gene_LifeForce.cs @@ -60,6 +60,8 @@ namespace RJW_Genes //GeneResourceDrainUtility.TickResourceDrain(this); } + public bool StoredCumAllowed = true; + public Gene_Resource Resource { get diff --git a/Source/Genes/Life_Force/JobDriver_Drink_Cumflation.cs b/Source/Genes/Life_Force/JobDriver_Drink_Cumflation.cs new file mode 100644 index 0000000..b1ab9a1 --- /dev/null +++ b/Source/Genes/Life_Force/JobDriver_Drink_Cumflation.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RimWorld; +using Verse; +using Verse.AI; +using rjw; +using rjw.Modules.Interactions.Enums; +using rjw.Modules.Interactions.Helpers; +using rjw.Modules.Interactions.Objects; +using rjw.Modules.Interactions.Contexts; +using rjw.Modules.Interactions.Implementation; + +namespace RJW_Genes +{ + public class JobDriver_DrinkCumflation : JobDriver_SexBaseInitiator + { + //Summary// + //WIP is for custom interaction + protected override IEnumerable MakeNewToils() + { + base.setup_ticks(); + this.rape = !LovePartnerRelationUtility.LovePartnerRelationExists(this.pawn, this.Partner); + JobDef PartnerJob = rape? xxx.gettin_raped: xxx.getting_quickie; + this.FailOnDestroyedNullOrForbidden(TargetIndex.A); + this.FailOnSomeonePhysicallyInteracting(TargetIndex.A); + this.FailOn(() => this.pawn.Drafted); + this.FailOn(() => this.pawn.IsFighting()); + this.FailOn(() => this.Partner.IsFighting()); + yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch); + yield return new Toil + { + defaultCompleteMode = ToilCompleteMode.Instant, + socialMode = RandomSocialMode.Off, + initAction = delegate () + { + Job newJob = JobMaker.MakeJob(PartnerJob, this.pawn, this.Partner); + this.Partner.jobs.StartJob(newJob, JobCondition.InterruptForced, null, false, true, null, null, false, false, null, false, true); + } + }; + + Toil toil = new Toil(); + toil.defaultCompleteMode = ToilCompleteMode.Never; + toil.defaultDuration = this.duration; + toil.handlingFacing = true; + toil.FailOn(() => this.Partner.CurJob.def != PartnerJob); + toil.initAction = delegate () + { + this.Partner.pather.StopDead(); + this.Partner.jobs.curDriver.asleep = false; + this.SetInteraction(); + this.cumflation = this.Partner.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Cumflation")); + this.gene_LifeForce = (this.pawn.genes != null) ? this.pawn.genes.GetFirstGeneOfType() : null; + this.Start(); + }; + toil.tickAction = delegate () + { + if (this.pawn.IsHashIntervalTick(this.ticks_between_hearts)) + { + this.ThrowMetaIconF(this.pawn.Position, this.pawn.Map, FleckDefOf.Heart); + } + this.SexTick(this.pawn, this.Partner, true, true); + SexUtility.reduce_rest(this.Partner, 1f); + SexUtility.reduce_rest(this.pawn, 2f); + if (this.ticks_left <= 0) + { + this.ReadyForNextToil(); + } + }; + toil.AddFinishAction(delegate + { + this.End(); + }); + yield return toil; + yield return new Toil + { + initAction = delegate () + { + SexUtility.ProcessSex(this.Sexprops); + }, + defaultCompleteMode = ToilCompleteMode.Instant + }; + yield break; + } + + public void Reduce_Cumflation() + { + this.reductiontick--; + if (reductiontick <= 0) + { + if (this.cumflation != null && this.gene_LifeForce != null) + { + this.cumflation.Severity =+ 0.01f; + gene_LifeForce.Resource.Value += 0.01f; + } + this.reductiontick = 60; + } + + } + public override bool TryMakePreToilReservations(bool errorOnFailed) + { + return this.pawn.Reserve(this.job.GetTarget(TargetIndex.A), this.job, 1, -1, null, errorOnFailed); + } + + public void SetInteraction() + { + InteractionDef interaction = rape ? DefDatabase.GetNamed("Rape_Reverse_Cunnilingus") : DefDatabase.GetNamed("Sex_Reverse_Cunnilingus"); + + SpecificInteractionInputs inputs = new SpecificInteractionInputs + { + Initiator = this.pawn, + Partner = this.Partner, + Interaction = interaction + }; + InteractionOutputs interactionOutputs = SpecificLewdInteractionService.Instance.GenerateSpecificInteraction(inputs); + this.Sexprops.sexType = interactionOutputs.Generated.RjwSexType; + this.Sexprops.rulePack = interactionOutputs.Generated.RulePack.defName; + this.Sexprops.dictionaryKey = interaction; + this.Sexprops.isRapist = rape; + this.Sexprops.isWhoring = false; + this.Sexprops.isRevese = true; + } + + public Hediff cumflation; + public Gene_LifeForce gene_LifeForce; + int reductiontick = 60; + bool rape = false; + } +} diff --git a/Source/Genes/Life_Force/JobGiver_GetLifeForce.cs b/Source/Genes/Life_Force/JobGiver_GetLifeForce.cs new file mode 100644 index 0000000..b39d9cb --- /dev/null +++ b/Source/Genes/Life_Force/JobGiver_GetLifeForce.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using UnityEngine; +using Verse; +using Verse.AI; +using RimWorld; +using rjw; + +namespace RJW_Genes +{ + public class JobGiver_GetLifeForce : ThinkNode_JobGiver + { + protected override Job TryGiveJob(Pawn pawn) + { + Pawn_GeneTracker genes = pawn.genes; + Gene_LifeForce gene_lifeforce = (genes != null) ? genes.GetFirstGeneOfType() : null; + if (gene_lifeforce == null) + { + return null; + } + if (!gene_lifeforce.ShouldConsumeLifeForceNow()) + { + return null; + } + + + if (ModsConfig.IsActive("LustLicentia.RJWLabs") && gene_lifeforce.StoredCumAllowed) + { + Thing gatheredCum = this.GetStoredCum(pawn); + if (gatheredCum == null) + { + return null; + } + IngestionOutcomeDoer_LifeForceOffset ingestionOutcomeDoer = (IngestionOutcomeDoer_LifeForceOffset)gatheredCum.def.ingestible.outcomeDoers.First((IngestionOutcomeDoer x) => x is IngestionOutcomeDoer_LifeForceOffset); + if (ingestionOutcomeDoer == null) + { + return null; + } + int num = Mathf.RoundToInt(((gene_lifeforce.targetValue - gene_lifeforce.Value) * 100 + 10) / ingestionOutcomeDoer.FertilinPerUnit); + if (gatheredCum != null && num > 0) + { + Job job = JobMaker.MakeJob(RimWorld.JobDefOf.Ingest, gatheredCum); + job.count = Mathf.Min(gatheredCum.stackCount, num); + job.ingestTotalCount = true; + return job; + } + } + return null; + } + + //From JobGiver_GetHemogen, dont know exactly what this influences + public override float GetPriority(Pawn pawn) + { + if (!ModsConfig.BiotechActive) + { + return 0f; + } + Pawn_GeneTracker genes = pawn.genes; + if (((genes != null) ? genes.GetFirstGeneOfType() : null) == null) + { + return 0f; + } + return 9.1f; + } + + private Thing GetStoredCum(Pawn pawn) + { + Thing carriedThing = pawn.carryTracker.CarriedThing; + ThingDef gatheredCum = ThingDef.Named("GatheredCum"); + if (carriedThing != null && carriedThing.def == gatheredCum) + { + return carriedThing; + } + for (int i = 0; i < pawn.inventory.innerContainer.Count; i++) + { + if (pawn.inventory.innerContainer[i].def == gatheredCum) + { + return pawn.inventory.innerContainer[i]; + } + } + return GenClosest.ClosestThing_Global_Reachable(pawn.Position, pawn.Map, pawn.Map.listerThings.ThingsOfDef(gatheredCum), PathEndMode.OnCell, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false, false, false), 9999f, (Thing t) => pawn.CanReserve(t, 1, -1, null, false) && !t.IsForbidden(pawn), null); + } + } +} diff --git a/Source/Genes/Life_Force/Patch_SexTicks_ChangePsyfocus.cs b/Source/Genes/Life_Force/Patch_SexTicks_ChangePsyfocus.cs new file mode 100644 index 0000000..1a608cc --- /dev/null +++ b/Source/Genes/Life_Force/Patch_SexTicks_ChangePsyfocus.cs @@ -0,0 +1,60 @@ +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 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) + { + Log.Message("Firese"); + Log.Message(dom.Name.ToString()); + Log.Message(sub.Name.ToString()); + if (GeneUtility.HasLifeForce(sub) && dom.health.hediffSet.HasHediff(HediffDef.Named("Cumflation"))) + { + Hediff cumflation = dom.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Cumflation")); + Gene_LifeForce gene_LifeForce = sub.genes.GetFirstGeneOfType(); + cumflation.Severity -= 0.1f; + gene_LifeForce.Resource.Value += 0.05f; + } + } + //Maybe i can store instance and hediff so I dont need to look them up every time + } +} diff --git a/Source/Genes/Life_Force/ThinkNode_ConditionalCritcalLifeForce.cs b/Source/Genes/Life_Force/ThinkNode_ConditionalCritcalLifeForce.cs new file mode 100644 index 0000000..dbb3f6b --- /dev/null +++ b/Source/Genes/Life_Force/ThinkNode_ConditionalCritcalLifeForce.cs @@ -0,0 +1,14 @@ +using System; +using Verse; +using Verse.AI; + +namespace RJW_Genes +{ + public class ThinkNode_ConditionalCritcalLifeForce : ThinkNode_Conditional + { + protected override bool Satisfied(Pawn p) + { + return GeneUtility.HasCriticalLifeForce(p); + } + } +} \ No newline at end of file diff --git a/Source/Genes/Life_Force/ThinkNode_ConditionalLowLifeForce.cs b/Source/Genes/Life_Force/ThinkNode_ConditionalLowLifeForce.cs new file mode 100644 index 0000000..0e71ce7 --- /dev/null +++ b/Source/Genes/Life_Force/ThinkNode_ConditionalLowLifeForce.cs @@ -0,0 +1,14 @@ +using System; +using Verse; +using Verse.AI; + +namespace RJW_Genes +{ + public class ThinkNode_ConditionalLowLifeForce : ThinkNode_Conditional + { + protected override bool Satisfied(Pawn p) + { + return GeneUtility.HasLowLifeForce(p); + } + } +} \ No newline at end of file diff --git a/Source/HarmonyInit.cs b/Source/HarmonyInit.cs index 35ffb2e..8c5f3d6 100644 --- a/Source/HarmonyInit.cs +++ b/Source/HarmonyInit.cs @@ -27,6 +27,8 @@ 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))); + 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))); } }))(); } diff --git a/Source/Interactions/CustomSexInteraction_Helper.cs b/Source/Interactions/CustomSexInteraction_Helper.cs index 315ac64..4e69462 100644 --- a/Source/Interactions/CustomSexInteraction_Helper.cs +++ b/Source/Interactions/CustomSexInteraction_Helper.cs @@ -30,7 +30,6 @@ namespace RJW_Genes InteractionRequirement dominantRequirement = sexpropsreq.dominantRequirement; InteractionRequirement submissiveRequirement = sexpropsreq.submissiveRequirement; - List sexinteractions = SexUtility.SexInterractions; List list = new List(); //List a = from interaction in sexinteractions //where InteractionHelper.GetWithExtension(interaction).DominantHasFamily(dominantRequirement.families.) diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index a79deca..ba2b195 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -119,6 +119,11 @@ + + + + +