コード例 #1
0
 private void ChooseNextTarget()
 {
     InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(this.pawn, MentalState_InsultingSpreeAll.candidates, true);
     if (!MentalState_InsultingSpreeAll.candidates.Any <Pawn>())
     {
         this.target = null;
         this.insultedTargetAtLeastOnce = false;
         this.targetFoundTicks          = -1;
     }
     else
     {
         Pawn pawn;
         if (this.target != null && Find.TickManager.TicksGame - this.targetFoundTicks > 1250 && MentalState_InsultingSpreeAll.candidates.Any((Pawn x) => x != this.target))
         {
             pawn = (from x in MentalState_InsultingSpreeAll.candidates
                     where x != this.target
                     select x).RandomElementByWeight((Pawn x) => this.GetCandidateWeight(x));
         }
         else
         {
             pawn = MentalState_InsultingSpreeAll.candidates.RandomElementByWeight((Pawn x) => this.GetCandidateWeight(x));
         }
         if (pawn != this.target)
         {
             this.target = pawn;
             this.insultedTargetAtLeastOnce = false;
             this.targetFoundTicks          = Find.TickManager.TicksGame;
         }
     }
 }
コード例 #2
0
        private bool TryFindNewTarget()
        {
            InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(this.pawn, MentalState_TargetedInsultingSpree.candidates, false);
            bool result = MentalState_TargetedInsultingSpree.candidates.TryRandomElement(out this.target);

            MentalState_TargetedInsultingSpree.candidates.Clear();
            return(result);
        }
コード例 #3
0
        private bool TryFindNewTarget()
        {
            InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(pawn, candidates, allowPrisoners: false);
            bool result = candidates.TryRandomElement(out target);

            candidates.Clear();
            return(result);
        }
        private bool TryFindNewTarget()
        {
            InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(base.pawn, MentalState_TargetedInsultingSpree.candidates, false);
            bool result = ((IEnumerable <Pawn>)MentalState_TargetedInsultingSpree.candidates).TryRandomElement <Pawn>(out base.target);

            MentalState_TargetedInsultingSpree.candidates.Clear();
            return(result);
        }
        public override bool StateCanOccur(Pawn pawn)
        {
            if (!base.StateCanOccur(pawn))
            {
                return(false);
            }
            InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(pawn, MentalStateWorker_TargetedInsultingSpree.candidates, false);
            bool result = MentalStateWorker_TargetedInsultingSpree.candidates.Any <Pawn>();

            MentalStateWorker_TargetedInsultingSpree.candidates.Clear();
            return(result);
        }
コード例 #6
0
        public override bool StateCanOccur(Pawn pawn)
        {
            if (!base.StateCanOccur(pawn))
            {
                return(false);
            }
            InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(pawn, MentalStateWorker_InsultingSpreeAll.candidates, true);
            bool result = MentalStateWorker_InsultingSpreeAll.candidates.Count >= 2;

            MentalStateWorker_InsultingSpreeAll.candidates.Clear();
            return(result);
        }
コード例 #7
0
        public override bool StateCanOccur(Pawn pawn)
        {
            if (!base.StateCanOccur(pawn))
            {
                return(false);
            }
            InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(pawn, candidates, allowPrisoners: false);
            bool result = candidates.Any();

            candidates.Clear();
            return(result);
        }
コード例 #8
0
        private void ChooseNextTarget()
        {
            InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(base.pawn, candidates);
            if (!candidates.Any())
            {
                target = null;
                insultedTargetAtLeastOnce = false;
                targetFoundTicks          = -1;
                return;
            }
            Pawn pawn = (target == null || Find.TickManager.TicksGame - targetFoundTicks <= 1250 || !candidates.Any((Pawn x) => x != target)) ? candidates.RandomElementByWeight((Pawn x) => GetCandidateWeight(x)) : candidates.Where((Pawn x) => x != target).RandomElementByWeight((Pawn x) => GetCandidateWeight(x));

            if (pawn != target)
            {
                target = pawn;
                insultedTargetAtLeastOnce = false;
                targetFoundTicks          = Find.TickManager.TicksGame;
            }
        }
コード例 #9
0
 private void ChooseNextTarget()
 {
     InsultingSpreeMentalStateUtility.GetInsultCandidatesFor(base.pawn, MentalState_InsultingSpreeAll.candidates, true);
     if (!MentalState_InsultingSpreeAll.candidates.Any())
     {
         base.target = null;
         base.insultedTargetAtLeastOnce = false;
         this.targetFoundTicks          = -1;
     }
     else
     {
         Pawn pawn = (base.target == null || Find.TickManager.TicksGame - this.targetFoundTicks <= 1250 || !MentalState_InsultingSpreeAll.candidates.Any((Pawn x) => x != base.target)) ? MentalState_InsultingSpreeAll.candidates.RandomElementByWeight((Pawn x) => this.GetCandidateWeight(x)) : (from x in MentalState_InsultingSpreeAll.candidates
                                                                                                                                                                                                                                                                                                    where x != base.target
                                                                                                                                                                                                                                                                                                    select x).RandomElementByWeight((Pawn x) => this.GetCandidateWeight(x));
         if (pawn != base.target)
         {
             base.target = pawn;
             base.insultedTargetAtLeastOnce = false;
             this.targetFoundTicks          = Find.TickManager.TicksGame;
         }
     }
 }