示例#1
0
        protected override void Explode()
        {
            Map map = base.Map;

            this.Destroy(DestroyMode.Vanish);
            if (this.def.projectile.explosionEffect != null)
            {
                Effecter effecter = this.def.projectile.explosionEffect.Spawn();
                effecter.Trigger(new TargetInfo(base.Position, map, false), new TargetInfo(base.Position, map, false));
                effecter.Cleanup();
            }
            IntVec3   position         = base.Position;
            Map       map2             = map;
            float     explosionRadius  = this.def.projectile.explosionRadius;
            DamageDef damageDef        = this.def.projectile.damageDef;
            int       damageAmount     = base.DamageAmount;
            float     armorPenetration = base.ArmorPenetration;
            SoundDef  soundExplode     = this.def.projectile.soundExplode;
            ThingDef  equipmentDef     = this.equipmentDef;
            ThingDef  def   = this.def;
            Thing     thing = this.intendedTarget.Thing;
            ThingDef  postExplosionSpawnThingDef   = this.def.projectile.postExplosionSpawnThingDef;
            float     postExplosionSpawnChance     = this.def.projectile.postExplosionSpawnChance;
            int       postExplosionSpawnThingCount = this.def.projectile.postExplosionSpawnThingCount;
            ThingDef  preExplosionSpawnThingDef    = this.def.projectile.preExplosionSpawnThingDef;
            float     preExplosionSpawnChance      = this.def.projectile.preExplosionSpawnChance;
            int       preExplosionSpawnThingCount  = this.def.projectile.preExplosionSpawnThingCount;

            PurpleIvyUtils.DoExplosion(position, map2, explosionRadius, damageDef, launcher, damageAmount, armorPenetration, soundExplode, equipmentDef, def, thing, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, this.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, preExplosionSpawnChance, preExplosionSpawnThingCount, this.def.projectile.explosionChanceToStartFire, this.def.projectile.explosionDamageFalloff, new float?(this.origin.AngleToFlat(this.destination)), null);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            var followAndAttack = new Toil();

            followAndAttack.initAction = delegate()
            {
                var actor  = followAndAttack.actor;
                var curJob = actor.jobs.curJob;
                var thing  = curJob.GetTarget(this.a).Thing;
                var pawn1  = thing as Pawn;

                pawn1.pather.StopDead();
                pawn1.TakeDamage(new DamageInfo(PurpleIvyDefOf.PI_ToxicExplosion, 3, 0f, -1f, actor, null, null));
                PurpleIvyUtils.DoExplosion(pawn1.Position, actor.Map, 3f, PurpleIvyDefOf.PI_ToxicExplosion, actor);
                if (actor.jobs.curJob != null)
                {
                    actor.jobs.curDriver.Notify_PatherArrived();
                }
                actor.jobs.TryTakeOrderedJob(PurpleIvyUtils.MeleeAttackJob(actor, pawn1));
            };
            followAndAttack.defaultCompleteMode = ToilCompleteMode.Never;
            followAndAttack.EndOnDespawnedOrNull <Toil>(this.a, JobCondition.Succeeded);
            followAndAttack.FailOn <Toil>(new Func <bool>(this.hunterIsKilled));
            yield return(followAndAttack);

            yield break;
        }
示例#3
0
        protected virtual void Ignite()
        {
            Map map = Map;

            Destroy();
            var radius        = def.projectile.explosionRadius;
            var cellsToAffect = SimplePool <List <IntVec3> > .Get();

            cellsToAffect.Clear();
            cellsToAffect.AddRange(def.projectile.damageDef.Worker.ExplosionCellsToHit(Position, map, radius));
            for (int i = 0; i < 4; i++)
            {
                PurpleIvyMoteMaker.ThrowToxicPostExplosionSmoke(Position.ToVector3Shifted() + Gen.RandomHorizontalVector(radius * 0.7f), map, radius * 0.6f);
            }
            //Fire explosion should be tiny.
            if (this.def.projectile.explosionEffect != null)
            {
                Effecter effecter = this.def.projectile.explosionEffect.Spawn();
                effecter.Trigger(new TargetInfo(this.Position, map, false), new TargetInfo(this.Position, map, false));
                effecter.Cleanup();
            }
            PurpleIvyUtils.DoExplosion(this.Position, map, this.def.projectile.explosionRadius, this.def.projectile.damageDef, this.launcher, this.def.projectile.GetDamageAmount(1, null), this.def.projectile.GetArmorPenetration(1, null), this.def.projectile.soundExplode, this.equipmentDef, this.def, null, this.def.projectile.postExplosionSpawnThingDef, this.def.projectile.postExplosionSpawnChance, this.def.projectile.postExplosionSpawnThingCount, this.def.projectile.applyDamageToExplosionCellsNeighbors, this.def.projectile.preExplosionSpawnThingDef, this.def.projectile.preExplosionSpawnChance, this.def.projectile.preExplosionSpawnThingCount, this.def.projectile.explosionChanceToStartFire, this.def.projectile.explosionDamageFalloff);
        }