private void BreakLoverAndFianceRelations(Pawn pawn, out List <Pawn> oldLoversAndFiances) { oldLoversAndFiances = new List <Pawn> { }; List <PawnRelationDef> relationsToBreak = RelationshipUtility.ListOfBreakupRelationships(); for (int i = 0; i < relationsToBreak.Count(); i++) { PawnRelationDef relation = relationsToBreak[i]; List <Pawn> pawns = RelationshipUtility.GetAllPawnsWithGivenRelationshipTo(pawn, relation); for (int i2 = 1; i2 < pawns.Count(); i2++) { Pawn other = pawns[i2]; if (!RelationshipUtility.IsPolygamist(pawn) || !RelationshipUtility.IsPolygamist(other)) { if (!relation.GetModExtension <RomanticRelationExtension>().isFormalRelationship&& !BreakupUtility.ShouldImplicitlyEndInformalRelationship(pawn, other, relation)) { continue; } BreakupUtility.ResolveBreakup(pawn, other, relation); oldLoversAndFiances.Add(other); } } } }
public override float Calculate(Pawn observer, Pawn assessed) { float weight = 1f; if (RelationshipUtility.IsPolygamist(assessed) && !RelationshipUtility.IsPolygamist(observer)) { weight *= .85f; } else if (RelationshipUtility.IsPolygamist(assessed) && RelationshipUtility.IsPolygamist(observer)) { weight *= 1.2f; } return(weight); }
public static void TryAddCheaterThought(Pawn pawn, Pawn cheater, Pawn cheaterLover) { { if (pawn.Dead) { return; } if (RelationshipUtility.IsPolygamist(pawn)) { pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfGR.CheatedOnMePolygamist, cheater); } else { float toleranceChance = 0.4f; //people who are codependent are more tolerant of cheating, even though they are less likely to cheat if (pawn.story.traits.HasTrait(TraitDefOfPsychology.Codependent)) { toleranceChance *= 2f; } //moralistic characters are less tolerant of cheating. if (PsycheHelper.PsychologyEnabled(pawn)) { toleranceChance *= (1.5f - PsycheHelper.Comp(pawn).Psyche.GetPersonalityRating(PersonalityNodeDefOfGR.Moralistic)); } //they are more likely to tolerate cheating if they like the person who the cheater is cheating with. toleranceChance *= Mathf.Min(0f, Mathf.InverseLerp(-80f, 30f, pawn.relations.OpinionOf(cheaterLover))); toleranceChance = Mathf.Clamp01(toleranceChance); if (Rand.Value < toleranceChance) { pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfGR.CheatedOnMeTolerated, cheater); } else { if (pawn.relations.OpinionOf(cheaterLover) >= 30f) { pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfGR.CheatedOnMeHighOpinion, cheater); } else { pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.CheatedOnMe, cheater); } } pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfGR.LoversLover, cheaterLover); //cheaterLover.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfGR.LoversLover, pawn); } } }
/// This is a mish-mash of copy-pasted code. /// Mostly copy-pasted from Psychology Mod by Word-Mule /// /// Does the same function but excludes lovefriends and sweethearts /// /// protected override ThoughtState CurrentStateInternal(Pawn p) { DirectPawnRelation directPawnRelation = RelationshipUtility.MostLikedBedSharingRelationship(p, false); if (directPawnRelation == null) { return(ThoughtState.Inactive); } bool multiplePartners = (from r in p.relations.PotentiallyRelatedPawns where RelationshipUtility.ShouldShareBed(p, r) select r).Count() > 1; bool partnerBedInRoom; if (p.ownership.OwnedBed != null) { partnerBedInRoom = (from t in p.ownership.OwnedBed.GetRoom().ContainedBeds where t.AssignedPawns.Contains(directPawnRelation.otherPawn) select t).Count() > 0; } else { partnerBedInRoom = false; } if (directPawnRelation != null && p.ownership.OwnedBed != null && RelationshipUtility.IsPolygamist(p) && multiplePartners && partnerBedInRoom) { return(ThoughtState.Inactive); } if (p.ownership.OwnedBed != null && p.ownership.OwnedBed == directPawnRelation.otherPawn.ownership.OwnedBed) { return(ThoughtState.Inactive); } if (p.relations.OpinionOf(directPawnRelation.otherPawn) <= 0) { return(ThoughtState.Inactive); } return(ThoughtState.ActiveDefault); }
public static bool ShouldBeJealous(Pawn observer, Pawn initiator, Pawn recipient) { if (RelationshipUtility.IsPolygamist(observer)) { return(false); } PawnRelationDef initiatorRelationship = RelationshipUtility.MostAdvancedRelationshipBetween(observer, initiator); PawnRelationDef recipientRelationship = RelationshipUtility.MostAdvancedRelationshipBetween(observer, recipient); if (initiatorRelationship == null) { return(false); } if (!initiatorRelationship.GetModExtension <RomanticRelationExtension>().caresAboutCheating) { return(false); } if (recipientRelationship != null && !observer.story.traits.HasTrait(TraitDefOfGR.Jealous)) { return(false); } return(true); }
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); }