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));

            MoteMaker.MakeStaticMote(Position, map, ThingDefOf.Mote_ExplosionFlash, radius * 4f);
            for (int i = 0; i < 4; i++)
            {
                MoteMaker.ThrowSmoke(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();
            }
            GenExplosion.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);
        }
Esempio n. 2
0
        protected void Detonate(Map map, bool ignoreUnspawned = false)
        {
            if (!ignoreUnspawned && !parent.SpawnedOrAnyParentSpawned)
            {
                return;
            }
            CompProperties_Explosive props = Props;
            float num = ExplosiveRadius();

            if (props.explosiveExpandPerFuel > 0f && parent.GetComp <CompRefuelable>() != null)
            {
                parent.GetComp <CompRefuelable>().ConsumeFuel(parent.GetComp <CompRefuelable>().Fuel);
            }
            if (props.destroyThingOnExplosionSize <= num && !parent.Destroyed)
            {
                destroyedThroughDetonation = true;
                parent.Kill();
            }
            EndWickSustainer();
            wickStarted = false;
            if (map == null)
            {
                Log.Warning("Tried to detonate CompExplosive in a null map.");
                return;
            }
            if (props.explosionEffect != null)
            {
                Effecter effecter = props.explosionEffect.Spawn();
                effecter.Trigger(new TargetInfo(parent.PositionHeld, map), new TargetInfo(parent.PositionHeld, map));
                effecter.Cleanup();
            }
            GenExplosion.DoExplosion(instigator: (instigator == null || instigator.HostileTo(parent.Faction)) ? parent : instigator, center: parent.PositionHeld, map: map, radius: num, damType: props.explosiveDamageType, damAmount: props.damageAmountBase, armorPenetration: props.armorPenetrationBase, explosionSound: props.explosionSound, weapon: null, projectile: null, intendedTarget: null, postExplosionSpawnThingDef: props.postExplosionSpawnThingDef, postExplosionSpawnChance: props.postExplosionSpawnChance, postExplosionSpawnThingCount: props.postExplosionSpawnThingCount, applyDamageToExplosionCellsNeighbors: props.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef: props.preExplosionSpawnThingDef, preExplosionSpawnChance: props.preExplosionSpawnChance, preExplosionSpawnThingCount: props.preExplosionSpawnThingCount, chanceToStartFire: props.chanceToStartFire, damageFalloff: props.damageFalloff, direction: null, ignoredThings: thingsIgnoredByExplosion);
        }
Esempio n. 3
0
        protected virtual void Explode(Thing hitThing, bool destroy = false)
        {
            Map     map            = base.Map;
            IntVec3 targetPosition = hitThing?.PositionHeld ?? this.destination.ToIntVec3();

            if (destroy)
            {
                this.Destroy(DestroyMode.Vanish);
            }
            if (this.def.projectile.explosionEffect != null)
            {
                Effecter effecter = this.def.projectile.explosionEffect.Spawn();
                effecter.Trigger(new TargetInfo(targetPosition, map, false), new TargetInfo(targetPosition, map, false));
                effecter.Cleanup();
            }
            IntVec3   position         = targetPosition;
            Map       map2             = map;
            float     explosionRadius  = this.def.projectile.explosionRadius;
            DamageDef damageDef        = this.def.projectile.damageDef;
            Thing     launcher         = this.launcher;
            int       damageAmountBase = this.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;

            GenExplosion.DoExplosion(position, map2, explosionRadius, damageDef, launcher, damageAmountBase, armorPenetration, soundExplode, equipmentDef, def, thing, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, this.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, this.def.projectile.preExplosionSpawnChance, this.def.projectile.preExplosionSpawnThingCount, this.def.projectile.explosionChanceToStartFire, this.def.projectile.explosionDamageFalloff);
        }
Esempio n. 4
0
        public override void CompPostTick(ref float severityAdjustment)
        {
            base.CompPostTick(ref severityAdjustment);
            bool flag = base.Pawn != null;

            if (flag)
            {
                if (initializing)
                {
                    initializing = false;
                    this.Initialize();
                }
            }
            if (Find.TickManager.TicksGame % 30 == 0)
            {
                if (this.Pawn.CurJob != null && this.Pawn.CurJob.targetA != null && this.Pawn.CurJob.targetA.Thing is Pawn)
                {
                    severityAdjustment -= 20;
                }
                Effecter InvisEffect = TorannMagicDefOf.TM_InvisibilityEffecter.Spawn();
                InvisEffect.Trigger(new TargetInfo(this.Pawn.Position, this.Pawn.Map, false), new TargetInfo(this.Pawn.Position, this.Pawn.Map, false));
                InvisEffect.Cleanup();
            }
            if (Find.TickManager.TicksGame % 60 == 0)
            {
                severityAdjustment--;
            }
        }
Esempio n. 5
0
        protected override void Explode()
        {
            Map map = base.Map;

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

            GenExplosion.DoExplosion(position, map2, explosionRadius, damageDef, launcher, damageAmount, armorPenetration, soundExplode, equipmentDef, def, thing, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, base.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, base.def.projectile.preExplosionSpawnChance, base.def.projectile.preExplosionSpawnThingCount, base.def.projectile.explosionChanceToStartFire, base.def.projectile.explosionDamageFalloff);
        }
Esempio n. 6
0
        protected virtual void Explode()
        {
            Map map = Map;

            Destroy(DestroyMode.Vanish);
            if (this.def.projectile.explosionEffect != null)
            {
                Effecter effecter = this.def.projectile.explosionEffect.Spawn();
                effecter.Trigger(new TargetInfo(Position, map, false), new TargetInfo(Position, map, false));
                effecter.Cleanup();
            }
            IntVec3   position         = Position;
            Map       map2             = map;
            float     explosionRadius  = this.def.projectile.explosionRadius;
            Thing     launcher         = this.launcher;
            DamageDef damageDef        = ((ProjectileProperties_BallistaArrow)this.def.projectile).shockWaveDef; //BallistaDamageDefOf.ShockWaveHeavy;
            int       damageAmount     = damageDef.defaultDamage;
            float     armorPenetration = damageDef.defaultArmorPenetration;
            SoundDef  soundExplode     = this.def.projectile.soundExplode;
            ThingDef  equipmentDef     = this.equipmentDef;
            ThingDef  def   = this.def;
            Thing     thing = 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;

            GenExplosion.DoExplosion(position, map2, explosionRadius, damageDef, launcher, damageAmount, armorPenetration, soundExplode, equipmentDef, def, thing, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, this.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, this.def.projectile.preExplosionSpawnChance, this.def.projectile.preExplosionSpawnThingCount, this.def.projectile.explosionChanceToStartFire, this.def.projectile.explosionDamageFalloff);
        }
        public void AccelerateEffects(Pawn pawn, int intensity)
        {
            Effecter AccelEffect = TorannMagicDefOf.TM_TimeAccelerationEffecter.Spawn();

            AccelEffect.Trigger(new TargetInfo(pawn), new TargetInfo(pawn));
            AccelEffect.Cleanup();
        }
Esempio n. 8
0
 public override void CompTick()
 {
     if (ReactivatedThisTick && Props.reactivateEffect != null)
     {
         Effecter effecter = new Effecter(Props.reactivateEffect);
         effecter.Trigger(parent, TargetInfo.Invalid);
         effecter.Cleanup();
     }
     if (Find.TickManager.TicksGame >= nextChargeTick + Props.chargeDurationTicks)
     {
         nextChargeTick += Props.chargeIntervalTicks;
     }
     stunner.StunHandlerTick();
     if (Props.activeSound.NullOrUndefined())
     {
         return;
     }
     if (Active)
     {
         if (sustainer == null || sustainer.Ended)
         {
             sustainer = Props.activeSound.TrySpawnSustainer(SoundInfo.InMap(parent));
         }
         sustainer.Maintain();
     }
     else if (sustainer != null && !sustainer.Ended)
     {
         sustainer.End();
     }
 }
Esempio n. 9
0
        protected override bool TryCastShot()
        {
            Pawn caster = base.CasterPawn;
            Pawn pawn   = this.currentTarget.Thing as Pawn;

            bool flag = pawn != null && !pawn.Dead;

            if (flag)
            {
                CompAbilityUserMight comp = caster.GetComp <CompAbilityUserMight>();
                int verVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_Custom, "TM_Taunt", "_ver", true);
                int pwrVal = TM_Calc.GetMightSkillLevel(caster, comp.MightData.MightPowerSkill_Custom, "TM_Taunt", "_pwr", true);
                radius      += 2f * verVal;
                tauntChance += pwrVal * .05f;
                targetsMax  += pwrVal;

                SoundInfo info = SoundInfo.InMap(new TargetInfo(caster.Position, caster.Map, false), MaintenanceType.None);
                if (this.CasterPawn.gender == Gender.Female)
                {
                    info.pitchFactor = Rand.Range(1.1f, 1.3f);
                }
                else
                {
                    info.pitchFactor = Rand.Range(.7f, .9f);
                }
                TorannMagicDefOf.TM_Roar.PlayOneShot(info);
                Effecter RageWave = TorannMagicDefOf.TM_RageWaveED.Spawn();
                RageWave.Trigger(new TargetInfo(caster.Position, caster.Map, false), new TargetInfo(caster.Position, caster.Map, false));
                RageWave.Cleanup();
                TM_Action.SearchAndTaunt(caster, this.radius, targetsMax, tauntChance);
            }

            return(true);
        }
Esempio n. 10
0
 public override void CompTick()
 {
     base.CompTick();
     // Throw smoke mote
     foreach (IntVec3 currentCell in damagedCells)
     {
         if (Props.smoke)
         {
             if (Rand.Value < Props.smokeChance)
             {
                 ThrowSmokeBlack(parent.Position.ToVector3Shifted(), 0.5f);
             }
         }
         if (Props.spark)
         {
             // Setup a new spark effect
             sparks = new Effecter(DefDatabase <EffecterDef> .GetNamed("ElectricShort"));
             // If we have a spark effecter
             if (sparks != null)
             {
                 if (Rand.Value < Props.sparkChance)
                 {
                     // Continue effect
                     sparks.EffectTick(parent.Position, parent);
                     sparks.Cleanup();
                     sparks = null;
                 }
             }
         }
     }
 }
Esempio n. 11
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

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

            Toil repair = Toils_General.Wait(75, TargetIndex.None);

            repair.FailOnDespawnedOrNull(TargetIndex.A);
            repair.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            repair.WithEffect(Gun.def.repairEffect, TargetIndex.A);
            repair.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            yield return(repair);

            yield return(new Toil
            {
                initAction = delegate()
                {
                    BeamColorThing.BeamColor = pawn.CurJob.maxNumMeleeAttacks;

                    var targetInfo = new TargetInfo(Gun.Position, Map, false);
                    Effecter effecter = EffecterDefOf.Deflect_Metal.Spawn();
                    effecter.Trigger(targetInfo, targetInfo);
                    effecter.Cleanup();
                    this.Prism.Destroy(DestroyMode.Vanish);
                }
            });

            yield break;
        }
Esempio n. 12
0
        protected virtual void Explode()
        {
            Map map = base.Map;

            Destroy(DestroyMode.Vanish);
            if (base.def.projectile.explosionEffect != null)
            {
                Effecter effecter = base.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  = 4f;
            DamageDef damageDef        = base.def.projectile.damageDef;
            Thing     launcher         = base.launcher;
            int       damageAmount     = base.DamageAmount;
            float     armorPenetration = base.ArmorPenetration;
            SoundDef  soundExplode     = base.def.projectile.soundExplode;
            ThingDef  equipmentDef     = base.equipmentDef;
            ThingDef  def   = base.def;
            Thing     thing = intendedTarget.Thing;
            ThingDef  postExplosionSpawnThingDef   = base.def.projectile.postExplosionSpawnThingDef;
            float     postExplosionSpawnChance     = base.def.projectile.postExplosionSpawnChance;
            int       postExplosionSpawnThingCount = base.def.projectile.postExplosionSpawnThingCount;
            ThingDef  preExplosionSpawnThingDef    = base.def.projectile.preExplosionSpawnThingDef;

            GenExplosion.DoExplosion(position, map2, explosionRadius, damageDef, launcher, 1, armorPenetration, soundExplode, equipmentDef, def, thing, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, base.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, base.def.projectile.preExplosionSpawnChance, base.def.projectile.preExplosionSpawnThingCount, base.def.projectile.explosionChanceToStartFire, base.def.projectile.explosionDamageFalloff);

            foreach (Pawn pawn in map.mapPawns.AllPawns)
            {
                if (pawn.Dead)
                {
                    continue;
                }
                try {
                    if (position.DistanceTo(pawn.Position) < 10f)
                    {
                        pawn.health.AddHediff(HediffDef.Named("LethalRadiationPoisoning"));
                    }
                    else if (position.DistanceTo(pawn.Position) > 10f && position.DistanceTo(pawn.Position) < 20f)
                    {
                        pawn.health.AddHediff(HediffDef.Named("HeavyRadiationPoisoning"));
                    }
                    else if (position.DistanceTo(pawn.Position) > 20f && position.DistanceTo(pawn.Position) < 40f)
                    {
                        pawn.health.AddHediff(HediffDef.Named("MediumRadiationPoisoning"));
                    }
                    else if (position.DistanceTo(pawn.Position) > 40f && position.DistanceTo(pawn.Position) < 45f)
                    {
                        pawn.health.AddHediff(HediffDef.Named("LightRadiationPoisoning"));
                    }
                }
                catch (Exception e)
                {
                    Log.Message(e.ToString());
                }
            }
        }
Esempio n. 13
0
        public static Toil WithEffect(this Toil toil, Func <EffecterDef> effecterDefGetter, Func <LocalTargetInfo> effectTargetGetter)
        {
            Effecter effecter = null;

            toil.AddPreTickAction(delegate
            {
                if (effecter == null)
                {
                    EffecterDef effecterDef = effecterDefGetter();
                    if (effecterDef != null)
                    {
                        effecter = effecterDef.Spawn();
                    }
                }
                else
                {
                    effecter.EffectTick(toil.actor, effectTargetGetter().ToTargetInfo(toil.actor.Map));
                }
            });
            toil.AddFinishAction(delegate
            {
                if (effecter != null)
                {
                    effecter.Cleanup();
                    effecter = null;
                }
            });
            return(toil);
        }
Esempio n. 14
0
        public override void DoActiveEffecter()
        {
            Effecter CircleED = TorannMagicDefOf.TM_SmallMagicCircleED.Spawn();

            CircleED.Trigger(new TargetInfo(GetCircleCenter, this.Map, false), new TargetInfo(GetCircleCenter, this.Map, false));
            CircleED.Cleanup();
        }
Esempio n. 15
0
 protected virtual void ExplodeOnImpact()
 {
     if (!this.SpawnedOrAnyParentSpawned)
     {
         return;
     }
     if (props.destroyThingOnExplosionSize <= explosionRadius && !this.Destroyed)
     {
         this.Kill(null, null);
     }
     if (props.explosionEffect != null)
     {
         Effecter effecter = props.explosionEffect.Spawn();
         effecter.Trigger(new TargetInfo(this.PositionHeld, map, false), new TargetInfo(this.PositionHeld, map, false));
         effecter.Cleanup();
     }
     if (def.projectileWhenLoaded?.projectile != null)
     {
         GenExplosion.DoExplosion(this.PositionHeld, map, explosionRadius, projectile.damageDef, this, projectile.GetDamageAmount(1), projectile.GetArmorPenetration(1), projectile.soundExplode, null, def.projectileWhenLoaded, null,
                                  projectile.postExplosionSpawnThingDef, projectile.postExplosionSpawnChance, projectile.postExplosionSpawnThingCount, projectile.applyDamageToExplosionCellsNeighbors, projectile.preExplosionSpawnThingDef,
                                  projectile.preExplosionSpawnChance, projectile.preExplosionSpawnThingCount, projectile.explosionChanceToStartFire, projectile.explosionDamageFalloff);
     }
     else
     {
         GenExplosion.DoExplosion(this.PositionHeld, map, explosionRadius, props.explosiveDamageType, this, props.damageAmountBase, props.armorPenetrationBase, props.explosionSound, null, null, null, props.postExplosionSpawnThingDef,
                                  props.postExplosionSpawnChance, props.postExplosionSpawnThingCount, props.applyDamageToExplosionCellsNeighbors, props.preExplosionSpawnThingDef, props.preExplosionSpawnChance, props.preExplosionSpawnThingCount, props.chanceToStartFire,
                                  props.damageFalloff);
     }
 }
Esempio n. 16
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);
        }
Esempio n. 17
0
        protected virtual void Explode(Thing hitThing = null)
        {
            Map          map     = base.Map;
            List <Thing> ignored = new List <Thing>();

            if (hitThing != null)
            {
                ignored.Add(hitThing);
            }
            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;
            Thing     launcher         = this.launcher;
            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;

            GenExplosion.DoExplosion(position, map2, explosionRadius, damageDef, launcher, damageAmount, armorPenetration, soundExplode, equipmentDef, def, thing, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, this.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, this.def.projectile.preExplosionSpawnChance, this.def.projectile.preExplosionSpawnThingCount, this.def.projectile.explosionChanceToStartFire, this.def.projectile.explosionDamageFalloff, ignoredThings: ignored);
        }
        public static void CriticalOverheatExplosion(ref AbilitesExtended.Verb_EquipmentLaunchProjectile __instance)
        {
            Map map = __instance.caster.Map;

            if (__instance.Projectile.projectile.explosionEffect != null)
            {
                Effecter effecter = __instance.Projectile.projectile.explosionEffect.Spawn();
                effecter.Trigger(new TargetInfo(__instance.EquipmentSource.Position, map, false), new TargetInfo(__instance.EquipmentSource.Position, map, false));
                effecter.Cleanup();
            }
            IntVec3   position         = __instance.caster.Position;
            Map       map2             = map;
            float     explosionRadius  = __instance.Projectile.projectile.explosionRadius;
            DamageDef damageDef        = __instance.Projectile.projectile.damageDef;
            Thing     launcher         = __instance.EquipmentSource;
            int       DamageAmount     = __instance.Projectile.projectile.GetDamageAmount(__instance.EquipmentSource, null);
            float     ArmorPenetration = __instance.Projectile.projectile.GetArmorPenetration(__instance.EquipmentSource, null);
            SoundDef  soundExplode     = __instance.Projectile.projectile.soundExplode;
            ThingDef  equipmentDef     = __instance.EquipmentSource.def;
            ThingDef  def   = __instance.EquipmentSource.def;
            Thing     thing = __instance.EquipmentSource;
            ThingDef  postExplosionSpawnThingDef   = __instance.Projectile.projectile.postExplosionSpawnThingDef;
            float     postExplosionSpawnChance     = __instance.Projectile.projectile.postExplosionSpawnChance;
            int       postExplosionSpawnThingCount = __instance.Projectile.projectile.postExplosionSpawnThingCount;
            ThingDef  preExplosionSpawnThingDef    = __instance.Projectile.projectile.preExplosionSpawnThingDef;

            GenExplosion.DoExplosion(position, map2, explosionRadius, damageDef, launcher, DamageAmount, ArmorPenetration, soundExplode);//, equipmentDef, def, thing, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, EquipmentSource.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, EquipmentSource.def.projectile.preExplosionSpawnChance, EquipmentSource.def.projectile.preExplosionSpawnThingCount, EquipmentSource.def.projectile.explosionChanceToStartFire, EquipmentSource.def.projectile.explosionDamageFalloff);
            return;
        }
Esempio n. 19
0
        public virtual void CriticalOverheatExplosion()
        {
            Map map = EquipmentSource.Map;

            if (EquipmentSource.def.projectile.explosionEffect != null)
            {
                Effecter effecter = Projectile.projectile.explosionEffect.Spawn();
                effecter.Trigger(new TargetInfo(EquipmentSource.Position, map, false), new TargetInfo(EquipmentSource.Position, map, false));
                effecter.Cleanup();
            }
            IntVec3   position         = EquipmentSource.Position;
            Map       map2             = map;
            float     explosionRadius  = EquipmentSource.def.projectile.explosionRadius;
            DamageDef damageDef        = EquipmentSource.def.projectile.damageDef;
            Thing     launcher         = EquipmentSource;
            int       DamageAmount     = Projectile.projectile.GetDamageAmount(EquipmentSource, null);
            float     ArmorPenetration = Projectile.projectile.GetArmorPenetration(EquipmentSource, null);
            SoundDef  soundExplode     = EquipmentSource.def.projectile.soundExplode;
            ThingDef  equipmentDef     = EquipmentSource.def;
            ThingDef  def   = EquipmentSource.def;
            Thing     thing = EquipmentSource;
            ThingDef  postExplosionSpawnThingDef   = EquipmentSource.def.projectile.postExplosionSpawnThingDef;
            float     postExplosionSpawnChance     = EquipmentSource.def.projectile.postExplosionSpawnChance;
            int       postExplosionSpawnThingCount = EquipmentSource.def.projectile.postExplosionSpawnThingCount;
            ThingDef  preExplosionSpawnThingDef    = EquipmentSource.def.projectile.preExplosionSpawnThingDef;

            GenExplosion.DoExplosion(position, map2, explosionRadius, damageDef, launcher, DamageAmount, ArmorPenetration, soundExplode, equipmentDef, def, thing, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, EquipmentSource.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, EquipmentSource.def.projectile.preExplosionSpawnChance, EquipmentSource.def.projectile.preExplosionSpawnThingCount, EquipmentSource.def.projectile.explosionChanceToStartFire, EquipmentSource.def.projectile.explosionDamageFalloff);
        }
Esempio n. 20
0
        public void ReverseHealLinkedPawn(float severity)
        {
            Hediff bloodHediff = this.linkedPawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("TM_BloodHD"), false);

            if (bloodHediff != null)
            {
                if (this.woundsHealed)
                {
                    if (bloodHediff.Severity < 1)
                    {
                        TM_Action.DamageEntities(this.linkedPawn, null, severity, TMDamageDefOf.DamageDefOf.TM_BloodBurn, this.Pawn);
                    }
                    else
                    {
                        bloodHediff.Severity -= severity / 3;
                        TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_BloodMist"), this.linkedPawn.DrawPos, this.Pawn.Map, Rand.Range(.6f, .7f), .2f, 0.05f, 1f, Rand.Range(-50, 50), Rand.Range(1.5f, 2f), (Quaternion.AngleAxis(-90, Vector3.up) * this.directionToLinkedPawn).ToAngleFlat(), Rand.Range(0, 360));
                    }
                }
            }
            else
            {
                this.removeNow = true;
            }

            if (severity > 1.25f)
            {
                Effecter BloodShieldEffect = TorannMagicDefOf.TM_BloodShieldEffecter.Spawn();
                BloodShieldEffect.Trigger(new TargetInfo(this.linkedPawn.Position, this.linkedPawn.Map, false), new TargetInfo(this.linkedPawn.Position, this.linkedPawn.Map, false));
                BloodShieldEffect.Cleanup();
            }
        }
Esempio n. 21
0
        public virtual void Explode(Thing hitThing, bool destroy = false)
        {
            Map     map    = base.Map;
            IntVec3 intVec = (hitThing != null) ? hitThing.PositionHeld : this.destination.ToIntVec3();

            if (destroy)
            {
                this.Destroy(DestroyMode.Vanish);
            }
            bool flag = this.def.projectile.explosionEffect != null;

            if (flag)
            {
                Effecter effecter = this.def.projectile.explosionEffect.Spawn();
                effecter.Trigger(new TargetInfo(intVec, map, false), new TargetInfo(intVec, map, false));
                effecter.Cleanup();
            }
            IntVec3   center                       = intVec;
            Map       map2                         = map;
            float     explosionRadius              = this.def.projectile.explosionRadius;
            DamageDef damageDef                    = this.def.projectile.damageDef;
            Thing     launcher                     = this.launcher;
            int       damageAmount                 = this.def.projectile.GetDamageAmount(1f, null);
            SoundDef  soundExplode                 = this.def.projectile.soundExplode;
            ThingDef  equipmentDef                 = this.equipmentDef;
            ThingDef  def                          = this.def;
            ThingDef  postExplosionSpawnThingDef   = this.def.projectile.postExplosionSpawnThingDef;
            float     postExplosionSpawnChance     = this.def.projectile.postExplosionSpawnChance;
            int       postExplosionSpawnThingCount = this.def.projectile.postExplosionSpawnThingCount;
            ThingDef  preExplosionSpawnThingDef    = this.def.projectile.preExplosionSpawnThingDef;

            GenExplosion.DoExplosion(center, map2, explosionRadius, damageDef, launcher, damageAmount, 0f, soundExplode, equipmentDef, def, null, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, this.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, this.def.projectile.preExplosionSpawnChance, this.def.projectile.preExplosionSpawnThingCount, this.def.projectile.explosionChanceToStartFire, this.def.projectile.explosionDamageFalloff);
        }
Esempio n. 22
0
        public void Notify_TerrainDestroyed(IntVec3 c)
        {
            if (!this.CanRemoveTopLayerAt(c))
            {
                return;
            }
            TerrainDef terrainDef = this.TerrainAt(c);

            this.RemoveTopLayer(c, false);
            if (terrainDef.destroyBuildingsOnDestroyed)
            {
                c.GetFirstBuilding(this.map)?.Kill(new DamageInfo?(), (Hediff)null);
            }
            if (terrainDef.destroyEffectWater != null && this.TerrainAt(c) != null && this.TerrainAt(c).IsWater)
            {
                Effecter effecter = terrainDef.destroyEffectWater.Spawn();
                effecter.Trigger(new TargetInfo(c, this.map, false), new TargetInfo(c, this.map, false));
                effecter.Cleanup();
            }
            else
            {
                if (terrainDef.destroyEffect == null)
                {
                    return;
                }
                Effecter effecter = terrainDef.destroyEffect.Spawn();
                effecter.Trigger(new TargetInfo(c, this.map, false), new TargetInfo(c, this.map, false));
                effecter.Cleanup();
            }
        }
Esempio n. 23
0
        protected virtual 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;
            Thing     launcher         = this.launcher;
            int       damageAmountBase = this.def.projectile.damageAmountBase;
            SoundDef  soundExplode     = this.def.projectile.soundExplode;
            ThingDef  equipmentDef     = this.equipmentDef;
            ThingDef  def = this.def;

            GenerateAura(explosionRadius, position, map);
            ThingDef postExplosionSpawnThingDef   = this.def.projectile.postExplosionSpawnThingDef;
            float    postExplosionSpawnChance     = this.def.projectile.postExplosionSpawnChance;
            int      postExplosionSpawnThingCount = this.def.projectile.postExplosionSpawnThingCount;
            ThingDef preExplosionSpawnThingDef    = this.def.projectile.preExplosionSpawnThingDef;

            GenExplosion.DoExplosion(position, map2, explosionRadius, damageDef, launcher, damageAmountBase, soundExplode, equipmentDef, def, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, this.def.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, this.def.projectile.preExplosionSpawnChance, this.def.projectile.preExplosionSpawnThingCount, this.def.projectile.explosionChanceToStartFire, this.def.projectile.explosionDealMoreDamageAtCenter);
        }
Esempio n. 24
0
        public static void DoEffecter(EffecterDef effecterDef, IntVec3 position, Map map)
        {
            Effecter effecter = effecterDef.Spawn();

            effecter.Trigger(new TargetInfo(position, map, false), new TargetInfo(position, map, false));
            effecter.Cleanup();
        }
Esempio n. 25
0
 public override void Tick()
 {
     if (def == null || (ticks++ > projDef.lifetime && (effecter == null || this.effecter.ticksLeft <= 0)))
     {
         if (effecter != null)
         {
             effecter.Cleanup();
         }
         Destroy(DestroyMode.Vanish);
     }
     if (effecter != null)
     {
         if (this.effecter.ticksLeft > 0)
         {
             var targetInfo = hitThing ?? new TargetInfo(IntVec3.FromVector3(b), launcher.Map, false);
             effecter.EffectTick(targetInfo, targetInfo);
             effecter.ticksLeft--;
         }
         else
         {
             this.effecter.Cleanup();
         }
     }
     if (this.ticksToDetonation > 0)
     {
         this.ticksToDetonation--;
         if (this.ticksToDetonation <= 0)
         {
             this.Explode();
         }
     }
 }
Esempio n. 26
0
        public void ReverseEffects(Pawn pawn, int intensity)
        {
            Effecter ReverseEffect = TorannMagicDefOf.TM_TimeReverseEffecter.Spawn();

            ReverseEffect.Trigger(new TargetInfo(pawn), new TargetInfo(pawn));
            ReverseEffect.Cleanup();
        }
Esempio n. 27
0
        protected virtual void Explode()
        {
            Map map = base.Map;

            this.Destroy(DestroyMode.Vanish);
            if (Payload.projectile.explosionEffect != null)
            {
                Effecter effecter = Payload.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  = Payload.projectile.explosionRadius;
            DamageDef damageDef        = Payload.projectile.damageDef;
            Thing     launcher         = this.launcher;
            int       damageAmount     = Payload.projectile.GetDamageAmount_NewTmp(Payload, null);
            float     armorPenetration = Payload.projectile.GetArmorPenetration(this);
            SoundDef  soundExplode     = Payload.projectile.soundExplode;
            ThingDef  equipmentDef     = this.def;
            ThingDef  def   = Payload;
            Thing     thing = this.target.Thing;
            ThingDef  postExplosionSpawnThingDef   = Payload.projectile.postExplosionSpawnThingDef;
            float     postExplosionSpawnChance     = Payload.projectile.postExplosionSpawnChance;
            int       postExplosionSpawnThingCount = Payload.projectile.postExplosionSpawnThingCount;
            ThingDef  preExplosionSpawnThingDef    = Payload.projectile.preExplosionSpawnThingDef;
            float     preExplosionSpawnChance      = Payload.projectile.preExplosionSpawnChance;
            int       preExplosionSpawnThingCount  = Payload.projectile.preExplosionSpawnThingCount;

            GenExplosion.DoExplosion(position, map2, explosionRadius, damageDef, launcher, damageAmount, armorPenetration, soundExplode, equipmentDef, def, thing, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, Payload.projectile.applyDamageToExplosionCellsNeighbors, preExplosionSpawnThingDef, preExplosionSpawnChance, preExplosionSpawnThingCount, Payload.projectile.explosionChanceToStartFire, Payload.projectile.explosionDamageFalloff, null, null);
        }
Esempio n. 28
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

            base.Impact(hitThing);
            ThingDef def = this.def;

            if (!this.initialized)
            {
                caster = this.launcher as Pawn;
                CompAbilityUserMagic comp = caster.GetComp <CompAbilityUserMagic>();
                MagicPowerSkill      pwr  = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_OrbitalStrike.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_OrbitalStrike_pwr");
                MagicPowerSkill      ver  = caster.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_OrbitalStrike.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_OrbitalStrike_ver");
                verVal         = ver.level;
                pwrVal         = pwr.level;
                this.arcaneDmg = comp.arcaneDmg;
                ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();
                if (settingsRef.AIHardMode && !caster.IsColonist)
                {
                    pwrVal = 3;
                    verVal = 3;
                }
                this.angle     = Rand.Range(-3f, 3f);
                this.strikeNum = 1;
                this.CheckSpawnSustainer();
                this.strikePos     = base.Position;
                this.targettingAge = 300 - (50 * verVal);
                this.beamDuration  = 120 - (10 * verVal);
                this.radius        = this.def.projectile.explosionRadius;
                this.initialized   = true;
            }

            if (this.sustainer != null)
            {
                this.sustainer.info.volumeFactor = (this.age) / (this.beamDuration + this.targettingAge);
                this.sustainer.Maintain();
                if (this.TicksLeft <= 0)
                {
                    this.sustainer.End();
                    this.sustainer = null;
                }
            }

            if (this.age == (this.targettingAge + this.beamDuration))
            {
                TM_MoteMaker.MakePowerBeamMoteColor(this.strikePos, base.Map, this.radius * 4f, 2f, .5f, .1f, .5f, colorInt.ToColor);
                GenExplosion.DoExplosion(this.strikePos, map, this.def.projectile.explosionRadius, DamageDefOf.Bomb, this.launcher as Pawn, Mathf.RoundToInt((25 + 5 * pwrVal) * this.arcaneDmg), 0, null, def, this.equipmentDef, null, null, 0f, 1, false, null, 0f, 1, 0f, false);
                Effecter OSEffect = TorannMagicDefOf.TM_OSExplosion.Spawn();
                OSEffect.Trigger(new TargetInfo(this.strikePos, this.Map, false), new TargetInfo(this.strikePos, this.Map, false));
                OSEffect.Cleanup();
            }
            else
            {
                if (Find.TickManager.TicksGame % 3 == 0)
                {
                    TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_BloodSquirt, this.strikePos.ToVector3Shifted(), this.Map, .3f, .1f, 0, 0, Rand.Range(-100, 100), 0, 0, Rand.Range(0, 360));
                }
            }
        }
Esempio n. 29
0
 public override void DeSpawn()
 {
     if (effecter != null)
     {
         effecter.Cleanup();
     }
     base.DeSpawn();
 }
Esempio n. 30
0
 public void Cleanup()
 {
     if (effecter != null)
     {
         effecter.Cleanup();
     }
     FullPool <LiveEffecter> .Return(this);
 }