Esempio n. 1
0
        public override bool StateCanOccur([NotNull] Pawn pawn)
        {
            if (!base.StateCanOccur(pawn))
            {
                return(false);
            }

            if (!Controller.settings.UseHeadRotator)
            {
                return(false);
            }

            InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(pawn, Candidates);
            bool result = Candidates != null && Candidates.Count >= 2;

            Candidates?.Clear();
            return(result);
        }
 // Verse.AI.MentalState_InsultingSpreeAll
 private void ChooseNextTarget()
 {
     InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(this.pawn, Candidates);
     if (!Candidates.Any())
     {
         this.Target = null;
         this.InsultedTargetAtLeastOnce = false;
         this._targetFoundTicks         = -1;
     }
     else
     {
         bool finished = Find.TickManager.TicksGame - this._targetFoundTicks <= MaxSameTargetChaseTicks;
         Pawn p        = this.Target == null || finished || !Candidates.Any(x => x != this.Target)
                             ? Candidates.RandomElementByWeight(x => this.GetCandidateWeight(x))
                             : (from x in Candidates where x != this.Target select x)
                         .RandomElementByWeight(x => this.GetCandidateWeight(x));
         if (p != this.Target)
         {
             this.Target = p;
             this.InsultedTargetAtLeastOnce = false;
             this._targetFoundTicks         = Find.TickManager.TicksGame;
         }
     }
 }