public static bool NewInteracted(InteractionWorker_Breakup __instance, Pawn initiator, Pawn recipient, List <RulePackDef> extraSentencePacks) { /* If you want to patch this method, you can stuff it. */ Thought thought = __instance.RandomBreakupReason(initiator, recipient); if (initiator.relations.DirectRelationExists(PawnRelationDefOf.Spouse, recipient)) { initiator.relations.RemoveDirectRelation(PawnRelationDefOf.Spouse, recipient); initiator.relations.AddDirectRelation(PawnRelationDefOf.ExSpouse, recipient); recipient.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.DivorcedMe, initiator); recipient.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfPsychology.BrokeUpWithMeCodependent, initiator); initiator.needs.mood.thoughts.memories.RemoveMemoriesOfDef(ThoughtDefOf.GotMarried); recipient.needs.mood.thoughts.memories.RemoveMemoriesOfDef(ThoughtDefOf.GotMarried); initiator.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(ThoughtDefOf.HoneymoonPhase, recipient); recipient.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(ThoughtDefOf.HoneymoonPhase, initiator); } else { initiator.relations.TryRemoveDirectRelation(PawnRelationDefOf.Lover, recipient); initiator.relations.TryRemoveDirectRelation(PawnRelationDefOf.Fiance, recipient); if (PsycheHelper.PsychologyEnabled(initiator) && PsycheHelper.PsychologyEnabled(recipient)) { BreakupHelperMethods.AddExLover(initiator, recipient); //AddExLover(realRecipient, realInitiator); BreakupHelperMethods.AddBrokeUpOpinion(recipient, initiator); BreakupHelperMethods.AddBrokeUpMood(recipient, initiator); BreakupHelperMethods.AddBrokeUpMood(initiator, recipient); } else { initiator.relations.AddDirectRelation(PawnRelationDefOf.ExLover, recipient); recipient.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.BrokeUpWithMe, initiator); recipient.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOfPsychology.BrokeUpWithMeCodependent, initiator); } } if (initiator.ownership.OwnedBed != null && initiator.ownership.OwnedBed == recipient.ownership.OwnedBed) { Pawn pawn = (Rand.Value >= 0.5f) ? recipient : initiator; pawn.ownership.UnclaimBed(); } TaleRecorder.RecordTale(TaleDefOf.Breakup, new object[] { initiator, recipient }); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("LetterNoLongerLovers".Translate(initiator, recipient)); if (thought != null) { stringBuilder.AppendLine(); stringBuilder.AppendLine("FinalStraw".Translate(thought.CurStage.label)); } if (PawnUtility.ShouldSendNotificationAbout(initiator) || PawnUtility.ShouldSendNotificationAbout(recipient)) { Find.LetterStack.ReceiveLetter("LetterLabelBreakup".Translate(), stringBuilder.ToString(), LetterDefOf.NegativeEvent, initiator, null); } return(false); }
public static bool BreakRelations(Pawn pawn, ref List <Pawn> oldLoversAndFiances) { oldLoversAndFiances = new List <Pawn>(); PsychologyPawn realPawn = pawn as PsychologyPawn; while (true) { Pawn firstDirectRelationPawn = pawn.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Lover, null); if (firstDirectRelationPawn != null && (!firstDirectRelationPawn.story.traits.HasTrait(TraitDefOfPsychology.Polygamous) || !pawn.story.traits.HasTrait(TraitDefOfPsychology.Polygamous))) { pawn.relations.RemoveDirectRelation(PawnRelationDefOf.Lover, firstDirectRelationPawn); PsychologyPawn realRecipient = firstDirectRelationPawn as PsychologyPawn; if (realPawn != null && realRecipient != null) { BreakupHelperMethods.AddExLover(realPawn, realRecipient); BreakupHelperMethods.AddExLover(realRecipient, realPawn); BreakupHelperMethods.AddBrokeUpOpinion(realRecipient, realPawn); BreakupHelperMethods.AddBrokeUpMood(realRecipient, realPawn); BreakupHelperMethods.AddBrokeUpMood(realPawn, realRecipient); } else { pawn.relations.AddDirectRelation(PawnRelationDefOf.ExLover, firstDirectRelationPawn); } oldLoversAndFiances.Add(firstDirectRelationPawn); } else { Pawn firstDirectRelationPawn2 = pawn.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Fiance, null); if (firstDirectRelationPawn2 == null) { break; } else if (!firstDirectRelationPawn2.story.traits.HasTrait(TraitDefOfPsychology.Polygamous) || !pawn.story.traits.HasTrait(TraitDefOfPsychology.Polygamous)) { pawn.relations.RemoveDirectRelation(PawnRelationDefOf.Fiance, firstDirectRelationPawn2); PsychologyPawn realRecipient2 = firstDirectRelationPawn2 as PsychologyPawn; if (realPawn != null && realRecipient2 != null) { BreakupHelperMethods.AddExLover(realPawn, realRecipient2); BreakupHelperMethods.AddExLover(realRecipient2, realPawn); BreakupHelperMethods.AddBrokeUpOpinion(realRecipient2, realPawn); BreakupHelperMethods.AddBrokeUpMood(realRecipient2, realPawn); BreakupHelperMethods.AddBrokeUpMood(realPawn, realRecipient2); } else { pawn.relations.AddDirectRelation(PawnRelationDefOf.ExLover, firstDirectRelationPawn2); } oldLoversAndFiances.Add(firstDirectRelationPawn2); } } } return(false); }