コード例 #1
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            IntVec3 c;
            Job     result;

            if (!RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn))
            {
                result = null;
            }
            else
            {
                Pawn pawn2 = KidnapAIUtility.ReachableWoundedGuest(pawn);
                if (pawn2 == null)
                {
                    result = null;
                }
                else
                {
                    result = new Job(JobDefOf.Kidnap)
                    {
                        targetA = pawn2,
                        targetB = c,
                        count   = 1
                    };
                }
            }
            return(result);
        }
コード例 #2
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            IntVec3 c;
            Job     result;
            Pawn    t;

            if (!RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn))
            {
                result = null;
            }
            else if (KidnapAIUtility.TryFindGoodKidnapVictim(pawn, 18f, out t, null) && !GenAI.InDangerousCombat(pawn))
            {
                result = new Job(JobDefOf.Kidnap)
                {
                    targetA = t,
                    targetB = c,
                    count   = 1
                };
            }
            else
            {
                result = null;
            }
            return(result);
        }
コード例 #3
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     if (signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % 120 == 0)
     {
         if (this.data == null || !(this.data is TriggerData_PawnCycleInd))
         {
             BackCompatibility.TriggerDataPawnCycleIndNull(this);
         }
         if (Find.TickManager.TicksGame - lord.lastPawnHarmTick > 300)
         {
             TriggerData_PawnCycleInd data = this.Data;
             data.pawnCycleInd++;
             if (data.pawnCycleInd >= lord.ownedPawns.Count)
             {
                 data.pawnCycleInd = 0;
             }
             if (lord.ownedPawns.Any <Pawn>())
             {
                 Pawn pawn = lord.ownedPawns[data.pawnCycleInd];
                 if (pawn.Spawned && !pawn.Downed && pawn.MentalStateDef == null)
                 {
                     Pawn pawn2;
                     if (KidnapAIUtility.TryFindGoodKidnapVictim(pawn, 8f, out pawn2, null) && !GenAI.InDangerousCombat(pawn))
                     {
                         return(true);
                     }
                 }
             }
         }
     }
     return(false);
 }
コード例 #4
0
        protected override bool TryFindGoodOpportunisticTaskTarget(Pawn pawn, out Thing target, List <Thing> alreadyTakenTargets)
        {
            if (pawn.mindState.duty != null && pawn.mindState.duty.def == this.DutyDef && pawn.carryTracker.CarriedThing is Pawn)
            {
                target = pawn.carryTracker.CarriedThing;
                return(true);
            }
            Pawn pawn2  = default(Pawn);
            bool result = KidnapAIUtility.TryFindGoodKidnapVictim(pawn, 8f, out pawn2, alreadyTakenTargets);

            target = pawn2;
            return(result);
        }
コード例 #5
0
ファイル: JobGiver_Kidnap.cs プロジェクト: potsh/RimWorld
 protected override Job TryGiveJob(Pawn pawn)
 {
     if (!RCellFinder.TryFindBestExitSpot(pawn, out IntVec3 spot))
     {
         return(null);
     }
     if (KidnapAIUtility.TryFindGoodKidnapVictim(pawn, 18f, out Pawn victim) && !GenAI.InDangerousCombat(pawn))
     {
         Job job = new Job(JobDefOf.Kidnap);
         job.targetA = victim;
         job.targetB = spot;
         job.count   = 1;
         return(job);
     }
     return(null);
 }
コード例 #6
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            if (!RCellFinder.TryFindBestExitSpot(pawn, out IntVec3 spot))
            {
                return(null);
            }
            Pawn pawn2 = KidnapAIUtility.ReachableWoundedGuest(pawn);

            if (pawn2 == null)
            {
                return(null);
            }
            Job job = new Job(JobDefOf.Kidnap);

            job.targetA = pawn2;
            job.targetB = spot;
            job.count   = 1;
            return(job);
        }
コード例 #7
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            IntVec3 c = default(IntVec3);

            if (!RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn))
            {
                return(null);
            }
            Pawn t = default(Pawn);

            if (KidnapAIUtility.TryFindGoodKidnapVictim(pawn, 18f, out t, (List <Thing>)null) && !GenAI.InDangerousCombat(pawn))
            {
                Job job = new Job(JobDefOf.Kidnap);
                job.targetA = t;
                job.targetB = c;
                job.count   = 1;
                return(job);
            }
            return(null);
        }
コード例 #8
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     if (signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % 800 == 0)
     {
         TriggerData_PawnCycleInd data = this.Data;
         data.pawnCycleInd++;
         if (data.pawnCycleInd >= lord.ownedPawns.Count)
         {
             data.pawnCycleInd = 0;
         }
         if (lord.ownedPawns.Any <Pawn>())
         {
             Pawn pawn = lord.ownedPawns[data.pawnCycleInd];
             if (pawn.Spawned && !pawn.Downed && !pawn.InMentalState && KidnapAIUtility.ReachableWoundedGuest(pawn) != null)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #9
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            IntVec3 c = default(IntVec3);

            if (!RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn))
            {
                return(null);
            }
            Pawn pawn2 = KidnapAIUtility.ReachableWoundedGuest(pawn);

            if (pawn2 == null)
            {
                return(null);
            }
            Job job = new Job(JobDefOf.Kidnap);

            job.targetA = pawn2;
            job.targetB = c;
            job.count   = 1;
            return(job);
        }
コード例 #10
0
 public override bool ActivateOn(Lord lord, TriggerSignal signal)
 {
     if (signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % 120 == 0 && Find.TickManager.TicksGame - lord.lastPawnHarmTick > 300)
     {
         TriggerData_PawnCycleInd data = this.Data;
         data.pawnCycleInd++;
         if (data.pawnCycleInd >= lord.ownedPawns.Count)
         {
             data.pawnCycleInd = 0;
         }
         if (lord.ownedPawns.Any())
         {
             Pawn pawn  = lord.ownedPawns[data.pawnCycleInd];
             Pawn pawn2 = default(Pawn);
             if (pawn.Spawned && !pawn.Downed && pawn.MentalStateDef == null && KidnapAIUtility.TryFindGoodKidnapVictim(pawn, 8f, out pawn2, (List <Thing>)null) && !GenAI.InDangerousCombat(pawn))
             {
                 return(true);
             }
         }
     }
     return(false);
 }