// 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;
        }
        // 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.None);

            prepare.NPCWithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            prepare.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            prepare.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            prepare.WithEffect(EffecterDefOf.Vomit, TargetIndex.A);
            prepare.PlaySustainerOrSound(() => SoundDefOf.Vomit);
            yield return(prepare);

            Toil use = new Toil();

            use.initAction = delegate()
            {
                Pawn actor = use.actor;
                base.Map.roofGrid.SetRoof(TargetA.Cell, RoofDefOf.RoofConstructed);
                MoteMaker.PlaceTempRoof(TargetA.Cell, base.Map);
            };
            use.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(use);

            yield break;
        }
        // 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.None);

            prepare.NPCWithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            prepare.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            prepare.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            prepare.WithEffect(EffecterDefOf.Vomit, TargetIndex.A);
            prepare.PlaySustainerOrSound(() => SoundDefOf.Vomit);
            yield return(prepare);

            Toil use = new Toil();

            use.initAction = delegate()
            {
                Pawn actor = use.actor;
                MyDef = XenomorphDefOf.RRY_Xenomorph_Hive;
                Thing    thing = ThingMaker.MakeThing(MyDef);
                HiveLike hive  = (HiveLike)thing;
                GenSpawn.Spawn(thing, TargetA.Cell, actor.Map, Rot4.South, WipeMode.FullRefund, false);
            };
            use.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(use);

            yield break;
        }
        // Token: 0x06000373 RID: 883 RVA: 0x0001EF58 File Offset: 0x0001D358
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnIncapable(PawnCapacityDefOf.Manipulation);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));

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

            prepare.NPCWithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            prepare.FailOnDespawnedNullOrForbidden(TargetIndex.A);

            prepare.WithEffect(EffecterDefOf.Vomit, TargetIndex.A);
            prepare.PlaySustainerOrSound(() => SoundDefOf.Vomit);
            yield return(prepare);

            Toil use = new Toil();

            use.initAction = delegate()
            {
                Pawn actor      = use.actor;
                Pawn Infectable = (Pawn)actor.CurJob.targetA.Thing;
                Infectable.health.AddHediff(heCocDeff);
            };
            use.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(use);

            yield break;
        }
Example #5
0
        // Token: 0x06000373 RID: 883 RVA: 0x0001EF58 File Offset: 0x0001D358
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnIncapable(PawnCapacityDefOf.Manipulation);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, true, false));

            Toil carryToCell = Toils_Haul.CarryHauledThingToCell(TargetIndex.C);

            yield return(carryToCell);

            /*
             * yield return new Toil
             * {
             *  initAction = delegate ()
             *  {
             *      if (this.pawn.Position.OnEdge(this.pawn.Map) || this.pawn.Map.exitMapGrid.IsExitCell(this.pawn.Position))
             *      {
             *          this.pawn.ExitMap(true, CellRect.WholeMap(base.Map).GetClosestEdge(this.pawn.Position));
             *      }
             *  },
             *  defaultCompleteMode = ToilCompleteMode.Instant
             * };
             */
            //    yield return Toils_Goto.GotoCell(TargetIndex.C, PathEndMode.OnCell);
            if (Takee == null || Takee.Dead)
            {
                yield break;
            }
            yield return(Toils_Haul.PlaceHauledThingInCell(TargetIndex.B, carryToCell, false));

            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.InteractionCell);
            prepare.WithEffect(EffecterDefOf.Vomit, TargetIndex.A);
            prepare.PlaySustainerOrSound(() => SoundDefOf.Vomit);
            yield return(prepare);

            Toil use = new Toil();

            use.initAction = delegate()
            {
                Pawn actor      = use.actor;
                Pawn Infectable = (Pawn)actor.CurJob.targetA.Thing;
                Infectable.health.AddHediff(heCocDeff);
            };
            use.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(use);

            yield break;
        }
        public override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnIncapable(PawnCapacityDefOf.Manipulation);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));

            if (_Necron == null)
            {
                Log.Warning("ERROR!!!! _Necron null");
                yield break;
            }
            if (!DamagedNecron.Spawned && !DamagedNecron.Corpse.Spawned)
            {
                Log.Warning("ERROR!!!! DamagedNecron despawned");
                yield break;
            }
            if (DamagedNecron == null)
            {
                Log.Warning("ERROR!!!! DamagedNecron null");
                yield break;
            }
            if (!_Necron.PawnHediffs.NullOrEmpty())
            {
                //    Log.Message("CHECKING!!!! _Necron Damage");
                foreach (Hediff hd in _Necron.PawnHediffs)
                {
                    if (hd.def.hediffClass == typeof(Hediff_Injury))
                    {
                        //    Log.Message("INJURY!!!!");
                        this.useDuration += (int)(((hd.Severity * DamagedNecron.BodySize)) * (_Necron.UnhealableHediffs.Contains(hd) ? 3 : 1));
                    }
                    else if (hd.def.hediffClass == typeof(Hediff_MissingPart) && !DamagedNecron.health.hediffSet.PartOrAnyAncestorHasDirectlyAddedParts(hd.Part))
                    {
                        //    Log.Message("MISSING PART!!!!");
                        this.useDuration += (int)(((300 * DamagedNecron.BodySize) * hd.Severity) * (_Necron.UnhealableHediffs.Contains(hd) ? 3 : 1));
                    }
                    else
                    {
                        //    Log.Message("STILL CHECKING!!!!");
                        if (hd.def.hediffClass != typeof(Hediff_Implant) && hd.def.hediffClass != typeof(Hediff_MissingPart))
                        {
                            //    Log.Message("NOT IMPLANT OR MISSINGPART!!!!");
                        }
                        //    Log.Message(string.Format("Missed {0} {1} on {2}", hd.LabelCap, hd.def.hediffClass, hd.Part.LabelCap));
                    }
                }
            }
            else
            {
                //   Log.Warning("ERROR!!!! DamagedNecron null");
            }
            if (DamagedNecron.Dead)
            {
                this.useDuration = (int)(500 * DamagedNecron.BodySize);
            }
            Toil prepare = Toils_General.Wait(this.useDuration, TargetIndex.A);

            prepare.NPCWithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            prepare.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            prepare.WithEffect(EffecterDefOf.ConstructMetal, TargetIndex.A);
            prepare.PlaySustainerOrSound(() => SoundDefOf.Crunch);
            if (DamagedNecron.Dead)
            {
                yield return(prepare);

                Toil use = new Toil();
                use.initAction = delegate()
                {
                    Pawn Spyder = use.actor;
                    _Necron.TryRevive(true);
                };
                use.defaultCompleteMode = ToilCompleteMode.Instant;
                yield return(use);
            }
            else
            {
                if (DamagedNecron.Downed)
                {
                    yield return(prepare);

                    Toil use = new Toil();
                    use.initAction = delegate()
                    {
                        Pawn Spyder = use.actor;
                        foreach (Hediff hd in _Necron.PawnHediffs)
                        {
                            DamagedNecron.health.RemoveHediff(hd);
                        }
                    };
                    use.defaultCompleteMode = ToilCompleteMode.Instant;
                    yield return(use);

                    if (_Necron.originalWeapon != null)
                    {
                        ThingWithComps thing = _Necron.originalWeapon;
                        if (thing.Spawned)
                        {
                            thing.DeSpawn();
                        }
                        if (DamagedNecron.inventory.innerContainer.Contains(thing))
                        {
                            DamagedNecron.inventory.innerContainer.Remove(thing);
                        }
                        DamagedNecron.equipment.AddEquipment(thing);
                    }
                    if (_Necron.secondryWeapon != null)
                    {
                        ThingWithComps thing = _Necron.secondryWeapon;
                        if (thing.Spawned)
                        {
                            thing.DeSpawn();
                        }
                        if (DamagedNecron.inventory.innerContainer.Contains(thing))
                        {
                            DamagedNecron.inventory.innerContainer.Remove(thing);
                        }
                        //    DamagedNecron.equipment.AdMechAddOffHandEquipment(thing);
                    }
                }
            }
            yield break;
        }