Exemplo n.º 1
0
 internal static void _Notify_RescuedBy(this Pawn_RelationsTracker t, Pawn rescuer)
 {
     if (rescuer.RaceProps.Humanlike && t.canGetRescuedThought)
     {
         t.GetPawn().needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOf.RescuedMe, rescuer);
         t.canGetRescuedThought = false;
         rescuer.needs.mood.thoughts.memories.TryGainMemoryThought(ThoughtDefOfPsychology.RescuedBleedingHeart, t.GetPawn());
     }
 }
        internal static float               _CompatibilityWith(this Pawn_RelationsTracker _this, Pawn otherPawn)
        {
            var pawn = _this.GetPawn();

            if (!PawnsAreValidMatches(pawn, otherPawn))
            {
                return(0f);
            }
            return(Mathf.Clamp(GenMath.LerpDouble(0.0f, 20f, 0.45f, -0.45f, Mathf.Abs(pawn.ageTracker.AgeBiologicalYearsFloat - otherPawn.ageTracker.AgeBiologicalYearsFloat)), -0.45f, 0.45f) + _this.ConstantPerPawnsPairCompatibilityOffset(otherPawn.thingIDNumber));
        }
        public static void SecondaryLovinChanceFactor(Pawn_RelationsTracker __instance, Pawn otherPawn,
                                                      ref float __result)
        {
            var pawn = __instance.GetPawn();

            if (pawn.def != otherPawn.def || pawn == otherPawn)
            {
                __result = 0f;
                return;
            }

            var ageBiologicalYearsFloat  = pawn.ageTracker.AgeBiologicalYearsFloat;
            var ageBiologicalYearsFloat2 = otherPawn.ageTracker.AgeBiologicalYearsFloat;

            if (ageBiologicalYearsFloat2 < 16f)
            {
                __result = 0f;
                return;
            }

            var min   = Mathf.Max(16f, ageBiologicalYearsFloat - 30f);
            var lower = Mathf.Max(20f, ageBiologicalYearsFloat, ageBiologicalYearsFloat - 10f);
            var num   = GenMath.FlatHill(0.15f, min, lower, ageBiologicalYearsFloat + 7f, ageBiologicalYearsFloat + 30f,
                                         0.15f, ageBiologicalYearsFloat2);
            var num2 = 1f;

            num2 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetLevel(PawnCapacityDefOf.Talking));
            num2 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetLevel(PawnCapacityDefOf.Manipulation));
            num2 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetLevel(PawnCapacityDefOf.Moving));
            var num3 = 0;

            if (otherPawn.RaceProps.Humanlike)
            {
                num3 = otherPawn.story.traits.DegreeOfTrait(TraitDefOf.Beauty);
            }

            var num4 = 1f;

            if (num3 < 0)
            {
                num4 = 0.3f;
            }
            else if (num3 > 0)
            {
                num4 = 2.3f;
            }

            var num5 = Mathf.InverseLerp(15f, 18f, ageBiologicalYearsFloat);
            var num6 = Mathf.InverseLerp(15f, 18f, ageBiologicalYearsFloat2);

            __result = num * num2 * num5 * num6 * num4;
        }
        internal static float _AttractionTo(this Pawn_RelationsTracker _this, Pawn otherPawn)
        {
            var pawn = _this.GetPawn();

            if (!PawnsAreValidMatches(pawn, otherPawn))
            {
                return(0f);
            }
            float num  = 1f;
            float num2 = 1f;
            float ageBiologicalYearsFloat  = pawn.ageTracker.AgeBiologicalYearsFloat;
            float ageBiologicalYearsFloat2 = otherPawn.ageTracker.AgeBiologicalYearsFloat;

            if (pawn.gender == Gender.Male)
            {
                if (
                    (pawn.RaceProps.Humanlike) &&
                    (pawn.story.traits.HasTrait(TraitDefOf.Gay))
                    )
                {
                    if (otherPawn.gender == Gender.Female)
                    {
                        return(0f);
                    }
                }
                else if (
                    (otherPawn.gender == Gender.Male) &&
                    (!pawn.story.traits.HasTrait(TraitDefOfPsychology.Bisexual))
                    )
                {
                    return(0f);
                }
                num2 = GenMath.FlatHill(16f, 20f, ageBiologicalYearsFloat, ageBiologicalYearsFloat + 15f, ageBiologicalYearsFloat2);
            }
            else if (pawn.gender == Gender.Female)
            {
                if (
                    (pawn.RaceProps.Humanlike) &&
                    (pawn.story.traits.HasTrait(TraitDefOf.Gay))
                    )
                {
                    if (otherPawn.gender == Gender.Male)
                    {
                        return(0f);
                    }
                }
                else if (
                    (otherPawn.gender == Gender.Female) &&
                    (!pawn.story.traits.HasTrait(TraitDefOfPsychology.Bisexual))
                    )
                {
                    num = 0.15f;
                }
                if (ageBiologicalYearsFloat2 < ageBiologicalYearsFloat - 10f)
                {
                    return(0f);
                }
                if (ageBiologicalYearsFloat2 < ageBiologicalYearsFloat - 3f)
                {
                    num2 = Mathf.InverseLerp(ageBiologicalYearsFloat - 10f, ageBiologicalYearsFloat - 3f, ageBiologicalYearsFloat2) * 0.2f;
                }
                else
                {
                    num2 = GenMath.FlatHill(0.2f, ageBiologicalYearsFloat - 3f, ageBiologicalYearsFloat, ageBiologicalYearsFloat + 10f, ageBiologicalYearsFloat + 40f, 0.1f, ageBiologicalYearsFloat2);
                }
            }
            float num3 = 1f;

            num3 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Talking));
            num3 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Manipulation));
            num3 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Moving));
            float num4 = 1f;

            foreach (PawnRelationDef current in pawn.GetRelations(otherPawn))
            {
                num4 *= current.attractionFactor;
            }
            int num5 = 0;

            if (otherPawn.RaceProps.Humanlike)
            {
                num5 = otherPawn.story.traits.DegreeOfTrait(TraitDefOf.Beauty);
            }
            float num6 = 1f;

            if (num5 < 0)
            {
                num6 = 0.3f;
            }
            else if (num5 > 0)
            {
                num6 = 2.3f;
            }
            float num7 = Mathf.InverseLerp(15f, 18f, ageBiologicalYearsFloat);
            float num8 = Mathf.InverseLerp(15f, 18f, ageBiologicalYearsFloat2);

            return(num * num2 * num3 * num4 * num7 * num8 * num6);
        }
Exemplo n.º 5
0
        internal static float _SecondaryRomanceChanceFactor(this Pawn_RelationsTracker t, Pawn otherPawn)
        {
            Pawn pawn = t.GetPawn();

            if (pawn.def != otherPawn.def || pawn == otherPawn)
            {
                return(0f);
            }
            Rand.PushSeed();
            Rand.Seed = pawn.HashOffset();
            bool flag = Rand.Value < 0.015f;

            Rand.PopSeed();
            float          num  = 1f;
            float          num2 = 1f;
            float          num9 = 1f;
            float          ageBiologicalYearsFloat  = pawn.ageTracker.AgeBiologicalYearsFloat;
            float          ageBiologicalYearsFloat2 = otherPawn.ageTracker.AgeBiologicalYearsFloat;
            PsychologyPawn realPawn = pawn as PsychologyPawn;

            if (PsychologyBase.ActivateKinsey() && realPawn != null)
            {
                flag = true;
                float kinsey = 3 - realPawn.sexuality.kinseyRating;
                float h**o   = (pawn.gender == otherPawn.gender) ? 1f : -1f;
                num9 = Mathf.InverseLerp(3f, 0f, kinsey * h**o);
            }
            if (pawn.gender == Gender.Male)
            {
                if (!flag)
                {
                    if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOf.Gay))
                    {
                        if (otherPawn.gender == Gender.Female)
                        {
                            return(0f);
                        }
                    }
                    else if (otherPawn.gender == Gender.Male)
                    {
                        return(0f);
                    }
                }
                num2 = GenMath.FlatHill(0f, 16f, 20f, ageBiologicalYearsFloat, ageBiologicalYearsFloat + 15f, 0.07f, ageBiologicalYearsFloat2);
                if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded))
                {
                    num2 = 1f;
                }
            }
            else if (pawn.gender == Gender.Female)
            {
                if (!flag)
                {
                    if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOf.Gay))
                    {
                        if (otherPawn.gender == Gender.Male)
                        {
                            return(0f);
                        }
                    }
                    else if (otherPawn.gender == Gender.Female)
                    {
                        num = 0f;
                    }
                }
                if ((ageBiologicalYearsFloat2 < ageBiologicalYearsFloat - 10f) && (pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded)))
                {
                    return(0f);
                }
                if (ageBiologicalYearsFloat2 < ageBiologicalYearsFloat - 3f)
                {
                    num2 = Mathf.InverseLerp(ageBiologicalYearsFloat - 10f, ageBiologicalYearsFloat - 3f, ageBiologicalYearsFloat2) * 0.2f;
                }
                else
                {
                    num2 = GenMath.FlatHill(0.2f, ageBiologicalYearsFloat - 3f, ageBiologicalYearsFloat, ageBiologicalYearsFloat + 10f, ageBiologicalYearsFloat + 30f, 0.1f, ageBiologicalYearsFloat2);
                }
                if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded))
                {
                    num2 = 1f;
                }
            }
            float num3 = 1f;

            num3 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Talking));
            num3 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Manipulation));
            num3 *= Mathf.Lerp(0.2f, 1f, otherPawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Moving));
            if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded))
            {
                num3 = 1f;
            }
            float num4 = 1f;

            foreach (PawnRelationDef current in pawn.GetRelations(otherPawn))
            {
                num4 *= current.attractionFactor;
            }
            int num5 = 0;

            if (otherPawn.RaceProps.Humanlike)
            {
                num5 = otherPawn.story.traits.DegreeOfTrait(TraitDefOf.Beauty);
            }
            if (pawn.RaceProps.Humanlike && pawn.story.traits.HasTrait(TraitDefOfPsychology.OpenMinded) || pawn.health.capacities.GetEfficiency(PawnCapacityDefOf.Sight) == 0f)
            {
                num5 = 0;
            }
            float num6 = 1f;

            if (num5 < 0)
            {
                num6 = 0.3f;
            }
            else if (num5 > 0)
            {
                num6 = 2.3f;
            }
            float num7 = Mathf.InverseLerp(15f, 18f, ageBiologicalYearsFloat);
            float num8 = Mathf.InverseLerp(15f, 18f, ageBiologicalYearsFloat2);

            return(num * num2 * num3 * num4 * num7 * num8 * num6 * num9);
        }