示例#1
0
        public static bool HasReasonForBreakup(Pawn pawn, Pawn other)
        {
            PawnRelationDef relation = RelationshipUtility.MostAdvancedRelationshipBetween(pawn, other);

            if (relation == null)
            {
                return(false);
            }
            if (AttractionUtility.GetRelationshipUnmodifiedOpinion(pawn, other) < unmodifiedRelationshipBreakupThreshold)
            {
                return(true);
            }
            if (pawn.needs.mood.thoughts.memories.Memories.Any <Thought_Memory>(x => x.def.defName == "CheatedOnMe" && x.otherPawn == other))
            {
                return(true);
            }
            if (pawn.needs.mood.thoughts.memories.Memories.Any <Thought_Memory>(x => x.def.defName == "CaughtFlirting" && x.otherPawn == other))
            {
                return(true);
            }
            if (ThoughtDetector.HasSocialSituationalThought(pawn, other, ThoughtDefOfGR.FeelingNeglected))
            {
                return(true);
            }
            return(false);
        }
示例#2
0
        public override float Calculate(Pawn observer, Pawn assessed)
        {
            float opinion       = AttractionUtility.GetRelationshipUnmodifiedOpinion(observer, assessed);
            float romanceFactor = Mathf.InverseLerp(-100, 100, opinion) * 2f;

            return(Mathf.Pow(romanceFactor, UniversalOpinionImportance));
        }
示例#3
0
        public static bool ShouldImplicitlyEndInformalRelationship(Pawn pawn, Pawn other, PawnRelationDef relation)
        {
            if (CanDecay(pawn, other, relation))
            {
                return(true);
            }
            if (RelationshipUtility.IsPolygamist(pawn))
            {
                return(false);
            }

            float chance = Mathf.InverseLerp(80, -20, AttractionUtility.GetRelationshipUnmodifiedOpinion(pawn, other));

            chance *= (relation.GetModExtension <RomanticRelationExtension>().relationshipLevel / (relation.GetModExtension <RomanticRelationExtension>().relationshipLevel + 1));
            if (PsycheHelper.PsychologyEnabled(pawn))
            {
                chance *= Mathf.Lerp(0f, 2f, PsycheHelper.Comp(pawn).Psyche.GetPersonalityRating(PersonalityNodeDefOfGR.Moralistic));
            }
            if (Rand.Value < chance)
            {
                return(true);
            }
            return(false);
        }