Exemplo n.º 1
0
 public static void Postfix(ref int __result, JobDriver_Lovin __instance)
 {
     if (__instance.pawn.HasTrait(VTEDefOf.VTE_Insatiable))
     {
         __result = (int)(__result / 4f);
     }
 }
Exemplo n.º 2
0
 private static bool on_begin_lovin(JobDriver_Lovin __instance)
 {
     //--Log.Message("[RJW]patches_lovin::PATCH_JobDriver_Lovin_MakeNewToils is called0");
     //if (__instance == null) return true;
     __instance.FailOn(() => (!xxx.can_fuck(__instance.pawn)));
     return(true);
 }
Exemplo n.º 3
0
        static void Postfix(ref IEnumerable <Toil> __result, JobDriver_Lovin __instance)
        {
            __result.Last().AddFinishAction(delegate
            {
                var mate = (Pawn)(__instance.job.GetTarget(TargetIndex.A));
                var pawn = __instance.pawn;

                //check fertility then ensemenate wombs
                if (!FertilityChecker.is_fertile(pawn))
                {
                    return;
                }
                if (!FertilityChecker.is_fertile(mate))
                {
                    return;
                }
                //for each womb make pregnant
                if (FertilityChecker.is_FemaleForBabies(pawn) && Rand.Value + 0.01f < SettingHelper.latest.woohooChildChance)
                {
                    //(donor , has womb)
                    Mate.Mated(mate, pawn);
                }

                if (FertilityChecker.is_FemaleForBabies(mate) && Rand.Value + 0.01f < SettingHelper.latest.woohooChildChance)
                {
                    //(donor , has womb)
                    Mate.Mated(pawn, mate);
                }
            });
        }
Exemplo n.º 4
0
        static bool Prefix(JobDriver_Lovin __instance)
        {
            var driverTraverse = Traverse.Create(__instance);

            Assert(driverTraverse, "driverTraverse");
            var partner = driverTraverse.Property("Partner").GetValue <Pawn>();

            Assert(partner, "partner");

            var genTicksToNextLovin = driverTraverse.Method("GenerateRandomMinTicksToNextLovin", __instance.pawn);

            Assert(genTicksToNextLovin, "GenTicksMethod");
            var ticksToNextLovin = genTicksToNextLovin.GetValue <int>(__instance.pawn);

            Assert(ticksToNextLovin, "ticksToNextLovin");

            var performanceLevel = LovinUtility.LovinLevel(__instance.pawn, partner);

            // apply the thought
            var thought = ThoughtMaker.MakeThought(ThoughtDefOf.LovinPerformance, performanceLevel);

            __instance.pawn.needs.mood.thoughts.memories.TryGainMemory(thought, partner);

            // we're civilized, not bunnies.
            __instance.pawn.mindState.canLovinTick = Find.TickManager.TicksGame + ticksToNextLovin;

            return(false);
        }
        internal static void JobDriver_Lovin_MoveNext_Postfix(ref Toil __result, ref JobDriver_Lovin __instance)
        {
            // Let's find the last yield return block
            JobDriver_Lovin _this = __instance;

            if (__result.socialMode == RandomSocialMode.Off)
            {
                __result.AddFinishAction(delegate {
                    // one in five chance to become pregnant? Probably expand on this later
                    // Make sure this isn't a gay/lesbian couple. Mpreg fujoshits blown the F**K out
                    Pawn partner = (Pawn)AccessTools.Property(typeof(JobDriver_Lovin), "Partner").GetValue(_this, null);
                    if (_this.pawn.gender != partner.gender)
                    {
                        // Find out who should become pregnant
                        if (partner.gender == Gender.Female)
                        {
                            Lovin_Override.TryToImpregnate(_this.pawn, partner);
                        }
                        else
                        {
                            Lovin_Override.TryToImpregnate(partner, _this.pawn);
                        }
                    }
                });
            }
        }
Exemplo n.º 6
0
        static bool GenerateRandomMinTicksToNextLovinPrefix(JobDriver_Lovin __instance, Pawn pawn)
        {
            TargetIndex PartnerInd = (TargetIndex)PartnerIndinfo.GetValue(__instance);
            Pawn        partner    = (Pawn)(Thing)__instance.job.GetTarget(PartnerInd);

            if (partner == null)
            {
                Log.Message("partner null error");
            }
            else
            {
                Log.Message("partner = " + partner.Name);
            }


            foreach (Thing Wpawn in GenRadial.RadialDistinctThingsAround(pawn.Position, pawn.Map, 6f, useCenter: true))
            {
                Pawn wpawn = Wpawn as Pawn;
                if (wpawn != null)
                {
                    if (wpawn != pawn && wpawn != partner && wpawn.gender != Gender.None) //
                    {
                        if (wpawn.health.capacities.CapableOf(PawnCapacityDefOf.Sight))
                        {
                            wpawn.needs?.mood?.thoughts?.memories?.TryGainMemory(thoughtdefof.FP_WatchSomeLov);
                        }
                    }
                }
            }
            return(true);
        }
Exemplo n.º 7
0
        private static bool on_begin_lovin(JobDriver_Lovin __instance)
        {
            Pawn pawn    = __instance.pawn;
            Pawn partner = null;
            var  any_ins = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

            partner = (Pawn)(__instance.GetType().GetProperty("Partner", any_ins).GetValue(__instance, null));

            __instance.FailOn(() => (!(xxx.can_fuck(pawn) || xxx.can_be_fucked(pawn))));
            __instance.FailOn(() => (!(xxx.can_fuck(partner) || xxx.can_be_fucked(partner))));

            //this breaks job
            //Log.Message("[RJW]patches_lovin::would_fuck" + xxx.would_fuck(pawn, partner));
            //__instance.FailOn(() => (xxx.would_fuck(pawn, partner) < 0.1f));
            return(true);
        }
Exemplo n.º 8
0
        private static bool on_begin_lovin(JobDriver_Lovin __instance)
        {
            Pawn         pawn    = __instance.pawn;
            Pawn         partner = null;
            Building_Bed Bed     = null;
            var          any_ins = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

            partner = (Pawn)(__instance.GetType().GetProperty("Partner", any_ins).GetValue(__instance, null));
            Bed     = (Building_Bed)(__instance.GetType().GetProperty("Bed", any_ins).GetValue(__instance, null));

            __instance.FailOn(() => (!(xxx.can_fuck(pawn) || xxx.can_be_fucked(pawn))));
            __instance.FailOn(() => (!(xxx.can_fuck(partner) || xxx.can_be_fucked(partner))));

            if (RJWSettings.override_lovin)
            {
                pawn.jobs.EndCurrentJob(JobCondition.Incompletable);
                Job job = JobMaker.MakeJob(xxx.casual_sex, partner, Bed);
                pawn.jobs.jobQueue.EnqueueFirst(job);
            }

            return(true);
        }
        public static void PostFix(ref JobDriver_Lovin __instance, ref TargetIndex ___PartnerInd, Pawn pawn)
        {
            if (!Controller.Settings.DoAilments || !Controller.Settings.DoSTI ||
                GenDate.DaysPassed < Controller.Settings.CAStartDays)
            {
                return;
            }

            HediffDef hediffdef = null;
            var       severity  = 0f;

            CommonAilments.CurSituation(pawn, out var offset, out _, out _, out _, out _,
                                        out _);
            offset += CommonAilments.GetImmunityOS(pawn);
            var CASTIBaseChance = Controller.Settings.CASTIChance;

            if (offset > 25)
            {
                offset = 25;
            }

            if (offset < -25)
            {
                offset = -25;
            }

            Hediff std     = null;
            var    sexwith = (Pawn)(Thing)__instance.job.GetTarget(___PartnerInd);

            if (sexwith == null)
            {
                return;
            }

            if (!CommonAilments.GetEitherProtected(sexwith, pawn))
            {
                var health    = sexwith.health;
                var hediffSet = health?.hediffSet;

                var swset    = hediffSet;
                var infected = false;
                if (swset != null)
                {
                    offset += Controller.Settings.CASTIOffset;
                    std     = swset.GetFirstHediffOfDef(ComAilDefOf.HediffDefOf.CA_Minor_STD);
                    if (std != null)
                    {
                        infected = true;
                    }
                }

                if (CommonAilments.CanAddCASTI(CASTIBaseChance, offset, infected))
                {
                    if (std != null)
                    {
                        hediffdef = std.def;
                        severity  = std.Severity + GetARnd(-0.5f, 0.5f);
                    }
                    else
                    {
                        hediffdef = ComAilDefOf.HediffDefOf.CA_Minor_STD;
                        severity  = GetARnd(1f, 5f);
                    }
                }
            }

            if (hediffdef == null || !(severity > 0f))
            {
                return;
            }

            CommonAilments.TryApplyAilment(hediffdef, severity, pawn, null, out _);
            if (std != null || !(GetARnd(1f, 100f) < 50f))
            {
                return;
            }

            CommonAilments.TryApplyAilment(hediffdef, severity, sexwith, null, out _);
        }
Exemplo n.º 10
0
        private static Pawn find_partner(JobDriver_Lovin lov)
        {
            var any_ins = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

            return((Pawn)(typeof(JobDriver_Lovin).GetProperty("Partner", any_ins).GetValue(lov, null)));
        }