示例#1
0
        private void Initialize(Pawn pawn)
        {
            GenClamor.DoClamor(this.launcher, 5f, ClamorDefOf.Impact);
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();

            pwr = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Overwhelm.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Overwhelm_pwr");
            ver = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Overwhelm.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Overwhelm_ver");
            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
            pwrVal = pwr.level;
            verVal = ver.level;
            if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
            {
                MightPowerSkill mpwr = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                MightPowerSkill mver = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_ver");
                pwrVal = mpwr.level;
                verVal = mver.level;
            }
            this.arcaneDmg = comp.arcaneDmg;
            if (settingsRef.AIHardMode && !pawn.IsColonist)
            {
                pwrVal = 3;
                verVal = 3;
            }
            this.strikeNum = 1;
            initialized    = true;
        }
        protected override void Impact(Thing hitThing)
        {
            base.Impact(hitThing);

            /*
             * Null checking is very important in RimWorld.
             * 99% of errors reported are from NullReferenceExceptions (NREs).
             * Make sure your code checks if things actually exist, before they
             * try to use the code that belongs to said things.
             */
            if (hitThing != null) //Fancy way to declare a variable inside an if statement. - Thanks Erdelf.
            {
                Log.Message("got into the if statement", true);
                Log.Warning("hitThing = " + hitThing.ToString(), true);
                var rand = Rand.Value; // This is a random percentage between 0% and 100%
                GenExplosion.DoExplosion(hitThing.Position, hitThing.Map, 3.9f, DamageDefOf.Bomb, this, 15, 0);
                GenClamor.DoClamor(this, 3.9f, ClamorDefOf.Impact);

                int hitPosX = hitThing.Position.x;
                int hitPosY = hitThing.Position.y;
                for (int g = -3; g < 3; g++)
                {
                    for (int i = -3; i < 3; i++)
                    {
                        IntVec3 positionWhatever = new IntVec3(hitThing.Position.x + i, hitThing.Position.y, hitThing.Position.z + g);
                        if (!MiscCrap.IsBuilingHere(this.launcher.Map, positionWhatever))
                        {
                            int beersToMake = Math.Abs(Math.Abs(g) - 3) + Math.Abs(Math.Abs(i) - 3);
                            for (int b = 0; b < beersToMake; b++)
                            {
                                GenSpawn.Spawn(ThingDefOf.SmokeleafJoint, positionWhatever, hitThing.Map);
                            }
                        }
                    }
                }
            }
            else if (this.launcher.Map != null)
            {
                GenExplosion.DoExplosion(this.Position, this.launcher.Map, 3.9f, DamageDefOf.Bomb, this, 1, 0);
                GenClamor.DoClamor(this, 3.9f, ClamorDefOf.Impact);

                int hitPosX = this.Position.x;
                int hitPosY = this.Position.y;
                for (int g = -3; g < 3; g++)
                {
                    for (int i = -3; i < 3; i++)
                    {
                        IntVec3 positionWhatever = new IntVec3(this.Position.x + i, this.Position.y, this.Position.z + g);
                        if (!MiscCrap.IsBuilingHere(this.launcher.Map, positionWhatever))
                        {
                            int beersToMake = Math.Abs(Math.Abs(g) - 3) + Math.Abs(Math.Abs(i) - 3);
                            for (int b = 0; b < beersToMake; b++)
                            {
                                GenSpawn.Spawn(ThingDefOf.SmokeleafJoint, positionWhatever, this.launcher.Map);
                            }
                        }
                    }
                }
            }
        }
 public static void DoClamor(IntVec3 cell, float radius, Thing source, ClamorDef clamor)
 {
     if (clamor != null)
     {
         GenClamor.DoClamor(source, cell, radius, clamor);
     }
 }
        public static void MakeNew(Pawn actor, Pawn victim)
        {
            string      dmgLabel;
            float       dmgAmount;
            DamageDef   dmgDef;
            RulePackDef dmgRules;

            if (TryGetFangsDmgInfo(actor.GetVampFangs(), out dmgLabel, out dmgAmount, out dmgDef, out dmgRules))
            {
                BodyPartRecord neckPart = victim.health.hediffSet.GetNotMissingParts().FirstOrDefault(x => x.def == BodyPartDefOf.Neck);
                if (neckPart == null)
                {
                    neckPart = victim.health.hediffSet.GetNotMissingParts().FirstOrDefault(x => x.depth == BodyPartDepth.Outside);
                }
                if (neckPart == null)
                {
                    neckPart = victim.health.hediffSet.GetNotMissingParts().RandomElement();
                }
                if (neckPart != null)
                {
                    GenClamor.DoClamor(actor, 10f, ClamorDefOf.Harm);
                    actor.Drawer.Notify_MeleeAttackOn(victim);
                    victim.TakeDamage(new DamageInfo(dmgDef, (int)(dmgAmount * BITEFACTOR), 0, -1, actor, neckPart));
                    BattleLogEntry_MeleeCombat battleLogEntry_MeleeCombat = new BattleLogEntry_MeleeCombat(dmgRules, true, actor, victim, ImplementOwnerTypeDefOf.Bodypart, dmgLabel);
                    Find.BattleLog.Add(battleLogEntry_MeleeCombat);
                }
            }
        }
        public virtual void Apply(LocalTargetInfo target, LocalTargetInfo dest)
        {
            if (Props.screenShakeIntensity > float.Epsilon)
            {
                Find.CameraDriver.shaker.DoShake(Props.screenShakeIntensity);
            }
            Pawn pawn  = parent.pawn;
            Pawn pawn2 = target.Pawn;

            if (pawn2 != null)
            {
                Faction factionOrExtraMiniOrHomeFaction = pawn2.FactionOrExtraMiniOrHomeFaction;
                if (Props.goodwillImpact != 0 && pawn.Faction != null && factionOrExtraMiniOrHomeFaction != null && !factionOrExtraMiniOrHomeFaction.HostileTo(pawn.Faction) && (Props.applyGoodwillImpactToLodgers || !pawn2.IsQuestLodger()) && !pawn2.IsQuestHelper())
                {
                    factionOrExtraMiniOrHomeFaction.TryAffectGoodwillWith(pawn.Faction, Props.goodwillImpact, canSendMessage: true, canSendHostilityLetter: true, "GoodwillChangedReason_UsedAbility".Translate(parent.def.LabelCap, pawn2.LabelShort), pawn2);
                }
            }
            if (Props.clamorType != null)
            {
                GenClamor.DoClamor(parent.pawn, target.Cell, Props.clamorRadius, Props.clamorType);
            }
            if (Props.sound != null)
            {
                Props.sound.PlayOneShot(new TargetInfo(target.Cell, parent.pawn.Map));
            }
            if (!Props.message.NullOrEmpty())
            {
                Messages.Message(Props.message, parent.pawn, Props.messageType ?? MessageTypeDefOf.SilentInput);
            }
        }
示例#6
0
        // Token: 0x06004F05 RID: 20229 RVA: 0x001A99DC File Offset: 0x001A7BDC
        public override void Impact()
        {
            for (int i = 0; i < 6; i++)
            {
                AdeptusMoteMaker.ThrowDustPuff(base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f), base.Map, 1.2f);
            }
            //    MoteMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), base.Map, 2f);
            GenClamor.DoClamor(this, 15f, ClamorDefOf.Impact);
            if (this.def.skyfaller.CausesExplosion)
            {
                GenExplosion.DoExplosion(base.Position, base.Map, this.def.skyfaller.explosionRadius, this.def.skyfaller.explosionDamage, null, GenMath.RoundRandom((float)this.def.skyfaller.explosionDamage.defaultDamage * this.def.skyfaller.explosionDamageFactor), -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false, null, (!this.def.skyfaller.damageSpawnedThings) ? this.innerContainer.ToList <Thing>() : null);
            }
            this.SpawnThings();
            this.innerContainer.ClearAndDestroyContents(DestroyMode.Vanish);
            CellRect cellRect = this.OccupiedRect();

            for (int i = 0; i < cellRect.Area * this.def.skyfaller.motesPerCell; i++)
            {
                AdeptusMoteMaker.ThrowDustPuff(cellRect.RandomVector3, base.Map, 2f);
            }
            if (this.def.skyfaller.MakesShrapnel)
            {
                SkyfallerShrapnelUtility.MakeShrapnel(base.Position, base.Map, this.shrapnelDirection, this.def.skyfaller.shrapnelDistanceFactor, this.def.skyfaller.metalShrapnelCountRange.RandomInRange, this.def.skyfaller.rubbleShrapnelCountRange.RandomInRange, true);
            }
            if (this.def.skyfaller.cameraShake > 0f && base.Map == Find.CurrentMap)
            {
                Find.CameraDriver.shaker.DoShake(this.def.skyfaller.cameraShake);
            }
            if (this.def.skyfaller.impactSound != null)
            {
                this.def.skyfaller.impactSound.PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None));
            }
            this.Destroy(DestroyMode.Vanish);
        }
        public bool TryTeleportTo(LocalTargetInfo target, LocalTargetInfo dest)
        {
            bool result = false;

            if (target.IsValid)
            {
                if (target.Cell != default(IntVec3))
                {
                    if (this.CasterPawn != null && this.CasterPawn.Position.IsValid && this.CasterPawn.Spawned && this.CasterPawn.Map != null && !this.CasterPawn.Downed && !this.CasterPawn.Dead)
                    {
                        LocalTargetInfo destination = target;
                        result = true;
                        if (destination.IsValid)
                        {
                            Pawn pawn = this.parent.pawn;
                            if (!this.parent.def.HasAreaOfEffect)
                            {
                                this.parent.AddEffecterToMaintain(EffecterDefOf.Skip_Entry.Spawn(pawn, pawn.Map, 1f), pawn.Position, 60);
                            }
                            else
                            {
                                this.parent.AddEffecterToMaintain(EffecterDefOf.Skip_EntryNoDelay.Spawn(pawn, pawn.Map, 1f), pawn.Position, 60);
                            }

                            this.parent.AddEffecterToMaintain(EffecterDefOf.Skip_Exit.Spawn(destination.Cell, pawn.Map, 1f), destination.Cell, 60);

                            /*
                             * if (this.Props.destination == AbilityEffectDestination.Selected)
                             * {
                             *      this.parent.AddEffecterToMaintain(EffecterDefOf.Skip_Exit.Spawn(destination.Cell, pawn.Map, 1f), destination.Cell, 60);
                             * }
                             * else
                             * {
                             *      this.parent.AddEffecterToMaintain(EffecterDefOf.Skip_ExitNoDelay.Spawn(destination.Cell, pawn.Map, 1f), destination.Cell, 60);
                             * }
                             */

                            CompCanBeDormant compCanBeDormant = target.Thing.TryGetComp <CompCanBeDormant>();
                            if (compCanBeDormant != null)
                            {
                                compCanBeDormant.WakeUp();
                            }

                            pawn.Position = destination.Cell;
                            pawn.Notify_Teleported(true, true);
                            Pawn pawn2 = target.Thing as Pawn;
                            if (pawn2 != null)
                            {
                                pawn2.stances.stunner.StunFor_NewTmp(this.Props.stunTicks.RandomInRange, this.parent.pawn, false, false);
                            }
                            if (this.Props.destClamorType != null)
                            {
                                GenClamor.DoClamor(pawn, target.Cell, (float)this.Props.destClamorRadius, this.Props.destClamorType);
                            }
                        }
                    }
                }
            }
            return(result);
        }
        protected override void Impact(Thing hitThing)
        {
            if (!this.initialized && !hitThing.DestroyedOrNull())
            {
                this.initialized = true;
                this.caster      = this.launcher as Pawn;
                CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>();
                verVal            = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_ShadowStrike, "TM_ShadowStrike", "_ver", true);
                this.startPos     = caster.Position;
                this.age          = 0;
                this.weaponDamage = GetWeaponDmg(caster);
                this.critChance   = comp.weaponCritChance;

                GenClamor.DoClamor(caster, 2f, ClamorDefOf.Ability);
                if (DoMove(hitThing))
                {
                    DoStrike(hitThing);
                }
            }

            if (age >= 0)
            {
                age++;
            }

            Destroy(DestroyMode.Vanish);
        }
        public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
        {
            if (!target.HasThing)
            {
                return;
            }
            base.Apply(target, dest);
            LocalTargetInfo destination = GetDestination(dest.IsValid ? dest : target);

            if (destination.IsValid)
            {
                Pawn    pawn    = parent.pawn;
                Vector3 drawPos = target.Thing.DrawPos;
                target.Thing.Position = destination.Cell;
                Pawn pawn2 = target.Thing as Pawn;
                if (pawn2 != null)
                {
                    pawn2.stances.stunner.StunFor(Props.stunTicks.RandomInRange, parent.pawn, addBattleLog: false);
                    pawn2.Notify_Teleported();
                }
                if (Props.destClamorType != null)
                {
                    GenClamor.DoClamor(pawn, target.Cell, Props.destClamorRadius, Props.destClamorType);
                }
                MoteMaker.MakeConnectingLine(drawPos, target.Thing.DrawPos, ThingDefOf.Mote_PsycastSkipLine, pawn.Map);
                MoteMaker.MakeStaticMote(drawPos, pawn.Map, ThingDefOf.Mote_PsycastSkipEffectSource);
            }
        }
示例#10
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.A));

            Toil build = new Toil();

            build.initAction = delegate()
            {
                GenClamor.DoClamor(build.actor, 15f, ClamorDefOf.Construction);
            };
            build.tickAction = delegate()
            {
                Pawn  actor = build.actor;
                Frame frame = this.Frame;
                if (frame.resourceContainer.Count > 0)
                {
                    actor.skills.Learn(SkillDefOf.Construction, 0.25f, false);
                }
                float num = actor.GetStatValue(StatDefOf.ConstructionSpeed, true);
                if (frame.Stuff != null)
                {
                    num *= frame.Stuff.GetStatValueAbstract(StatDefOf.ConstructionSpeedFactor, null);
                }
                float workToBuild = frame.WorkToBuild;
                if (actor.Faction == Faction.OfPlayer)
                {
                    float statValue = actor.GetStatValue(StatDefOf.ConstructSuccessChance, true);
                    if (Rand.Value < 1f - Mathf.Pow(statValue, num / workToBuild))
                    {
                        frame.FailConstruction(actor);
                        this.ReadyForNextToil();
                        return;
                    }
                }
                if (frame.def.entityDefToBuild is TerrainDef)
                {
                    this.Map.snowGrid.SetDepth(frame.Position, 0f);
                }
                frame.workDone += num;
                if (frame.workDone >= workToBuild)
                {
                    frame.CompleteConstruction(actor);
                    this.ReadyForNextToil();
                    return;
                }
            };
            build.WithEffect(() => ((Frame)build.actor.jobs.curJob.GetTarget(TargetIndex.A).Thing).ConstructionEffect, TargetIndex.A);
            build.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            build.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            build.FailOn(() => !GenConstruct.CanConstruct(this.Frame, this.pawn, true, false));
            build.defaultCompleteMode = ToilCompleteMode.Delay;
            build.defaultDuration     = 5000;
            build.activeSkill         = (() => SkillDefOf.Construction);
            yield return(build);

            yield break;
        }
示例#11
0
 /*
  *      protected override void SpawnThings()
  *      {
  *
  *              if (this.Contents.spawnWipeMode == null)
  *              {
  *                      base.SpawnThings();
  *                      return;
  *              }
  *              for (int i = this.innerContainer.Count - 1; i >= 0; i--)
  *              {
  *                      GenSpawn.Spawn(this.innerContainer[i], base.Position, base.Map, this.Contents.spawnWipeMode.Value);
  *              }
  *
  *      }
  */
 // Token: 0x06007932 RID: 31026 RVA: 0x00239D78 File Offset: 0x00237F78
 public override void Impact()
 {
     for (int i = 0; i < 6; i++)
     {
         AdeptusMoteMaker.ThrowDustPuff(base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f), base.Map, 1.2f);
     }
     AdeptusMoteMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), base.Map, 2f);
     GenClamor.DoClamor(this, 15f, ClamorDefOf.Impact);
     base.Impact();
 }
示例#12
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

            GenClamor.DoClamor(this, 5.1f, ClamorDefOf.Impact);
            if (initialized)
            {
                Destroy();
            }

            if (!initialized)
            {
                this.initialized = true;
                SpawnThings spawnThing = new SpawnThings();
                pawn = this.launcher as Pawn;
                MagicPowerSkill        pwr         = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_SummonPoppi.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_SummonPoppi_pwr");
                MagicPowerSkill        ver         = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_SummonPoppi.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_SummonPoppi_ver");
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                pwrVal         = pwr.level;
                verVal         = ver.level;
                this.arcaneDmg = pawn.GetComp <CompAbilityUserMagic>().arcaneDmg;
                if (settingsRef.AIHardMode && !pawn.IsColonist)
                {
                    pwrVal = 1;
                    verVal = 1;
                }
                CellRect cellRect = CellRect.CenteredOn(this.Position, 4);
                cellRect.ClipInsideMap(map);

                IntVec3       centerCell = cellRect.CenterCell;
                System.Random random     = new System.Random();
                random = new System.Random();

                for (int i = 0; i < 4 + pwrVal; i++)
                {
                    centerCell = cellRect.RandomCell;
                    if (centerCell.IsValid && centerCell.InBounds(pawn.Map) && centerCell.Standable(pawn.Map) && !centerCell.Fogged(pawn.Map))
                    {
                        spawnThing.factionDef = TorannMagicDefOf.TM_ElementalFaction;
                        spawnThing.spawnCount = 1;
                        spawnThing.temporary  = false;

                        spawnThing.def     = TorannMagicDefOf.TM_Poppi;
                        spawnThing.kindDef = PawnKindDef.Named("TM_Poppi");

                        MoteMaker.ThrowSmoke(centerCell.ToVector3(), map, 1 + pwrVal);
                        SingleSpawnLoop(spawnThing, centerCell, map);
                    }
                    else
                    {
                        i--;
                    }
                }
            }
        }
 protected override void Impact()
 {
     for (int i = 0; i < 6; i++)
     {
         MoteMaker.ThrowDustPuff(base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f), base.Map, 1.2f);
     }
     MoteMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), base.Map, 2f);
     GenClamor.DoClamor(this, 15f, ClamorDefOf.Impact);
     ModOptions.Constants.SetPawnInFlight(false);
     base.Impact();
 }
示例#14
0
        public void CreateLightBurst(IntVec3 center, Map map, float radius)
        {
            GenClamor.DoClamor(this.CasterPawn, 2 * radius, ClamorDefOf.Ability);
            Effecter flashED = TorannMagicDefOf.TM_LightBurstED.Spawn();

            flashED.Trigger(new TargetInfo(center, map, false), new TargetInfo(center, map, false));
            flashED.Cleanup();
            TargetInfo ti = new TargetInfo(center, map, false);

            TM_MoteMaker.MakeOverlay(ti, TorannMagicDefOf.TM_Mote_PsycastAreaEffect, map, Vector3.zero, .1f, 0f, .05f, .1f, .1f, 4.3f);
        }
示例#15
0
        protected override void Impact(Thing hitThing)
        {
            var map      = base.Map;
            var position = base.Position;

            GenClamor.DoClamor(this, 2.1f, ClamorDefOf.Impact);
            FleckMaker.Static(position, Map, DefDatabase <FleckDef> .GetNamed("BlastFlame"), 2);
            SoundDef.Named("Explosion_Bomb").PlayOneShot(new TargetInfo(base.Position, base.Map, false));

            this.Destroy(DestroyMode.Vanish);
            var battleLogEntry_RangedImpact = new BattleLogEntry_RangedImpact(this.launcher, hitThing, this.intendedTarget.Thing, this.equipmentDef, this.def, this.targetCoverDef);

            Find.BattleLog.Add(battleLogEntry_RangedImpact);
            this.NotifyImpact(hitThing, map, position);
            if (hitThing != null)
            {
                var dinfo = new DamageInfo(this.def.projectile.damageDef, (float)base.DamageAmount, base.ArmorPenetration, this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                var pawn  = hitThing as Pawn;
                if (pawn != null)
                {
                    var mult = pawn.BodySize <= 1 ? 1 : pawn.BodySize * 2.5f;
                    dinfo.SetAmount(dinfo.Amount * mult);
                }
                hitThing.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_RangedImpact);
                if (pawn != null && pawn.stances != null && pawn.BodySize <= this.def.projectile.StoppingPower + 0.001f)
                {
                    pawn.stances.StaggerFor(95);
                }
                if (this.def.projectile.extraDamages == null)
                {
                    return;
                }
                using (List <ExtraDamage> .Enumerator enumerator = this.def.projectile.extraDamages.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ExtraDamage extraDamage = enumerator.Current;
                        if (Rand.Chance(extraDamage.chance))
                        {
                            var dinfo2 = new DamageInfo(extraDamage.def, extraDamage.amount, extraDamage.AdjustedArmorPenetration(), this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                            hitThing.TakeDamage(dinfo2).AssociateWithLog(battleLogEntry_RangedImpact);
                        }
                    }
                    return;
                }
            }
            SoundDefOf.BulletImpact_Ground.PlayOneShot(new TargetInfo(base.Position, map, false));
            if (base.Position.GetTerrain(map).takeSplashes)
            {
                FleckMaker.WaterSplash(this.ExactPosition, map, Mathf.Sqrt((float)base.DamageAmount) * 1f, 4f);
                return;
            }
            FleckMaker.Static(this.ExactPosition, map, FleckDefOf.ShotHit_Dirt, 1f);
        }
示例#16
0
        // Token: 0x06000006 RID: 6 RVA: 0x0000208C File Offset: 0x0000028C
        public override void Impact(Thing hitThing)
        {
            Faction  faction = this.launcher.Faction;
            ThingDef raceDef = this.def.projectile.postExplosionSpawnThingDef;
            Pawn     pawn    = GenSpawn.Spawn(PawnGenerator.GeneratePawn(SporeMine.mineDef, faction), base.Position, base.Map, WipeMode.Vanish) as Pawn;

            pawn.def = raceDef;
            pawn.health.AddHediff(HediffDefOf.Scaria, null, null, null);
            pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent, null, false, false, null, false);
            GenClamor.DoClamor(this, 2.1f, ClamorDefOf.Impact);
            this.Destroy(DestroyMode.Vanish);
        }
示例#17
0
        protected override void Impact()
        {
            for (int i = 0; i < 6; i++)
            {
                Vector3 loc = Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f);
                FleckMaker.ThrowDustPuff(loc, base.Map, 1.2f);
            }

            FleckMaker.ThrowLightningGlow(Position.ToVector3Shifted(), Map, 2f);
            GenClamor.DoClamor(this, 15f, ClamorDefOf.Impact);
            base.Impact();
        }
        public bool TryTeleport(LocalTargetInfo target, LocalTargetInfo dest)
        {
            bool result = false;

            if (target.HasThing)
            {
                base.Apply(target, dest);
                LocalTargetInfo destination = base.GetDestination(dest.IsValid ? dest : target);
                if (destination.IsValid)
                {
                    Pawn pawn = this.parent.pawn;
                    if (!this.parent.def.HasAreaOfEffect)
                    {
                        this.parent.AddEffecterToMaintain(EffecterDefOf.Skip_Entry.Spawn(target.Thing, pawn.Map, 1f), target.Thing.Position, 60);
                    }
                    else
                    {
                        this.parent.AddEffecterToMaintain(EffecterDefOf.Skip_EntryNoDelay.Spawn(target.Thing, pawn.Map, 1f), target.Thing.Position, 60);
                    }
                    if (this.Props.destination == AbilityEffectDestination.Selected)
                    {
                        this.parent.AddEffecterToMaintain(EffecterDefOf.Skip_Exit.Spawn(destination.Cell, pawn.Map, 1f), destination.Cell, 60);
                    }
                    else
                    {
                        this.parent.AddEffecterToMaintain(EffecterDefOf.Skip_ExitNoDelay.Spawn(destination.Cell, pawn.Map, 1f), destination.Cell, 60);
                    }
                    CompCanBeDormant compCanBeDormant = target.Thing.TryGetComp <CompCanBeDormant>();
                    if (compCanBeDormant != null)
                    {
                        compCanBeDormant.WakeUp();
                    }
                    target.Thing.Position = destination.Cell;
                    Pawn pawn2 = target.Thing as Pawn;
                    if (pawn2 != null)
                    {
                        pawn2.stances.stunner.StunFor_NewTmp(this.Props.stunTicks.RandomInRange, this.parent.pawn, false, false);
                        pawn2.Notify_Teleported(true, true);
                    }
                    if (this.Props.destClamorType != null)
                    {
                        GenClamor.DoClamor(pawn, target.Cell, (float)this.Props.destClamorRadius, this.Props.destClamorType);
                    }
                }
            }
            return(result);
        }
示例#19
0
 private void Initialize(Pawn p)
 {
     if (!p.DestroyedOrNull())
     {
         GenClamor.DoClamor(this, 2f, ClamorDefOf.Ability);
         CompAbilityUserMagic comp = p.TryGetComp <CompAbilityUserMagic>();
         if (comp != null && comp.MagicData != null)
         {
             pwrVal         = TM_Calc.GetMagicSkillLevel(p, comp.MagicData.MagicPowerSkill_ChainLightning, "TM_ChainLightning", "_pwr", true);
             verVal         = TM_Calc.GetMagicSkillLevel(p, comp.MagicData.MagicPowerSkill_ChainLightning, "TM_ChainLightning", "_ver", true);
             this.arcaneDmg = comp.arcaneDmg;
         }
         maxStrikes   += verVal;
         newStrikeLocs = new List <IntVec3>();
         strikeLocs    = new List <IntVec3>();
         strikeMeshes  = new List <Mesh>();
         chainedThings = new HashSet <Thing>();
     }
 }
        public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
        {
            if (!target.HasThing)
            {
                return;
            }
            base.Apply(target, dest);
            LocalTargetInfo destination = GetDestination(dest.IsValid ? dest : target);

            if (destination.IsValid)
            {
                Pawn pawn = parent.pawn;
                if (!parent.def.HasAreaOfEffect)
                {
                    parent.AddEffecterToMaintain(EffecterDefOf.Skip_Entry.Spawn(target.Thing, pawn.Map), target.Thing.Position, 60);
                }
                else
                {
                    parent.AddEffecterToMaintain(EffecterDefOf.Skip_EntryNoDelay.Spawn(target.Thing, pawn.Map), target.Thing.Position, 60);
                }
                if (Props.destination == AbilityEffectDestination.Selected)
                {
                    parent.AddEffecterToMaintain(EffecterDefOf.Skip_Exit.Spawn(destination.Cell, pawn.Map), destination.Cell, 60);
                }
                else
                {
                    parent.AddEffecterToMaintain(EffecterDefOf.Skip_ExitNoDelay.Spawn(destination.Cell, pawn.Map), destination.Cell, 60);
                }
                target.Thing.TryGetComp <CompCanBeDormant>()?.WakeUp();
                target.Thing.Position = destination.Cell;
                Pawn pawn2 = target.Thing as Pawn;
                if (pawn2 != null)
                {
                    pawn2.stances.stunner.StunFor_NewTmp(Props.stunTicks.RandomInRange, parent.pawn, addBattleLog: false, showMote: false);
                    pawn2.Notify_Teleported();
                }
                if (Props.destClamorType != null)
                {
                    GenClamor.DoClamor(pawn, target.Cell, Props.destClamorRadius, Props.destClamorType);
                }
            }
        }
示例#21
0
        protected override bool TryCastShot()
        {
            Pawn p   = this.CasterPawn;
            Map  map = this.CasterPawn.Map;
            CompAbilityUserMagic comp = this.CasterPawn.GetComp <CompAbilityUserMagic>();

            pawns.Clear();
            plants.Clear();
            GenClamor.DoClamor(p, this.UseAbilityProps.TargetAoEProperties.range, ClamorDefOf.Ability);
            Effecter snapeFreezeED = TorannMagicDefOf.TM_SnapFreezeED.Spawn();

            snapeFreezeED.Trigger(new TargetInfo(this.currentTarget.Cell, map, false), new TargetInfo(this.currentTarget.Cell, map, false));
            snapeFreezeED.Cleanup();
            SoundInfo info = SoundInfo.InMap(new TargetInfo(this.currentTarget.Cell, map, false), MaintenanceType.None);

            info.pitchFactor  = .4f;
            info.volumeFactor = 1.2f;
            TorannMagicDefOf.TM_WindLowSD.PlayOneShot(info);
            TargetInfo ti = new TargetInfo(this.currentTarget.Cell, map, false);

            TM_MoteMaker.MakeOverlay(ti, TorannMagicDefOf.TM_Mote_PsycastAreaEffect, map, Vector3.zero, 3f, 0f, .1f, .4f, 1.2f, -3f);
            float classBonus = 1f;

            if (p.story != null && p.story.traits != null && p.story.traits.HasTrait(TorannMagicDefOf.HeartOfFrost))
            {
                classBonus = 1.5f;
            }
            if (this.currentTarget != null && p != null && comp != null)
            {
                this.arcaneDmg = comp.arcaneDmg;
                this.TargetsAoE.Clear();
                this.FindTargets();
                float energy = -125000 * this.arcaneDmg * classBonus;
                GenTemperature.PushHeat(this.currentTarget.Cell, p.Map, energy);
                for (int i = 0; i < pawns.Count; i++)
                {
                    if (!pawns[i].RaceProps.IsMechanoid && pawns[i].RaceProps.body.AllPartsVulnerableToFrostbite.Count > 0)
                    {
                        float distanceModifier = 1f / (pawns[i].Position - currentTarget.Cell).LengthHorizontal;
                        if (distanceModifier > 1f)
                        {
                            distanceModifier = 1f;
                        }
                        int bites = Mathf.RoundToInt(Rand.Range(1f, 5f) * classBonus);
                        for (int j = 0; j < bites; j++)
                        {
                            if (Rand.Chance(TM_Calc.GetSpellSuccessChance(this.CasterPawn, pawns[i], true)) && Rand.Chance(distanceModifier))
                            {
                                TM_Action.DamageEntities(pawns[i], pawns[i].def.race.body.AllPartsVulnerableToFrostbite.RandomElement(), Rand.Range(10, 20) * distanceModifier, 1f, DamageDefOf.Frostbite, p);
                            }
                            if (Rand.Chance(TM_Calc.GetSpellSuccessChance(this.CasterPawn, pawns[i], true)) && Rand.Chance(distanceModifier))
                            {
                                HealthUtility.AdjustSeverity(pawns[i], HediffDefOf.Hypothermia, distanceModifier / 5f);
                            }
                        }
                    }
                }
                for (int i = 0; i < plants.Count; i++)
                {
                    float distanceModifier = 1f / (plants[i].Position - currentTarget.Cell).LengthHorizontal;
                    if (distanceModifier > 1f)
                    {
                        distanceModifier = 1f;
                    }
                    if (plants[i].def.plant.IsTree)
                    {
                        if (Rand.Chance(distanceModifier / 2f))
                        {
                            plants[i].MakeLeafless(Plant.LeaflessCause.Cold);
                        }
                    }
                    else
                    {
                        if (Rand.Chance(distanceModifier))
                        {
                            plants[i].MakeLeafless(Plant.LeaflessCause.Cold);
                        }
                    }
                    plants[i].Notify_ColorChanged();
                }
                List <IntVec3> cellList = GenRadial.RadialCellsAround(this.currentTarget.Cell, this.UseAbilityProps.TargetAoEProperties.range, true).ToList();
                bool           raining  = map.weatherManager.RainRate > 0f || map.weatherManager.SnowRate > 0f;
                for (int i = 0; i < cellList.Count; i++)
                {
                    cellList[i] = cellList[i].ClampInsideMap(map);
                    SnowUtility.AddSnowRadial(cellList[i], map, 2.4f, Rand.Range(.08f, .13f));
                    TM_FleckMaker.ThrowGenericFleck(FleckDefOf.AirPuff, cellList[i].ToVector3Shifted(), map, 2.5f, .05f, .05f, Rand.Range(2f, 3f), Rand.Range(-60, 60), .5f, -70, Rand.Range(0, 360));
                }
                List <IntVec3> windList = GenRadial.RadialCellsAround(this.currentTarget.Cell, this.UseAbilityProps.TargetAoEProperties.range + 1, true).Except(cellList).ToList();
                for (int i = 0; i < windList.Count; i++)
                {
                    windList[i] = windList[i].ClampInsideMap(map);
                    Vector3 angle = TM_Calc.GetVector(windList[i], this.currentTarget.Cell);
                    TM_FleckMaker.ThrowGenericFleck(FleckDefOf.AirPuff, windList[i].ToVector3Shifted(), map, Rand.Range(1.2f, 2f), .45f, Rand.Range(0f, .25f), .5f, -200, Rand.Range(3, 5), (Quaternion.AngleAxis(90, Vector3.up) * angle).ToAngleFlat(), Rand.Range(0, 360));
                }
            }

            this.burstShotsLeft = 0;
            return(true);
        }
示例#22
0
        protected override void Impact(Thing hitThing)
        {
            this.hitThing = hitThing;
            bool shielded = hitThing.IsShielded() && def.IsWeakToShields;

            LaserGunDef defWeapon = equipmentDef as LaserGunDef;
            Vector3     dir       = (destination - origin).normalized;

            dir.y = 0;

            Vector3 a = origin + dir * (defWeapon == null ? 0.9f : defWeapon.barrelLength);
            Vector3 b;

            if (hitThing == null)
            {
                b = destination;
            }
            else if (shielded)
            {
                b = hitThing.TrueCenter() - dir.RotatedBy(Rand.Range(-22.5f, 22.5f)) * 0.8f;
            }
            else if ((destination - hitThing.TrueCenter()).magnitude < 1)
            {
                b = destination;
            }
            else
            {
                b    = hitThing.TrueCenter();
                b.x += Rand.Range(-0.5f, 0.5f);
                b.z += Rand.Range(-0.5f, 0.5f);
            }

            a.y = b.y = def.Altitude;

            //    SpawnBeam(a, b);

            if (this.def.projectile.explosionRadius > 0f)
            {
                this.Explode(hitThing, false);
                GenExplosion.NotifyNearbyPawnsOfDangerousExplosive(this, this.def.projectile.damageDef, this.launcher.Faction);
            }

            Pawn pawn = launcher as Pawn;
            IDrawnWeaponWithRotation weapon = null;

            if (pawn != null && pawn.equipment != null)
            {
                weapon = pawn.equipment.Primary as IDrawnWeaponWithRotation;
            }
            if (weapon == null)
            {
                Building_LaserGun turret = launcher as Building_LaserGun;
                if (turret != null)
                {
                    weapon = turret.gun as IDrawnWeaponWithRotation;
                }
            }
            if (weapon != null)
            {
                float angle = (b - a).AngleFlat() - (intendedTarget.CenterVector3 - a).AngleFlat();
                weapon.RotationOffset = (angle + 180) % 360 - 180;
            }

            if (hitThing == null)
            {
                Rand.PushState();
                bool flag2 = this.def.causefireChance > 0f && Rand.Chance(this.def.causefireChance);
                Rand.PopState();
                if (flag2)
                {
                    FireUtility.TryStartFireIn(b.ToIntVec3(), pawn.Map, 0.01f);
                }
            }
            else
            {
                if (hitThing is Pawn && shielded)
                {
                    weaponDamageMultiplier *= def.shieldDamageMultiplier;

                    SpawnBeamReflections(a, b, 5);
                }

                Rand.PushState();
                bool flag2 = this.def.causefireChance > 0f && Rand.Chance(this.def.causefireChance);
                Rand.PopState();
                if (flag2)
                {
                    hitThing.TryAttachFire(0.01f);
                }
                AddeEffects(hitThing);
            }
            //    TriggerEffect(def.explosionEffect, b, hitThing);
            Map     map      = base.Map;
            IntVec3 position = base.Position;

            GenClamor.DoClamor(this, 2.1f, ClamorDefOf.Impact);
            this.Destroy(DestroyMode.Vanish);
            BattleLogEntry_RangedImpact battleLogEntry_RangedImpact = new BattleLogEntry_RangedImpact(this.launcher, hitThing, this.intendedTarget.Thing, this.equipmentDef, this.def, this.targetCoverDef);

            Find.BattleLog.Add(battleLogEntry_RangedImpact);
            this.NotifyImpact(hitThing, map, position);
            if (hitThing != null)
            {
                DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, (float)this.DamageAmount, this.ArmorPenetration, this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                hitThing.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_RangedImpact);
                if (pawn != null && pawn.stances != null && pawn.BodySize <= this.def.projectile.StoppingPower + 0.001f)
                {
                    pawn.stances.StaggerFor(95);
                }
                if (this.def.projectile.extraDamages == null)
                {
                    return;
                }
                using (List <ExtraDamage> .Enumerator enumerator = this.def.projectile.extraDamages.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ExtraDamage extraDamage = enumerator.Current;
                        if (Rand.Chance(extraDamage.chance))
                        {
                            DamageInfo dinfo2 = new DamageInfo(extraDamage.def, extraDamage.amount, extraDamage.AdjustedArmorPenetration(), this.ExactRotation.eulerAngles.y, this.launcher, null, this.equipmentDef, DamageInfo.SourceCategory.ThingOrUnknown, this.intendedTarget.Thing);
                            hitThing.TakeDamage(dinfo2).AssociateWithLog(battleLogEntry_RangedImpact);
                        }
                    }
                    return;
                }
            }
            SoundDefOf.BulletImpact_Ground.PlayOneShot(new TargetInfo(base.Position, map, false));
            if (base.Position.GetTerrain(map).takeSplashes)
            {
                MoteMaker.MakeWaterSplash(this.ExactPosition, map, Mathf.Sqrt((float)base.DamageAmount) * 1f, 4f);
                return;
            }
            //    MoteMaker.MakeStaticMote(this.ExactPosition, map, ThingDefOf.Mote_ShotHit_Dirt, 1f);
        }
示例#23
0
        private void TryEnterNextPathCell()
        {
            Building building = this.BuildingBlockingNextPathCell();

            if (building != null)
            {
                Building_Door building_Door = building as Building_Door;
                if (building_Door == null || !building_Door.FreePassage)
                {
                    if ((this.pawn.CurJob != null && this.pawn.CurJob.canBash) || this.pawn.HostileTo(building))
                    {
                        Job job = new Job(JobDefOf.AttackMelee, building);
                        job.expiryInterval = 300;
                        this.pawn.jobs.StartJob(job, JobCondition.Incompletable, null, false, true, null, null, false);
                        return;
                    }
                    this.PatherFailed();
                    return;
                }
            }
            Building_Door building_Door2 = this.NextCellDoorToManuallyOpen();

            if (building_Door2 != null)
            {
                Stance_Cooldown stance_Cooldown = new Stance_Cooldown(building_Door2.TicksToOpenNow, building_Door2, null);
                stance_Cooldown.neverAimWeapon = true;
                this.pawn.stances.SetStance(stance_Cooldown);
                building_Door2.StartManualOpenBy(this.pawn);
                building_Door2.CheckFriendlyTouched(this.pawn);
                return;
            }
            this.lastCell      = this.pawn.Position;
            this.pawn.Position = this.nextCell;
            if (this.pawn.RaceProps.Humanlike)
            {
                this.cellsUntilClamor--;
                if (this.cellsUntilClamor <= 0)
                {
                    GenClamor.DoClamor(this.pawn, 7f, ClamorDefOf.Movement);
                    this.cellsUntilClamor = 12;
                }
            }
            this.pawn.filth.Notify_EnteredNewCell();
            if (this.pawn.BodySize > 0.9f)
            {
                this.pawn.Map.snowGrid.AddDepth(this.pawn.Position, -0.001f);
            }
            Building_Door building_Door3 = this.pawn.Map.thingGrid.ThingAt <Building_Door>(this.lastCell);

            if (building_Door3 != null && !this.pawn.HostileTo(building_Door3))
            {
                building_Door3.CheckFriendlyTouched(this.pawn);
                if (!building_Door3.BlockedOpenMomentary && !building_Door3.HoldOpen && building_Door3.SlowsPawns && building_Door3.PawnCanOpen(this.pawn))
                {
                    building_Door3.StartManualCloseBy(this.pawn);
                    return;
                }
            }
            if (this.NeedNewPath() && !this.TrySetNewPath())
            {
                return;
            }
            if (this.AtDestinationPosition())
            {
                this.PatherArrived();
            }
            else
            {
                this.SetupMoveIntoNextCell();
            }
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedOrNull(TargetIndex.B);
            this.FailOnAggroMentalStateAndHostile(TargetIndex.A);
            this.FailOn(delegate()
            {
                if (this.job.def.makeTargetPrisoner)
                {
                    if (!this.DropBed.ForPrisoners)
                    {
                        return(true);
                    }
                }
                else if (this.DropBed.ForPrisoners != this.Takee.IsPrisoner)
                {
                    return(true);
                }
                return(false);
            });
            yield return(Toils_Bed.ClaimBedIfNonMedical(TargetIndex.B, TargetIndex.A));

            base.AddFinishAction(delegate
            {
                if (this.job.def.makeTargetPrisoner && this.Takee.ownership.OwnedBed == this.DropBed && this.Takee.Position != RestUtility.GetBedSleepingSlotPosFor(this.Takee, this.DropBed))
                {
                    this.Takee.ownership.UnclaimBed();
                }
            });
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOn(() => this.job.def == JobDefOf.Arrest && !this.Takee.CanBeArrestedBy(this.pawn)).FailOn(() => !this.pawn.CanReach(this.DropBed, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn)).FailOn(() => this.job.def == JobDefOf.Rescue && !this.Takee.Downed).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(new Toil
            {
                initAction = delegate()
                {
                    if (this.job.def.makeTargetPrisoner)
                    {
                        Pawn pawn = (Pawn)this.job.targetA.Thing;
                        Lord lord = pawn.GetLord();
                        if (lord != null)
                        {
                            lord.Notify_PawnAttemptArrested(pawn);
                        }
                        GenClamor.DoClamor(pawn, 10f, ClamorDefOf.Harm);
                        if (this.job.def == JobDefOf.Arrest && !pawn.CheckAcceptArrest(this.pawn))
                        {
                            this.pawn.jobs.EndCurrentJob(JobCondition.Incompletable, true);
                        }
                    }
                }
            });

            Toil startCarrying = Toils_Haul.StartCarryThing(TargetIndex.A, false, false, false).FailOnNonMedicalBedNotOwned(TargetIndex.B, TargetIndex.A);

            startCarrying.AddPreInitAction(new Action(this.CheckMakeTakeeGuest));
            yield return(startCarrying);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch));

            yield return(new Toil
            {
                initAction = delegate()
                {
                    this.CheckMakeTakeePrisoner();
                    if (this.Takee.playerSettings == null)
                    {
                        this.Takee.playerSettings = new Pawn_PlayerSettings(this.Takee);
                    }
                }
            });

            yield return(Toils_Reserve.Release(TargetIndex.B));

            yield return(new Toil
            {
                initAction = delegate()
                {
                    IntVec3 position = this.DropBed.Position;
                    Thing thing;
                    this.pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out thing, null);
                    if (!this.DropBed.Destroyed && (this.DropBed.owners.Contains(this.Takee) || (this.DropBed.Medical && this.DropBed.AnyUnoccupiedSleepingSlot) || this.Takee.ownership == null))
                    {
                        this.Takee.jobs.Notify_TuckedIntoBed(this.DropBed);
                        if (this.Takee.RaceProps.Humanlike && this.job.def != JobDefOf.Arrest && !this.Takee.IsPrisonerOfColony)
                        {
                            this.Takee.relations.Notify_RescuedBy(this.pawn);
                        }
                        this.Takee.mindState.Notify_TuckedIntoBed();
                    }
                    if (this.Takee.IsPrisonerOfColony)
                    {
                        LessonAutoActivator.TeachOpportunity(ConceptDefOf.PrisonerTab, this.Takee, OpportunityType.GoodToKnow);
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.FailOnDestroyedOrNull(TargetIndex.A);
                    this.FailOnDestroyedOrNull(TargetIndex.B);
                    this.FailOnAggroMentalStateAndHostile(TargetIndex.A);
                    this.FailOn(delegate()
                    {
                        if (this.job.def.makeTargetPrisoner)
                        {
                            if (!base.DropBed.ForPrisoners)
                            {
                                return(true);
                            }
                        }
                        else if (base.DropBed.ForPrisoners != base.Takee.IsPrisoner)
                        {
                            return(true);
                        }
                        return(false);
                    });
                    this.$current = Toils_Bed.ClaimBedIfNonMedical(TargetIndex.B, TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    base.AddFinishAction(delegate
                    {
                        if (this.job.def.makeTargetPrisoner && base.Takee.ownership.OwnedBed == base.DropBed && base.Takee.Position != RestUtility.GetBedSleepingSlotPosFor(base.Takee, base.DropBed))
                        {
                            base.Takee.ownership.UnclaimBed();
                        }
                    });
                    this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOn(() => this.job.def == JobDefOf.Arrest && !base.Takee.CanBeArrestedBy(this.pawn)).FailOn(() => !this.pawn.CanReach(base.DropBed, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn)).FailOn(() => this.job.def == JobDefOf.Rescue && !base.Takee.Downed).FailOnSomeonePhysicallyInteracting(TargetIndex.A);
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                {
                    Toil checkArrestResistance = new Toil();
                    checkArrestResistance.initAction = delegate()
                    {
                        if (this.job.def.makeTargetPrisoner)
                        {
                            Pawn pawn = (Pawn)this.job.targetA.Thing;
                            Lord lord = pawn.GetLord();
                            if (lord != null)
                            {
                                lord.Notify_PawnAttemptArrested(pawn);
                            }
                            GenClamor.DoClamor(pawn, 10f, ClamorDefOf.Harm);
                            if (this.job.def == JobDefOf.Arrest && !pawn.CheckAcceptArrest(this.pawn))
                            {
                                this.pawn.jobs.EndCurrentJob(JobCondition.Incompletable, true);
                            }
                        }
                    };
                    this.$current = checkArrestResistance;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);
                }

                case 3u:
                    startCarrying = Toils_Haul.StartCarryThing(TargetIndex.A, false, false, false).FailOnNonMedicalBedNotOwned(TargetIndex.B, TargetIndex.A);
                    startCarrying.AddPreInitAction(new Action(base.CheckMakeTakeeGuest));
                    this.$current = startCarrying;
                    if (!this.$disposing)
                    {
                        this.$PC = 4;
                    }
                    return(true);

                case 4u:
                    this.$current = Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch);
                    if (!this.$disposing)
                    {
                        this.$PC = 5;
                    }
                    return(true);

                case 5u:
                {
                    Toil makePrisonerAndInit = new Toil();
                    makePrisonerAndInit.initAction = delegate()
                    {
                        base.CheckMakeTakeePrisoner();
                        if (base.Takee.playerSettings == null)
                        {
                            base.Takee.playerSettings = new Pawn_PlayerSettings(base.Takee);
                        }
                    };
                    this.$current = makePrisonerAndInit;
                    if (!this.$disposing)
                    {
                        this.$PC = 6;
                    }
                    return(true);
                }

                case 6u:
                    this.$current = Toils_Reserve.Release(TargetIndex.B);
                    if (!this.$disposing)
                    {
                        this.$PC = 7;
                    }
                    return(true);

                case 7u:
                {
                    Toil tuckIntoBed = new Toil();
                    tuckIntoBed.initAction = delegate()
                    {
                        IntVec3 position = base.DropBed.Position;
                        Thing   thing;
                        this.pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out thing, null);
                        if (!base.DropBed.Destroyed && (base.DropBed.owners.Contains(base.Takee) || (base.DropBed.Medical && base.DropBed.AnyUnoccupiedSleepingSlot) || base.Takee.ownership == null))
                        {
                            base.Takee.jobs.Notify_TuckedIntoBed(base.DropBed);
                            if (base.Takee.RaceProps.Humanlike && this.job.def != JobDefOf.Arrest && !base.Takee.IsPrisonerOfColony)
                            {
                                base.Takee.relations.Notify_RescuedBy(this.pawn);
                            }
                            base.Takee.mindState.Notify_TuckedIntoBed();
                        }
                        if (base.Takee.IsPrisonerOfColony)
                        {
                            LessonAutoActivator.TeachOpportunity(ConceptDefOf.PrisonerTab, base.Takee, OpportunityType.GoodToKnow);
                        }
                    };
                    tuckIntoBed.defaultCompleteMode = ToilCompleteMode.Instant;
                    this.$current = tuckIntoBed;
                    if (!this.$disposing)
                    {
                        this.$PC = 8;
                    }
                    return(true);
                }

                case 8u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
 // Token: 0x060052A6 RID: 21158 RVA: 0x0012A2DA File Offset: 0x001286DA
 protected virtual void Impact(Thing hitThing)
 {
     GenClamor.DoClamor(this, 2.1f, ClamorDefOf.Impact);
     this.Destroy(DestroyMode.Vanish);
 }
示例#27
0
        protected override bool TryCastShot()
        {
            Pawn p   = this.CasterPawn;
            Map  map = this.CasterPawn.Map;
            CompAbilityUserMagic comp = this.CasterPawn.GetComp <CompAbilityUserMagic>();

            corpses.Clear();
            pawns.Clear();
            plants.Clear();
            GenClamor.DoClamor(p, this.UseAbilityProps.TargetAoEProperties.range, ClamorDefOf.Ability);
            Effecter igniteED = TorannMagicDefOf.TM_IgniteED.Spawn();

            igniteED.Trigger(new TargetInfo(this.currentTarget.Cell, map, false), new TargetInfo(this.currentTarget.Cell, map, false));
            igniteED.Cleanup();
            SoundInfo info = SoundInfo.InMap(new TargetInfo(this.currentTarget.Cell, map, false), MaintenanceType.None);

            info.pitchFactor  = 1.1f;
            info.volumeFactor = 1.8f;
            TorannMagicDefOf.TM_FireWooshSD.PlayOneShot(info);
            TargetInfo ti = new TargetInfo(this.currentTarget.Cell, map, false);

            TM_MoteMaker.MakeOverlay(ti, TorannMagicDefOf.TM_Mote_PsycastAreaEffect, map, Vector3.zero, .2f, 0f, .1f, .4f, .4f, 4.3f);
            float classBonus = 1f;

            if (p.story != null && p.story.traits != null && p.story.traits.HasTrait(TorannMagicDefOf.InnerFire))
            {
                classBonus = 1.5f;
            }
            if (this.currentTarget != null && p != null && comp != null)
            {
                this.arcaneDmg = comp.arcaneDmg;
                this.TargetsAoE.Clear();
                this.FindTargets();
                float energy = 200000 * this.arcaneDmg * classBonus;
                GenTemperature.PushHeat(this.currentTarget.Cell, p.Map, energy);
                for (int i = 0; i < pawns.Count; i++)
                {
                    if (!pawns[i].RaceProps.IsMechanoid)
                    {
                        float distanceModifier = classBonus / (pawns[i].Position - currentTarget.Cell).LengthHorizontal;
                        if (distanceModifier > 1f)
                        {
                            distanceModifier = 1f;
                        }
                        if (Rand.Chance(TM_Calc.GetSpellSuccessChance(this.CasterPawn, pawns[i], true)) && Rand.Chance(distanceModifier))
                        {
                            pawns[i].TryAttachFire(Rand.Range(distanceModifier / 2f, distanceModifier));
                        }
                    }
                }
                for (int i = 0; i < corpses.Count; i++)
                {
                    //if (corpses[i].CanEverAttachFire())
                    //{
                    float distanceModifier = 1f / (corpses[i].Position - currentTarget.Cell).LengthHorizontal;
                    //    corpses[i].TryAttachFire(Rand.Range(distanceModifier / 2f, distanceModifier));
                    FireUtility.TryStartFireIn(corpses[i].Position, map, Rand.Range(distanceModifier / 2f, distanceModifier));
                    //}
                }
                for (int i = 0; i < plants.Count; i++)
                {
                    float distanceModifier = 1f / (plants[i].Position - currentTarget.Cell).LengthHorizontal;
                    if (distanceModifier > 1f)
                    {
                        distanceModifier = 1f;
                    }
                    if (plants[i].def.plant.IsTree)
                    {
                        if (Rand.Chance(distanceModifier / 2f))
                        {
                            plants[i].TryAttachFire(Rand.Range(distanceModifier / 3f, distanceModifier / 2f));
                            FireUtility.TryStartFireIn(plants[i].Position, map, Rand.Range(distanceModifier / 3f, distanceModifier / 2f));
                        }
                    }
                    else
                    {
                        if (Rand.Chance(distanceModifier))
                        {
                            plants[i].TryAttachFire(Rand.Range(distanceModifier / 2f, distanceModifier));
                            FireUtility.TryStartFireIn(plants[i].Position, map, Rand.Range(distanceModifier / 2f, distanceModifier));
                        }
                    }
                }
                IEnumerable <IntVec3> cellList = GenRadial.RadialCellsAround(this.currentTarget.Cell, this.UseAbilityProps.TargetAoEProperties.range, true);
                bool raining = map.weatherManager.RainRate > 0f || map.weatherManager.SnowRate > 0f;
                foreach (var cell in cellList)
                {
                    cell.ClampInsideMap(map);
                    if (cell.GetSnowDepth(map) > 0f)
                    {
                        map.snowGrid.SetDepth(cell, 0f);
                        MoteMaker.ThrowSmoke(cell.ToVector3Shifted(), map, Rand.Range(.8f, 1.6f));
                        Thing smoke = ThingMaker.MakeThing(ThingDefOf.Gas_Smoke, null);
                        GenSpawn.Spawn(smoke, cell, map, WipeMode.Vanish);
                    }
                    else if (raining || cell.GetTerrain(map).IsWater)
                    {
                        Thing smoke = ThingMaker.MakeThing(ThingDefOf.Gas_Smoke, null);
                        GenSpawn.Spawn(smoke, cell, map, WipeMode.Vanish);
                    }
                    TM_MoteMaker.ThrowGenericMote(ThingDefOf.Mote_AirPuff, cell.ToVector3Shifted(), map, 2.5f, .05f, .05f, Rand.Range(2f, 3f), Rand.Range(-60, 60), .5f, -70, Rand.Range(0, 360));
                }
            }

            this.burstShotsLeft = 0;
            return(true);
        }
示例#28
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedOrNull(TargetIndex.B);
            this.FailOnAggroMentalStateAndHostile(TargetIndex.A);
            this.FailOn(delegate
            {
                if (job.def.makeTargetPrisoner)
                {
                    if (!DropBed.ForPrisoners)
                    {
                        return(true);
                    }
                }
                else if (DropBed.ForPrisoners != Takee.IsPrisoner)
                {
                    return(true);
                }
                return(false);
            });
            yield return(Toils_Bed.ClaimBedIfNonMedical(TargetIndex.B, TargetIndex.A));

            AddFinishAction(delegate
            {
                if (job.def.makeTargetPrisoner && Takee.ownership.OwnedBed == DropBed && Takee.Position != RestUtility.GetBedSleepingSlotPosFor(Takee, DropBed))
                {
                    Takee.ownership.UnclaimBed();
                }
            });
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B)
                         .FailOn(() => job.def == JobDefOf.Arrest && !Takee.CanBeArrestedBy(pawn))
                         .FailOn(() => !pawn.CanReach(DropBed, PathEndMode.OnCell, Danger.Deadly))
                         .FailOn(() => (job.def == JobDefOf.Rescue || job.def == JobDefOf.Capture) && !Takee.Downed)
                         .FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            Toil toil = new Toil();

            toil.initAction = delegate
            {
                if (job.def.makeTargetPrisoner)
                {
                    Pawn pawn = (Pawn)job.targetA.Thing;
                    pawn.GetLord()?.Notify_PawnAttemptArrested(pawn);
                    GenClamor.DoClamor(pawn, 10f, ClamorDefOf.Harm);
                    if (job.def == JobDefOf.Arrest && !pawn.CheckAcceptArrest(base.pawn))
                    {
                        base.pawn.jobs.EndCurrentJob(JobCondition.Incompletable);
                    }
                    if (!pawn.IsPrisoner)
                    {
                        QuestUtility.SendQuestTargetSignals(pawn.questTags, "Arrested", pawn.Named("SUBJECT"));
                    }
                }
            };
            yield return(toil);

            Toil toil2 = Toils_Haul.StartCarryThing(TargetIndex.A).FailOnNonMedicalBedNotOwned(TargetIndex.B, TargetIndex.A);

            toil2.AddPreInitAction(CheckMakeTakeeGuest);
            yield return(toil2);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch));

            Toil toil3 = new Toil();

            toil3.initAction = delegate
            {
                CheckMakeTakeePrisoner();
                if (Takee.playerSettings == null)
                {
                    Takee.playerSettings = new Pawn_PlayerSettings(Takee);
                }
            };
            yield return(toil3);

            yield return(Toils_Reserve.Release(TargetIndex.B));

            Toil toil4 = new Toil();

            toil4.initAction = delegate
            {
                IntVec3 position = DropBed.Position;
                pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out Thing _);
                if (!DropBed.Destroyed && (DropBed.OwnersForReading.Contains(Takee) || (DropBed.Medical && DropBed.AnyUnoccupiedSleepingSlot) || Takee.ownership == null))
                {
                    Takee.jobs.Notify_TuckedIntoBed(DropBed);
                    if (Takee.RaceProps.Humanlike && job.def != JobDefOf.Arrest && !Takee.IsPrisonerOfColony)
                    {
                        Takee.relations.Notify_RescuedBy(pawn);
                    }
                    Takee.mindState.Notify_TuckedIntoBed();
                }
                if (Takee.IsPrisonerOfColony)
                {
                    LessonAutoActivator.TeachOpportunity(ConceptDefOf.PrisonerTab, Takee, OpportunityType.GoodToKnow);
                }
            };
            toil4.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(toil4);
        }
示例#29
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

            GenClamor.DoClamor(this, 2.1f, ClamorDefOf.Impact);
            //base.Impact(hitThing);
            string   msg;
            ThingDef def    = this.def;
            Pawn     victim = hitThing as Pawn;
            Thing    item   = hitThing as Thing;
            IntVec3  arg_pos_1;
            IntVec3  arg_pos_2;
            IntVec3  arg_pos_3;

            Pawn pawn = this.launcher as Pawn;
            CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();
            MagicPowerSkill      pwr  = comp.MagicData.MagicPowerSkill_Teleport.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Teleport_pwr");
            MagicPowerSkill      ver  = comp.MagicData.MagicPowerSkill_Teleport.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Teleport_ver");

            pwrVal = pwr.level;
            verVal = ver.level;
            CellRect cellRect = CellRect.CenteredOn(base.Position, 1);

            cellRect.ClipInsideMap(map);
            IntVec3 centerCell = cellRect.CenterCell;

            if (pawn.story.traits.HasTrait(TorannMagicDefOf.TM_Wanderer) || (comp.customClass != null && comp.customClass.classMageAbilities.Contains(TorannMagicDefOf.TM_Cantrips)))
            {
                int tmpPwrVal = (int)((pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Cantrips.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Cantrips_pwr").level) / 5);
                int tmpVerVal = (int)((pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Cantrips.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Cantrips_ver").level) / 5);
                pwrVal = (tmpPwrVal > pwrVal) ? tmpPwrVal : pwrVal;
                verVal = (tmpVerVal > verVal) ? tmpVerVal : verVal;
            }
            if (this.primed != false)
            {
                destructTimer = Mathf.RoundToInt((4800 + (pwrVal * 1200) + (pwrVal * 1200)) * comp.arcaneDmg);
                arg_pos_1     = centerCell;
                centerCell.x++;
                arg_pos_2 = centerCell;
                centerCell.z++;
                arg_pos_3  = centerCell;
                centerCell = cellRect.CenterCell;

                if ((arg_pos_1.IsValid && arg_pos_1.Standable(map)) && (arg_pos_2.IsValid && arg_pos_2.Standable(map)) && (arg_pos_3.IsValid && arg_pos_3.Standable(map)))
                {
                    AbilityUser.SpawnThings tempPod = new SpawnThings();
                    IntVec3 shiftPos = centerCell;
                    centerCell.x++;

                    if (pwrVal == 1)
                    {
                        tempPod.def = ThingDef.Named("TM_Teleporter_I");
                    }
                    else if (pwrVal == 2)
                    {
                        tempPod.def = ThingDef.Named("TM_Teleporter_II");
                    }
                    else if (pwrVal == 3)
                    {
                        tempPod.def = ThingDef.Named("TM_Teleporter_III");
                    }
                    else
                    {
                        tempPod.def = ThingDef.Named("TM_Teleporter");
                    }
                    tempPod.spawnCount = 1;
                    try
                    {
                        this.SingleSpawnLoop(tempPod, shiftPos, map);
                        Building teleporter = shiftPos.GetFirstBuilding(map);
                        int      num        = teleporter.TryGetComp <CompRefuelable>().GetFuelCountToFullyRefuel();
                        teleporter.TryGetComp <CompRefuelable>().Refuel(num);
                    }
                    catch
                    {
                        Log.Message("Attempted to create a portal but threw an unknown exception - recovering and ending attempt");
                        PortalCollapse(shiftPos, map, 3);
                        if (pawn != null)
                        {
                            comp.Mana.CurLevel += comp.ActualManaCost(TorannMagicDefOf.TM_Teleport);
                        }
                        this.age = this.destructTimer;
                        return;
                    }


                    if (verVal == 1)
                    {
                        tempPod.def = ThingDef.Named("TM_TeleportPod_I");
                    }
                    else if (verVal == 2)
                    {
                        tempPod.def = ThingDef.Named("TM_TeleportPod_II");
                    }
                    else if (verVal == 3)
                    {
                        tempPod.def = ThingDef.Named("TM_TeleportPod_III");
                    }
                    else
                    {
                        tempPod.def = ThingDef.Named("TM_TeleportPod");
                    }
                    tempPod.spawnCount = 1;
                    shiftPos           = centerCell;
                    centerCell.z++;
                    try
                    {
                        this.SingleSpawnLoop(tempPod, shiftPos, map);
                    }
                    catch
                    {
                        Log.Message("Attempted to create a portal but threw an unknown exception - recovering and ending attempt");
                        PortalCollapse(shiftPos, map, 3);
                        if (pawn != null)
                        {
                            comp.Mana.CurLevel += comp.ActualManaCost(TorannMagicDefOf.TM_Teleport);
                        }
                        this.age = this.destructTimer;
                        return;
                    }

                    //tempPod.def = ThingDef.Named("Portfuel");
                    //tempPod.spawnCount = 45 + (pwr.level * 15);
                    //tempPod.factionDef = null;
                    //shiftPos = centerCell;

                    //for (int i = 0; i < tempPod.spawnCount; i++)
                    //{
                    //    try
                    //    {
                    //        this.SingleSpawnLoop(tempPod, shiftPos, map);
                    //    }
                    //    catch
                    //    {
                    //        Log.Message("Attempted to create a portal but threw an unknown exception - recovering and ending attempt");
                    //        PortalCollapse(shiftPos, map, 3);
                    //        if (pawn != null)
                    //        {
                    //            comp.Mana.CurLevel += comp.ActualManaCost(TorannMagicDefOf.TM_Teleport);
                    //        }
                    //        this.age = this.destructTimer;
                    //        i = tempPod.spawnCount;
                    //        return;
                    //    }
                    //}

                    msg = "PortalCollapseIn".Translate(((destructTimer - this.age) / 60).ToString()
                                                       );
                    Messages.Message(msg, MessageTypeDefOf.NeutralEvent);
                    this.primed = false;
                }
                else
                {
                    Messages.Message("InvalidPortal".Translate(), MessageTypeDefOf.RejectInput);
                    comp.Mana.GainNeed(comp.ActualManaCost(TorannMagicDefOf.TM_Teleport));
                    this.destructTimer = 0;
                }
            }
            //foreach (SpawnThings current in this.localSpawnThings)
            //{

            //    string msg = "spawned thing is " + current.def;
            //    Messages.Message(msg, MessageSound.Standard);

            //}

            if (this.age < this.destructTimer)
            {
                if (this.age == (destructTimer * 0.5))
                {
                    msg = "PortalCollapseIn".Translate(
                        ((destructTimer - this.age) / 60).ToString()
                        );
                    Messages.Message(msg, MessageTypeDefOf.NeutralEvent);
                }
                if (this.age == (destructTimer * 0.75))
                {
                    msg = "PortalCollapseIn".Translate(
                        ((destructTimer - this.age) / 60).ToString()
                        );
                    Messages.Message(msg, MessageTypeDefOf.NeutralEvent);
                }
                if (this.age == (destructTimer * 0.95))
                {
                    //msg = "Portal collapses in " + ((destructTimer - this.age) / 60) + " seconds!!";
                    //Messages.Message(msg, MessageTypeDefOf.ThreatBig);
                    msg = "PortalCollapseIn".Translate(
                        ((destructTimer - this.age) / 60).ToString()
                        );
                    Messages.Message(msg, MessageTypeDefOf.NeutralEvent);
                }
            }
            else
            {
                //age expired, destroy teleport
                this.PortalCollapse(centerCell, map, 3);
            }
            Destroy();
        }
示例#30
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            base.AddEndCondition(delegate
            {
                Thing thing = this.GetActor().jobs.curJob.GetTarget(TargetIndex.A).Thing;
                if (thing is Building && !thing.Spawned)
                {
                    return(JobCondition.Incompletable);
                }
                return(JobCondition.Ongoing);
            });
            this.FailOnBurningImmobile(TargetIndex.A);
            //       this.FailOn(delegate
            //       {
            //           IBillGiver billGiver = this.job.GetTarget(TargetIndex.A).Thing as IBillGiver;
            //           if (billGiver != null)
            //           {
            //               if (this.job.bill.DeletedOrDereferenced)
            //{
            //	return true;
            //}
            //if (!billGiver.CurrentlyUsableForBills())
            //{
            //	return true;
            //}
            //           }
            //           return false;
            //       });
            Toil gotoBillGiver = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell);

            yield return(Toils_Jump.JumpIf(gotoBillGiver, () => this.job.GetTargetQueue(TargetIndex.B).NullOrEmpty <LocalTargetInfo>()));

            Toil extract = Toils_JobTransforms.ExtractNextTargetFromQueue(TargetIndex.B, true);

            yield return(extract);

            Toil getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B);

            yield return(getToHaulTarget);

            yield return(new Toil()
            {
                initAction = delegate
                {
                    if (PawnRelic != null)
                    {
                        if (this.job.def.makeTargetPrisoner)
                        {
                            Lord lord = PawnRelic.GetLord();
                            if (lord != null)
                            {
                                lord.Notify_PawnAttemptArrested(PawnRelic);
                            }
                            GenClamor.DoClamor(PawnRelic, 10f, ClamorDefOf.Harm);
                            if (!PawnRelic.CheckAcceptArrest(this.pawn))
                            {
                                this.pawn.jobs.EndCurrentJob(JobCondition.Incompletable, true);
                            }
                        }
                    }
                }
            });

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

            yield return(JumpToCollectNextIntoHandsForBill(getToHaulTarget, TargetIndex.B));

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnDestroyedOrNull(TargetIndex.B));

            Toil findPlaceTarget = Toils_JobTransforms.SetTargetToIngredientPlaceCell(TargetIndex.A, TargetIndex.B, TargetIndex.C);

            yield return(findPlaceTarget);

            yield return(PlaceHauledThingInCell(TargetIndex.C, findPlaceTarget, false));

            yield return(new Toil
            {
                initAction = delegate
                {
                    if (PawnRelic != null)
                    {
                        IntVec3 position = this.job.GetTarget(TargetIndex.B).Cell;
                        this.pawn.Notify_Teleported(false, true);
                        this.pawn.stances.CancelBusyStanceHard();
                        PawnRelic.jobs.StartJob(new Job(MiscDefOf.TiedDown, (LocalTargetInfo)position), JobCondition.InterruptForced, (ThinkNode)null, false, true, (ThinkTreeDef)null, new JobTag?(JobTag.Idle), false);
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield return(Toils_Jump.JumpIfHaveTargetInQueue(TargetIndex.B, extract));

            yield return(gotoBillGiver);

            yield return(StartActivity());
            //yield return Waiting();
            //yield return DoRecipeWork();
            //yield return Toils_Recipe.FinishRecipeAndStartStoringProduct();///////////////////////
            //if (!this.job.RecipeDef.products.NullOrEmpty<ThingDefCountClass>() || !this.job.RecipeDef.specialProducts.NullOrEmpty<SpecialProductType>())
            //{
            //    yield return Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null);
            //    Toil carryToCell = Toils_Haul.CarryHauledThingToCell(TargetIndex.B);
            //    yield return carryToCell;
            //    yield return Toils_Haul.PlaceHauledThingInCell(TargetIndex.B, carryToCell, true);
            //    Toil recount = new Toil();
            //    recount.initAction = delegate
            //    {
            //        Bill_Production bill_Production = recount.actor.jobs.curJob.bill as Bill_Production;
            //        if (bill_Production != null && bill_Production.repeatMode == BillRepeatModeDefOf.TargetCount)
            //        {
            //            this.Map.resourceCounter.UpdateResourceCounts();
            //        }
            //    };
            //    yield return recount;
            //}
        }