// Token: 0x06000393 RID: 915 RVA: 0x000245C8 File Offset: 0x000229C8
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnIncapable(PawnCapacityDefOf.Manipulation);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            Toil prepare = Toils_General.Wait(this.useDuration, TargetIndex.A);

            prepare.NPCWithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            prepare.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            prepare.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            yield return(prepare);

            Toil use = new Toil();

            use.initAction = delegate()
            {
                Pawn actor = use.actor;
                Victim.health.AddHediff(heDiffDeff, Victim.RaceProps.body.corePart);
                Hediff hediff = Victim.health.hediffSet.GetFirstHediffOfDef(heDiffDeff);
                HediffComp_XenoSpawner _XenoSpawner = hediff.TryGetComp <HediffComp_XenoSpawner>();
                _XenoSpawner.countToSpawn          = Rand.RangeInclusive(1, 4);
                _XenoSpawner.predalienImpregnation = true;
            };
            use.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(use);

            yield break;
        }
Example #2
0
        private static void XenomorphImpregnationRoyale(Pawn p)
        {
            HediffDef hediffDef = XenomorphDefOf.RRY_XenomorphImpregnation;

            if (!p.isPotentialHost(out string fail))
            {
                if (!fail.NullOrEmpty())
                {
                    Log.Error(string.Format("Failed to Add {0} to {1}, Reason: {2}", hediffDef.LabelCap, p.NameShortColored, fail));
                }
            }
            BodyPartRecord bodyPartRecord = (from x in p.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null)
                                             where !x.def.conceptual && x.IsCorePart
                                             select x).First <BodyPartRecord>();

            if (bodyPartRecord != null)
            {
                p.health.AddHediff(hediffDef, bodyPartRecord, null, null);
                Hediff hediff = p.health.hediffSet.GetFirstHediffOfDef(hediffDef);
                HediffComp_XenoSpawner hediffcomp = hediff.TryGetComp <HediffComp_XenoSpawner>();
                hediffcomp.royaleHugger = true;
                hediff.Severity         = 0.90f;
            }
            else
            {
                Log.Error(string.Format("Failed to Add {0} to {1}, Reason: bodyPartRecord == Null", hediffDef.LabelCap, p.NameShortColored));
            }
        }