Ejemplo n.º 1
0
        public override bool TryMergeWithExistingMemory(out bool showBubble)
        {
            ThoughtHandler            thoughts = this.pawn.needs.mood.thoughts;
            Thought_MemoryObservation thought_MemoryObservation = null;
            List <Thought_Memory>     memories = thoughts.memories.Memories;

            for (int i = 0; i < memories.Count; i++)
            {
                Thought_MemoryObservation thought_MemoryObservation2 = memories[i] as Thought_MemoryObservation;
                if (thought_MemoryObservation2 != null && thought_MemoryObservation2.def == this.def && thought_MemoryObservation2.targetThingID == this.targetThingID && (thought_MemoryObservation == null || thought_MemoryObservation2.age > thought_MemoryObservation.age))
                {
                    thought_MemoryObservation = thought_MemoryObservation2;
                }
            }
            bool result;

            if (thought_MemoryObservation != null)
            {
                showBubble = (thought_MemoryObservation.age > thought_MemoryObservation.def.DurationTicks / 2);
                thought_MemoryObservation.Renew();
                result = true;
            }
            else
            {
                showBubble = true;
                result     = false;
            }
            return(result);
        }
Ejemplo n.º 2
0
 public Need_Mood(Pawn pawn)
     : base(pawn)
 {
     thoughts     = new ThoughtHandler(pawn);
     observer     = new PawnObserver(pawn);
     recentMemory = new PawnRecentMemory(pawn);
 }
Ejemplo n.º 3
0
        public virtual bool TryMergeWithExistingMemory(out bool showBubble)
        {
            ThoughtHandler thoughts = pawn.needs.mood.thoughts;

            if (thoughts.memories.NumMemoriesInGroup(this) >= def.stackLimit)
            {
                Thought_Memory thought_Memory = thoughts.memories.OldestMemoryInGroup(this);
                if (thought_Memory != null)
                {
                    showBubble = (thought_Memory.age > thought_Memory.def.DurationTicks / 2);
                    thought_Memory.Renew();
                    return(true);
                }
            }
            showBubble = true;
            return(false);
        }
 public string OpinionExplanation(Pawn other)
 {
     if (other.RaceProps.Humanlike && this.pawn != other)
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendLine("OpinionOf".Translate(other.LabelShort) + ": " + this.OpinionOf(other).ToStringWithSign());
         string pawnSituationLabel = SocialCardUtility.GetPawnSituationLabel(other, this.pawn);
         if (!pawnSituationLabel.NullOrEmpty())
         {
             stringBuilder.AppendLine(pawnSituationLabel);
         }
         stringBuilder.AppendLine("--------------");
         bool flag = false;
         if (this.pawn.Dead)
         {
             stringBuilder.AppendLine("IAmDead".Translate());
             flag = true;
         }
         else
         {
             IEnumerable <PawnRelationDef> relations = this.pawn.GetRelations(other);
             foreach (PawnRelationDef item in relations)
             {
                 stringBuilder.AppendLine(item.GetGenderSpecificLabelCap(other) + ": " + item.opinionOffset.ToStringWithSign());
                 flag = true;
             }
             if (this.pawn.RaceProps.Humanlike)
             {
                 ThoughtHandler thoughts = this.pawn.needs.mood.thoughts;
                 thoughts.GetDistinctSocialThoughtGroups(other, Pawn_RelationsTracker.tmpSocialThoughts);
                 for (int i = 0; i < Pawn_RelationsTracker.tmpSocialThoughts.Count; i++)
                 {
                     ISocialThought socialThought = Pawn_RelationsTracker.tmpSocialThoughts[i];
                     int            num           = 1;
                     Thought        thought       = (Thought)socialThought;
                     if (thought.def.IsMemory)
                     {
                         num = thoughts.memories.NumMemoriesInGroup((Thought_MemorySocial)socialThought);
                     }
                     stringBuilder.Append(thought.LabelCapSocial);
                     if (num != 1)
                     {
                         stringBuilder.Append(" x" + num);
                     }
                     stringBuilder.AppendLine(": " + thoughts.OpinionOffsetOfGroup(socialThought, other).ToStringWithSign());
                     flag = true;
                 }
             }
             List <Hediff> hediffs = this.pawn.health.hediffSet.hediffs;
             for (int j = 0; j < hediffs.Count; j++)
             {
                 HediffStage curStage = hediffs[j].CurStage;
                 if (curStage != null && curStage.opinionOfOthersFactor != 1.0)
                 {
                     stringBuilder.Append(hediffs[j].LabelBase.CapitalizeFirst());
                     if (curStage.opinionOfOthersFactor != 0.0)
                     {
                         stringBuilder.AppendLine(": x" + curStage.opinionOfOthersFactor.ToStringPercent());
                     }
                     else
                     {
                         stringBuilder.AppendLine();
                     }
                     flag = true;
                 }
             }
             if (this.pawn.HostileTo(other))
             {
                 stringBuilder.AppendLine("Hostile".Translate());
                 flag = true;
             }
         }
         if (!flag)
         {
             stringBuilder.AppendLine("NoneBrackets".Translate());
         }
         return(stringBuilder.ToString().TrimEndNewlines());
     }
     return(string.Empty);
 }