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