Beispiel #1
0
        public override void Interacted(Pawn initiator, Pawn recipient, List <RulePackDef> extraSentencePacks, out string letterText, out string letterLabel, out LetterDef letterDef)
        {
            ///Stitched in from Psychology.
            Thought         thought  = this.RandomBreakupReason(initiator, recipient);
            PawnRelationDef relation = RelationshipUtility.MostAdvancedRelationshipBetween(initiator, recipient);

            if (initiator.relations.DirectRelationExists(PawnRelationDefOf.Spouse, recipient))
            {
                BreakupUtility.RelationToEx(initiator, recipient, PawnRelationDefOf.Spouse);
                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
            {
                BreakupUtility.ResolveBreakup(initiator, recipient, RelationshipUtility.MostAdvancedRelationshipBetween(initiator, recipient));
            }
            //Idea - who gets the bedroom? Could be interesting.
            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();

            if (RelationshipUtility.IsInformalRelationship(relation))
            {
                stringBuilder.AppendLine("LetterInformalRelationsEnds".Translate(initiator.Named("PAWN1"), recipient.Named("PAWN2")));
                letterDef   = LetterDefOf.NeutralEvent;
                letterLabel = "LetterLabelInformalRelationsEnds".Translate();
            }
            else
            {
                stringBuilder.AppendLine("LetterNoLongerLovers".Translate(initiator.LabelShort, recipient.LabelShort, initiator.Named("PAWN1"), recipient.Named("PAWN2")));
                letterDef   = LetterDefOf.NegativeEvent;
                letterLabel = "LetterLabelBreakup".Translate();
            }

            if (thought != null)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine("FinalStraw".Translate(thought.CurStage.label.CapitalizeFirst()));
            }
            if (PawnUtility.ShouldSendNotificationAbout(initiator) || PawnUtility.ShouldSendNotificationAbout(recipient))
            {
                letterDef   = null;
                letterLabel = null;
                letterText  = null;
            }
            else if (RelationshipUtility.IsInformalRelationship(relation) && GradualRomanceMod.informalRomanceLetters == false)
            {
                letterDef   = null;
                letterLabel = null;
                letterText  = null;
            }
            else
            {
                letterText = stringBuilder.ToString();
            }
        }