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));
        }