//Handles the spawning of pawns and adding relations
        public override void GiveBirth()
        {
            Pawn mother = pawn;

            if (mother == null)
            {
                return;
            }
            try
            {
                //fail if hediff added through debug, since babies not initialized
                if (babies.Count > 9999)
                {
                    Log.Message("RJW beastiality/animal pregnancy birthing pawn count: " + babies.Count);
                }
            }
            catch
            {
                if (father == null)
                {
                    Log.Message("RJW beastiality/animal pregnancy father is null(debug?), setting father to mother");
                    father = mother;
                }

                Initialize(mother, father);
            }
            List <Pawn> siblings = new List <Pawn>();

            foreach (Pawn baby in babies)
            {
                PawnUtility.TrySpawnHatchedOrBornPawn(baby, mother);

                Need_Sex sex_need = mother.needs.TryGetNeed <Need_Sex>();
                if (mother.Faction != null && !(mother.Faction?.IsPlayer ?? false) && sex_need != null)
                {
                    sex_need.CurLevel = 1.0f;
                }

                baby.relations.AddDirectRelation(relation_birthgiver, mother);
                mother.relations.AddDirectRelation(relation_spawn, baby);
                if (father != null && mother != father)
                {
                    baby.relations.AddDirectRelation(relation_birthgiver, father);
                    father.relations.AddDirectRelation(relation_spawn, baby);
                }

                foreach (Pawn sibling in siblings)
                {
                    baby.relations.AddDirectRelation(PawnRelationDefOf.Sibling, sibling);
                }
                siblings.Add(baby);
                train(baby, mother, father);

                PostBirth(mother, father, baby);

                mother.health.RemoveHediff(this);
            }
        }
Esempio n. 2
0
        static float agefactor(Pawn pawn)
        {
            if (xxx.is_human(pawn))
            {
                int age = pawn.ageTracker.AgeBiologicalYears;

                Need_Sex horniness = pawn.needs.TryGetNeed <Need_Sex>();
                if (horniness.CurLevel > 0.5f)
                {
                    return(1f);
                }

                if (age < RJWSettings.sex_minimum_age)
                {
                    return(0f);
                }
            }
            return(1f);
        }
Esempio n. 3
0
 public override bool AllowActivation(Lord lord, TriggerSignal signal)
 {
     currentTick++;
     if (signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % CheckInterval == 0)
     {
         float?avgValue = null;
         foreach (var pawn in lord.ownedPawns)
         {
             /*foreach(Pawn p in lord.Map.mapPawns.PawnsInFaction(Faction.OfPlayer))
              * {
              * }*/
             Need_Sex n = pawn.needs.TryGetNeed <Need_Sex>();
             //if (n != null && pawn.gender == Gender.Male && !pawn.Downed)
             if (xxx.can_rape(pawn) && xxx.is_healthy_enough(pawn) && xxx.IsTargetPawnOkay(pawn) && Find.TickManager.TicksGame > pawn.mindState.canLovinTick)
             {
                 avgValue = (avgValue == null) ? n.CurLevel : (avgValue + n.CurLevel) / 2f;
             }
         }
         //--Log.Message("[ABF]Trigger_SexSatisfy::ActivateOn Checked value :" + avgValue + "/" + targetValue);
         return(avgValue == null || avgValue >= targetValue);
     }
     return(currentTick >= TickTimeout);
 }
        protected override float MtbHours(Pawn pawn)
        {
            float base_mtb = xxx.config.comfort_prisoner_rape_mtbh_mul;             // Default is 4.0

            float desire_factor;
            {
                Need_Sex need_sex = pawn.needs.TryGetNeed <Need_Sex>();

                if (need_sex != null)
                {
                    if (need_sex.CurLevel <= need_sex.thresh_frustrated())
                    {
                        desire_factor = 0.40f;
                    }
                    else if (need_sex.CurLevel <= need_sex.thresh_horny())
                    {
                        desire_factor = 0.80f;
                    }
                    else
                    {
                        desire_factor = 1.00f;
                    }
                }
                else
                {
                    desire_factor = 1.00f;
                }
            }

            float personality_factor;
            {
                personality_factor = 1.0f;

                if (xxx.is_nympho(pawn))
                {
                    personality_factor *= 0.5f;
                }
                else if (xxx.is_prude(pawn) || pawn.story.traits.HasTrait(TraitDefOf.BodyPurist))
                {
                    personality_factor *= 2f;
                }

                if (pawn.story.traits.HasTrait(TraitDefOf.Nudist))
                {
                    personality_factor *= 0.9f;
                }

                // Pawns with no zoophile trait should first try to find other outlets.
                if (!xxx.is_zoophile(pawn))
                {
                    personality_factor *= 8f;
                }

                // Less likely to engage in bestiality if the pawn has a lover... unless the lover is an animal (there's mods for that, so need to check).
                if (!xxx.isSingleOrPartnerNotHere(pawn) && !xxx.is_animal(LovePartnerRelationUtility.ExistingMostLikedLovePartner(pawn, false)) && !xxx.is_lecher(pawn) && !xxx.is_nympho(pawn))
                {
                    personality_factor *= 2.5f;
                }

                // Pawns with few or no prior animal encounters are more reluctant to engage in bestiality.
                if (pawn.records.GetValue(xxx.CountOfSexWithAnimals) < 3)
                {
                    personality_factor *= 3f;
                }
                else if (pawn.records.GetValue(xxx.CountOfSexWithAnimals) > 10)
                {
                    personality_factor *= 0.8f;
                }
            }

            float fun_factor;

            {
                if ((pawn.needs.joy != null) && (xxx.is_bloodlust(pawn)))
                {
                    fun_factor = Mathf.Clamp01(0.50f + pawn.needs.joy.CurLevel);
                }
                else
                {
                    fun_factor = 1.00f;
                }
            }

            return(base_mtb * desire_factor * personality_factor * fun_factor);
        }
        public static bool would_rape(Pawn rapist, Pawn rapee)
        {
            float rape_factor = 0.3f;                                   // start at 30%

            float vulnerabilityFucker  = xxx.get_vulnerability(rapist); //0 to 3
            float vulnerabilityPartner = xxx.get_vulnerability(rapee);  //0 to 3

            // More inclined to rape someone from another faction.
            if (rapist.HostileTo(rapee) || rapist.Faction != rapee.Faction)
            {
                rape_factor += 0.25f;
            }

            // More inclined to rape if the target is designated as CP.
            if (rapee.IsDesignatedComfort())
            {
                rape_factor += 0.25f;
            }

            // More inclined to rape when horny.
            Need_Sex horniness = rapist.needs.TryGetNeed <Need_Sex>();

            if (!xxx.is_animal(rapist) && horniness?.CurLevel <= horniness?.thresh_horny())
            {
                rape_factor += 0.25f;
            }

            if (xxx.is_animal(rapist))
            {
                if (vulnerabilityFucker < vulnerabilityPartner)
                {
                    rape_factor -= 0.1f;
                }
                else
                {
                    rape_factor += 0.25f;
                }
            }
            else if (xxx.is_animal(rapee))
            {
                if (xxx.is_zoophile(rapist))
                {
                    rape_factor += 0.5f;
                }
                else
                {
                    rape_factor -= 0.2f;
                }
            }
            else
            {
                rape_factor *= 0.5f + Mathf.InverseLerp(vulnerabilityFucker, 3f, vulnerabilityPartner);
            }

            if (rapist.health.hediffSet.HasHediff(HediffDef.Named("AlcoholHigh")))
            {
                rape_factor *= 1.25f;                 //too drunk to care
            }
            // Increase factor from traits.
            if (xxx.is_rapist(rapist))
            {
                rape_factor *= 1.5f;
            }
            if (xxx.is_nympho(rapist))
            {
                rape_factor *= 1.25f;
            }
            if (xxx.is_bloodlust(rapist))
            {
                rape_factor *= 1.2f;
            }
            if (xxx.is_psychopath(rapist))
            {
                rape_factor *= 1.2f;
            }
            if (xxx.is_masochist(rapee))
            {
                rape_factor *= 1.2f;
            }

            // Lower factor from traits.
            if (xxx.is_masochist(rapist))
            {
                rape_factor *= 0.8f;
            }

            if (rapist.needs.joy != null && rapist.needs.joy.CurLevel < 0.1f)             // The rapist is really bored...
            {
                rape_factor *= 1.2f;
            }

            //Rand.PopState();
            //Rand.PushState(RJW_Multiplayer.PredictableSeed());
            if (rapist.relations == null || xxx.is_animal(rapist))
            {
                return(Rand.Chance(rape_factor));
            }
            int opinion = rapist.relations.OpinionOf(rapee);

            // Won't rape friends, unless rapist or psychopath.
            if (xxx.is_kind(rapist))
            {               //<-80: 1f /-40: 0.5f / 0+: 0f
                rape_factor *= 1f - Mathf.Pow(GenMath.InverseLerp(-80, 0, opinion), 2);
            }
            else if (xxx.is_rapist(rapist) || xxx.is_psychopath(rapist))
            {                                                                            //<40: 1f /80: 0.5f / 120+: 0f
                rape_factor *= 1f - Mathf.Pow(GenMath.InverseLerp(40, 120, opinion), 2); // This can never be 0, since opinion caps at 100.
            }
            else
            {               //<-60: 1f /-20: 0.5f / 40+: 0f
                rape_factor *= 1f - Mathf.Pow(GenMath.InverseLerp(-60, 40, opinion), 2);
            }

            //Log.Message("rjw::xxx rape_factor for " + get_pawnname(rapee) + " is " + rape_factor);

            return(Rand.Chance(rape_factor));
        }