Beispiel #1
0
        private void ShatterSentinel(Thing sentinel, Map map)
        {
            float   radius = 4f;
            Vector3 center = sentinel.DrawPos;

            List <IntVec3> damageRing  = GenRadial.RadialCellsAround(sentinel.Position, radius, true).ToList();
            List <IntVec3> outsideRing = GenRadial.RadialCellsAround(sentinel.Position, radius, false).Except(GenRadial.RadialCellsAround(sentinel.Position, radius - 1, true)).ToList();

            for (int i = 0; i < damageRing.Count; i++)
            {
                List <Thing> allThings = damageRing[i].GetThingList(map);
                for (int j = 0; j < allThings.Count; j++)
                {
                    if (allThings[j] is Pawn)
                    {
                        Pawn p = allThings[j] as Pawn;
                        TM_Action.DamageEntities(p, p.health.hediffSet.GetRandomNotMissingPart(DamageDefOf.Blunt, BodyPartHeight.Undefined, BodyPartDepth.Outside, null), Rand.Range(14, 22), DamageDefOf.Blunt, this.CasterPawn);
                    }
                    else if (allThings[j] is Building)
                    {
                        TM_Action.DamageEntities(allThings[j], null, Rand.Range(56, 88), DamageDefOf.Blunt, this.CasterPawn);
                    }
                    else
                    {
                        if (Rand.Chance(.1f))
                        {
                            GenPlace.TryPlaceThing(ThingMaker.MakeThing(ThingDefOf.Filth_RubbleRock), damageRing[i], map, ThingPlaceMode.Near);
                        }
                    }
                }
            }
            for (int i = 0; i < outsideRing.Count; i++)
            {
                IntVec3 intVec = outsideRing[i];
                if (intVec.IsValid && intVec.InBounds(map))
                {
                    Vector3 moteDirection = TM_Calc.GetVector(sentinel.DrawPos.ToIntVec3(), intVec);
                    TM_MoteMaker.ThrowGenericMote(ThingDef.Named("Mote_Rubble"), sentinel.DrawPos, map, Rand.Range(.3f, .6f), .2f, .02f, .05f, Rand.Range(-100, 100), Rand.Range(8f, 13f), (Quaternion.AngleAxis(90, Vector3.up) * moteDirection).ToAngleFlat(), 0);
                    TM_MoteMaker.ThrowGenericMote(ThingDefOf.Gas_Smoke, sentinel.DrawPos, map, Rand.Range(.9f, 1.2f), .3f, .02f, Rand.Range(.25f, .4f), Rand.Range(-100, 100), Rand.Range(5f, 8f), (Quaternion.AngleAxis(90, Vector3.up) * moteDirection).ToAngleFlat(), 0);
                    GenExplosion.DoExplosion(intVec, map, .4f, DamageDefOf.Blunt, this.CasterPawn, 0, 0, SoundDefOf.Pawn_Melee_Punch_HitBuilding, null, null, null, ThingDefOf.Filth_RubbleRock, .4f, 1, false, null, 0f, 1, 0, false);
                    //FleckMaker.ThrowSmoke(intVec.ToVector3Shifted(), base.Map, Rand.Range(.6f, 1f));
                }
            }
        }
Beispiel #2
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

            base.Impact(hitThing);
            ThingDef def             = this.def;
            Pawn     p               = launcher as Pawn;
            float    explosionRadius = this.def.projectile.explosionRadius;

            if (p != null)
            {
                if (p.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Cantrips.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Cantrips_ver").level >= 2)
                {
                    explosionRadius += 2f;
                }
                if (p.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Cantrips.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Cantrips_pwr").level >= 1)
                {
                    List <Pawn> blindedPawns = TM_Calc.FindAllPawnsAround(map, base.Position, explosionRadius);
                    if (blindedPawns != null && blindedPawns.Count > 0)
                    {
                        for (int i = 0; i < blindedPawns.Count; i++)
                        {
                            if (blindedPawns[i].Faction != null && blindedPawns[i].Faction.HostileTo(p.Faction))
                            {
                                HealthUtility.AdjustSeverity(blindedPawns[i], HediffDef.Named("TM_Blind"), .6f);
                            }
                            else if (blindedPawns[i].Faction != p.Faction)
                            {
                                HealthUtility.AdjustSeverity(blindedPawns[i], HediffDef.Named("TM_Blind"), .6f);
                                if (blindedPawns[i].RaceProps.Animal)
                                {
                                    if (Rand.Chance(.5f))
                                    {
                                        blindedPawns[i].mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter, null, false, false, null, false);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            GenExplosion.DoExplosion(base.Position, map, explosionRadius, this.def.projectile.damageDef, this.launcher, this.def.projectile.GetDamageAmount(1, null), 0, SoundDefOf.Artillery_ShellLoaded, def, this.equipmentDef, null, ThingDefOf.Gas_Smoke, 1f, 1, false, null, 0f, 1, 0f, false);
        }
        public override void PawnDied(Corpse corpse)
        {
            float radius;

            if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 0)
            {
                radius = 1.9f;
            }
            else if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 1)
            {
                radius = 2.9f;
            }
            else
            {
                radius = 4.9f;
            }
            //GenExplosion.DoExplosion(corpse.Position, corpse.Map, radius, DamageDefOf.Stun, corpse.InnerPawn,      null, null, null, null, 0f, 1, false, null, 0f, 1);
            GenExplosion.DoExplosion(corpse.Position, corpse.Map, radius, DamageDefOf.Stun, corpse.InnerPawn, -1, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false);
        }
Beispiel #4
0
 protected void Detonate(Map map)
 {
     if (this.parent.SpawnedOrAnyParentSpawned)
     {
         CompProperties_Explosive props = this.Props;
         float num = this.ExplosiveRadius();
         if (props.explosiveExpandPerFuel > 0f && this.parent.GetComp <CompRefuelable>() != null)
         {
             this.parent.GetComp <CompRefuelable>().ConsumeFuel(this.parent.GetComp <CompRefuelable>().Fuel);
         }
         if (props.destroyThingOnExplosionSize <= num && !this.parent.Destroyed)
         {
             this.destroyedThroughDetonation = true;
             this.parent.Kill(null, null);
         }
         this.EndWickSustainer();
         this.wickStarted = false;
         if (map == null)
         {
             Log.Warning("Tried to detonate CompExplosive in a null map.", false);
         }
         else
         {
             if (props.explosionEffect != null)
             {
                 Effecter effecter = props.explosionEffect.Spawn();
                 effecter.Trigger(new TargetInfo(this.parent.PositionHeld, map, false), new TargetInfo(this.parent.PositionHeld, map, false));
                 effecter.Cleanup();
             }
             IntVec3   positionHeld        = this.parent.PositionHeld;
             float     radius              = num;
             DamageDef explosiveDamageType = props.explosiveDamageType;
             Thing     thing                        = this.instigator ?? this.parent;
             int       damageAmountBase             = props.damageAmountBase;
             float     armorPenetrationBase         = props.armorPenetrationBase;
             SoundDef  explosionSound               = props.explosionSound;
             ThingDef  postExplosionSpawnThingDef   = props.postExplosionSpawnThingDef;
             float     postExplosionSpawnChance     = props.postExplosionSpawnChance;
             int       postExplosionSpawnThingCount = props.postExplosionSpawnThingCount;
             GenExplosion.DoExplosion(positionHeld, map, radius, explosiveDamageType, thing, damageAmountBase, armorPenetrationBase, explosionSound, null, null, null, postExplosionSpawnThingDef, postExplosionSpawnChance, postExplosionSpawnThingCount, props.applyDamageToExplosionCellsNeighbors, props.preExplosionSpawnThingDef, props.preExplosionSpawnChance, props.preExplosionSpawnThingCount, props.chanceToStartFire, props.damageFalloff);
         }
     }
 }
Beispiel #5
0
        protected override bool TryCastShot()
        {
            Building_Megumin meg = this.caster as Building_Megumin;

            if (meg == null)
            {
                Log.Error("Verb_Megumin used by a caster that is not a Building_Megumin?");
            }

            Map map = meg.TargetMap;

            if (map == null)
            {
                Log.Error("Null map to cast megumin verb. Yikes.");
                return(false);
            }

            var targetCell = this.currentTarget.Cell;

            Log.Message($"MegVerb: Firing on map: {map}, target: {targetCell}");

            CustomOrbitalStrike beam = (CustomOrbitalStrike)GenSpawn.Spawn(AADefOf.CustomOrbitalStrike_AA, targetCell, map, WipeMode.Vanish);

            beam.duration                = Building_Megumin.DURATION_TICKS;
            beam.instigator              = this.caster;
            beam.weaponDef               = ((base.EquipmentSource != null) ? base.EquipmentSource.def : null);
            beam.DamageDefs              = new DamageDef[] { AADefOf.SkyBeamBlast_AA, AADefOf.EnergyBurn_AA };
            beam.UpdatesPerTick          = 20;
            beam.ArmorPen                = 1.3f;                 // To make it viable against mechanoids and heavy raiders.
            beam.DamageAmountRange       = new IntRange(35, 45); // Applied up to 18 times per tick, that's a lot of damage.
            beam.CorpseDamageAmountRange = new IntRange(3, 6);   // Does less damage to corpses, so that there is something left over after the devastation, although this may be OP (killing entire army and keeping their gear).
            beam.StartStrike();

            // Spawn huge explosion once the beam fires.
            GenExplosion.DoExplosion(currentTarget.Cell, caster.Map, Building_Megumin.EXPLOSION_RADIUS, AADefOf.EnergyBurn_AA, caster, Building_Megumin.EXPLOSION_DAMAGE, Building_Megumin.EXPLOSION_PEN, AADefOf.Explosion_Antimatter_Large_AA);

            if (caster != null)
            {
                beam.OnStrikeOver += ((Building_Megumin)caster).OnStrikeEnd;
            }

            return(true);
        }
        //public override void SpawnSetup(Map map, bool respawningAfterLoad)
        //{
        //    base.SpawnSetup(map, respawningAfterLoad);
        //    this.skydrillerEffect = new Skydriller_PlasmaBeam(base.Map, this.Position);
        //}

        public override void Tick()
        {
            base.Tick();
            this.plasmaTick--;
            this.explosionTick--;

            if (this.plasmaTick == 0)
            {
                base.Map.weatherManager.eventHandler.AddEvent(new Skydriller_PlasmaBeam(base.Map, this.Position));
                this.explosionTick = 4;
            }

            if (this.explosionTick == 0)
            {
                MoteMaker.MakeStaticMote(base.Position, base.Map, ThingDefOf.Mote_ShotFlash, 9f);
                GenExplosion.DoExplosion(base.Position, base.Map, 1.5f, DamageDefOf.Flame, (Thing)null, PlasmaDrill, (ThingDef)null);
                this.plasmaTick = 4;
            }
        }
Beispiel #7
0
        protected virtual void Impact(Thing hitThing)
        {
            bool flag = hitThing == null;

            if (flag)
            {
                Pawn pawn;
                bool flag2 = (pawn = (base.Position.GetThingList(base.Map).FirstOrDefault((Thing x) => x == this.assignedTarget) as Pawn)) != null;
                if (flag2)
                {
                    hitThing = pawn;
                }
            }

            GenExplosion.DoExplosion(base.Position, base.Map, this.radius, TMDamageDefOf.DamageDefOf.TM_DeathBolt, this.pawn, Mathf.RoundToInt((Rand.Range(.6f * this.def.projectile.GetDamageAmount(1, null), 1.1f * this.def.projectile.GetDamageAmount(1, null)) + (5f * pwrVal)) * this.arcaneDmg), 4, this.def.projectile.soundExplode, def, null, null, null, 0f, 1, false, null, 0f, 0, 0.0f, true);

            this.ticksFollowingImpact = this.verVal * 15;
            this.impacted             = true;
        }
 public static bool Prefix(SmokepopBelt __instance, DamageInfo dinfo)
 {
     if (!dinfo.Def.isExplosive &&
         dinfo.Def.harmsHealth &&
         dinfo.Def.ExternalViolenceFor(dinfo.IntendedTarget) &&
         dinfo.Weapon != null &&
         (dinfo.Weapon.IsRangedWeapon || dinfo.Weapon.projectile is ProjectilePropertiesCE))     // Add a check for CE projectiles since we're using them as weaponGear to pass data to our ArmorUtility
     {
         IntVec3   position   = __instance.Wearer.Position;
         Map       map        = __instance.Wearer.Map;
         float     statValue  = __instance.GetStatValue(StatDefOf.SmokepopBeltRadius, true);
         DamageDef smoke      = DamageDefOf.Smoke;
         Thing     instigator = null;
         ThingDef  gas_Smoke  = ThingDefOf.Gas_Smoke;
         GenExplosion.DoExplosion(position, map, statValue, smoke, instigator, -1, -1, null, null, gas_Smoke, null, null, 1f, 1, false, null, 0f, 1, 0f, false);
         __instance.Destroy(DestroyMode.Vanish);
     }
     return(false);
 }
Beispiel #9
0
 private void PodOpen()
 {
     foreach (Thing current in this.info.containedThings)
     {
         GenExplosion.DoExplosion(this.Position, this.Map, 1.5f, DamageDefOf.Bomb, null, null, null);
         GenPlace.TryPlaceThing(current, this.Position, this.Map, ThingPlaceMode.Near);
     }
     this.info.containedThings.Clear();
     if (this.info.leaveSlag)
     {
         for (int i = 0; i < 1; i++)
         {
             Thing thing = ThingMaker.MakeThing(ThingDef.Named("ChunkSlag"), null);
             GenPlace.TryPlaceThing(thing, base.Position, base.Map, ThingPlaceMode.Near);
         }
     }
     Meteor.OpenSound.PlayOneShot(new TargetInfo(this.Position, this.Map, false));
     GenExplosion.DoExplosion(base.Position, this.Map, 4f, DamageDefOf.Flame, null, null, null);
 }
Beispiel #10
0
        protected override void Impact(Thing hitThing)
        {
            if (hitThing != null && (bool)DuneEquipmentBase.LasgunInteraction && hitThing is Pawn hitPawn)
            {
                if (hitPawn.apparel != null)
                {
                    foreach (Apparel apparel in hitPawn.apparel.WornApparel)
                    {
                        var shield = apparel as ShieldBelt;
                        if (shield != null)
                        {
                            if (shield.ShieldState == ShieldState.Active)
                            {
                                int reps = 3;
                                //Log.Message("Lasgun/shield interaction, baby!");
                                IntVec3   position         = base.Position;
                                Map       map              = base.Map;
                                float     explosionRadius  = 50.0f;
                                DamageDef bomb             = DamageDefOf.Bomb;
                                Thing     launcher         = this.launcher;
                                int       damageAmount     = 2000;
                                float     armorPenetration = 20.0f;
                                SoundDef  explosionSound   = null;
                                ThingDef  equipmentDef     = this.equipmentDef;
                                ThingDef  def              = this.def;
                                ThingDef  filth_Fuel       = ThingDefOf.Filth_Fuel;
                                for (int i = 0; i < reps; i++)
                                {
                                    GenExplosion.DoExplosion(position, map, explosionRadius, bomb, launcher, damageAmount, armorPenetration, explosionSound, equipmentDef, def, this.intendedTarget.Thing, filth_Fuel, 0.2f, 1, false, null, 0f, 1, 0.4f, false, null, null);
                                }
                                position = launcher.Position;
                                for (int i = 0; i < reps; i++)
                                {
                                    GenExplosion.DoExplosion(position, map, explosionRadius, bomb, launcher, damageAmount, armorPenetration, explosionSound, equipmentDef, def, this.intendedTarget.Thing, filth_Fuel, 0.2f, 1, false, null, 0f, 1, 0.4f, false, null, null);
                                }
                            }
                        }
                    }
                }
            }

            base.Impact(hitThing);
        }
Beispiel #11
0
        public void Explosion()
        {
            Map map2 = EquipmentSource.Map;

            GenExplosion.DoExplosion
            (
                center: currentTarget.Thing.Position,
                map: CasterPawn.Map,
                radius: 2f,
                damType: RatkinDamageDefOf.DemoBomb,
                instigator: EquipmentSource,
                damAmount: 15,
                armorPenetration: 0.60f,
                explosionSound: null,
                weapon: EquipmentSource.def,
                projectile: null,
                intendedTarget: currentTarget.Thing,
                chanceToStartFire: 0,
                damageFalloff: true
            );
            if (CasterPawn != null && CasterPawn.inventory != null)
            {
                Thing magicWand = CasterPawn.inventory.innerContainer.FirstOrDefault((Thing t) => t != null && t.def == RatkinWeaponDefOf.RK_MagicWand);
                if (magicWand != null)
                {
                    magicWand.stackCount -= 1;
                    if (magicWand.stackCount <= 0)
                    {
                        CasterPawn.inventory.innerContainer.Remove(magicWand);
                        CasterPawn.inventory.Notify_ItemRemoved(magicWand);
                        magicWand.Destroy(DestroyMode.Vanish);
                    }
                }
                else
                {
                    if (EquipmentSource != null && !EquipmentSource.Destroyed)
                    {
                        EquipmentSource.Destroy(DestroyMode.Vanish);
                    }
                }
            }
        }
        public override void PawnDied(Corpse corpse)
        {
            float radius;

            if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 0)
            {
                radius = 3.8f;
            }
            else if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 1)
            {
                radius = 5.8f;
            }
            else
            {
                radius = 9.8f;
            }
            ThingDef filthFireFoam = ThingDefOf.FilthFireFoam;

            GenExplosion.DoExplosion(corpse.Position, corpse.Map, radius, DamageDefOf.Extinguish, corpse.InnerPawn, null, null, null, filthFireFoam, 1f, 2, true, null, 0f, 1);
        }
        public override void PawnDied(Corpse corpse)
        {
            float radius;
            if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 0)
            {
                radius = 1.9f;
            }
            else if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 1)
            {
                radius = 1.9f;
            }
            else
            {
                radius = 1.9f;
            }



            GenExplosion.DoExplosion(corpse.Position, corpse.Map, radius, Named("GR_HairballExplosion"), corpse.InnerPawn, 1, -1, SoundDef.Named("Explosion_Bomb"), null, null, null, ThingDef.Named("GR_Hairballs"), 1f, 1, false, null, 0f, 1);
        }
Beispiel #14
0
        protected virtual void Explode()
        {
            this.Destroy(DestroyMode.Vanish);
            GenExplosion.DoExplosion(base.Position, Map, this.def.projectile.explosionRadius,
                                     this.def.projectile.damageDef, this.launcher, -1, this.def.projectile.soundExplode, this.def,
                                     this.equipmentDef, this.def.projectile.postExplosionSpawnThingDef,
                                     this.def.projectile.postExplosionSpawnChance, 0, false, null, 0, 0);

            for (int i = 0; i < 4; i++)
            {
                ThrowSmokeBlue(
                    Position.ToVector3Shifted() +
                    Gen.RandomHorizontalVector(this.def.projectile.explosionRadius * 0.7f), Map,
                    this.def.projectile.explosionRadius * 0.6f);

                ThrowMicroSparksBlue(
                    Position.ToVector3Shifted() +
                    Gen.RandomHorizontalVector(this.def.projectile.explosionRadius * 0.7f), Map);
            }
        }
        public override void PawnDied(Corpse corpse)
        {
            float radius;

            if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 0)
            {
                radius = 3.8f;
            }
            else if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 1)
            {
                radius = 5.8f;
            }
            else
            {
                radius = 9.8f;
            }
            ThingDef gas_Smoke = ThingDefOf.Gas_Smoke;

            GenExplosion.DoExplosion(corpse.Position, corpse.Map, radius, DamageDefOf.Smoke, corpse.InnerPawn, null, null, null, gas_Smoke, 1f, 1, false, null, 0f, 1);
        }
        private static void ShortCircuit(Thing hitThing)
        {
            if (hitThing == null)
            {
                throw new NullReferenceException("hitThing");
            }

            GenExplosion.DoExplosion(hitThing.Position, Rand.Range(1f, 3f), DamageDefOf.Flame, hitThing);
            if (hitThing != null)
            {
                hitThing.TryAttachFire(0.2f);
            }
            MoteThrower.ThrowStatic(hitThing.Position, ThingDefOf.Mote_ShotFlash, 6);
            MoteThrower.ThrowMicroSparks(hitThing.Position.ToVector3Shifted());

            if (!hitThing.Destroyed)
            {
                hitThing.TakeDamage(new DamageInfo(DamageDefOf.Stun, Rand.Range(150, 500), hitThing, null));
            }
        }
        public static bool Explode(Projectile_Explosive __instance)
        {
            Map map = __instance.Map;

            __instance.Destroy();
            if (__instance.def.projectile.explosionEffect != null)
            {
                Effecter effecter = __instance.def.projectile.explosionEffect.Spawn();
                effecter.Trigger(new TargetInfo(__instance.Position, map), new TargetInfo(__instance.Position, map));
                effecter.Cleanup();
            }

            GenExplosion.DoExplosion(__instance.Position, map, __instance.def.projectile.explosionRadius, __instance.def.projectile.damageDef, Projectile_Patch.launcher(__instance), __instance.DamageAmount,
                                     __instance.ArmorPenetration, __instance.def.projectile.soundExplode, Projectile_Patch.equipmentDef(__instance), __instance.def, __instance.intendedTarget.Thing, __instance.def.projectile.postExplosionSpawnThingDef,
                                     __instance.def.projectile.postExplosionSpawnChance, __instance.def.projectile.postExplosionSpawnThingCount, preExplosionSpawnThingDef: __instance.def.projectile.preExplosionSpawnThingDef,
                                     preExplosionSpawnChance: __instance.def.projectile.preExplosionSpawnChance, preExplosionSpawnThingCount: __instance.def.projectile.preExplosionSpawnThingCount,
                                     applyDamageToExplosionCellsNeighbors: __instance.def.projectile.applyDamageToExplosionCellsNeighbors, chanceToStartFire: __instance.def.projectile.explosionChanceToStartFire,
                                     damageFalloff: __instance.def.projectile.explosionDamageFalloff, direction: Projectile_Patch.origin(__instance).AngleToFlat(Projectile_Patch.destination(__instance)));
            return(false);
        }
        public static bool Impact(Projectile_DoomsdayRocket __instance, Thing hitThing)
        {
            Map map = __instance.Map;

            Projectile_Patch.Base_Impact(__instance, hitThing);
            GenExplosion.DoExplosion(__instance.Position, map, __instance.def.projectile.explosionRadius, DamageDefOf.Bomb, Projectile_Patch.launcher(__instance), __instance.DamageAmount,
                                     __instance.ArmorPenetration, null, Projectile_Patch.equipmentDef(__instance), __instance.def, postExplosionSpawnThingDef: ThingDefOf.Filth_Fuel,
                                     intendedTarget: __instance.intendedTarget.Thing,
                                     postExplosionSpawnChance: 0.2f, postExplosionSpawnThingCount: 1, applyDamageToExplosionCellsNeighbors: false, preExplosionSpawnThingDef: null,
                                     preExplosionSpawnChance: 0f, preExplosionSpawnThingCount: 1, chanceToStartFire: 0.4f);
            CellRect cellRect = CellRect.CenteredOn(__instance.Position, 5);

            cellRect.ClipInsideMap(map);
            for (int i = 0; i < 3; i++)
            {
                IntVec3 randomCell = cellRect.RandomCell;
                DoFireExplosion(__instance, randomCell, map, 3.9f);
            }
            return(false);
        }
Beispiel #19
0
        public void DoEmpIncident(Thing thing)
        {
            if (operableNextTick < Find.TickManager.TicksGame)
            {
                operableNextTick = Find.TickManager.TicksGame + 60000;
                Find.LetterStack.ReceiveLetter("EMPExplode".Translate(), "EMPExplodeDesc".Translate(), LetterDefOf.ThreatBig);
                StorytellerComp storytellerComp = Find.Storyteller.storytellerComps.First((StorytellerComp x) => x is StorytellerComp_OnOffCycle || x is StorytellerComp_RandomMain);
                IncidentParms   parms           = storytellerComp.GenerateParms(IncidentCategoryDefOf.ThreatBig, Find.CurrentMap);
                //Log.Message("parms.storytellerComp: " + parms.points);
                parms.faction      = Find.FactionManager.FirstFactionOfDef(RatkinFactionDefOf.Rakinia);
                parms.points      *= 0.4f;
                parms.raidStrategy = DefDatabase <RaidStrategyDef> .GetNamed("ImmediateAttackSappers");

                //DefDatabase<RaidStrategyDef>.AllDefs.Where((RaidStrategyDef r) => r.Worker.CanUseWith(parms, PawnGroupKindDefOf.Combat)).TryRandomElement(out parms.raidStrategy);
                parms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeWalkIn;
                //DefDatabase<PawnsArrivalModeDef>.AllDefs.Where((PawnsArrivalModeDef p) => p.Worker.CanUseWith(parms)).TryRandomElement(out parms.raidArrivalMode);
                RatkinIncidentDefOf.RatkinFollowUpTroops.Worker.TryExecute(parms);
                GenExplosion.DoExplosion(thing.Position, thing.Map, 15, RatkinDamageDefOf.RK_EMP, thing);
            }
        }
 // Token: 0x06000013 RID: 19 RVA: 0x000027C8 File Offset: 0x000009C8
 public void ThrowBolt(IntVec3 strikeZone, Pawn victim)
 {
     if (!this.thrown)
     {
         this.thrown    = true;
         this.strikeLoc = strikeZone;
         SoundDefOf.Thunder_OffMap.PlayOneShotOnCamera(null);
         this.boltMesh = LightningBoltMeshPool.RandomBoltMesh;
         GenExplosion.DoExplosion(this.strikeLoc, victim.Map, 2f, DamageDefOf.RedFire, null, -1, -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false);
         Vector3 loc = this.strikeLoc.ToVector3Shifted();
         for (int i = 0; i < 4; i++)
         {
             MoteMaker.ThrowHumanSmoke(loc, victim.Map, 1.5f);
             MoteMaker.ThrowHumanMicroSparks(loc, victim.Map);
             MoteMaker.ThrowHumanLightningGlow(loc, victim.Map, 15.5f);
         }
         SoundInfo info = SoundInfo.InMap(new TargetInfo(this.strikeLoc, victim.Map, false), MaintenanceType.None);
         SoundDefOf.Thunder_OnMap.PlayOneShot(info);
     }
 }
 public void BurnBloodAtCell()
 {
     for (int i = 0; i < this.BF.Count; i++)
     {
         List <Thing> thingList = this.BF[i].position.GetThingList(this.Map);
         for (int j = 0; j < thingList.Count; j++)
         {
             if (thingList[j] != null && this.bloodTypes.Contains(thingList[j].def))
             {
                 thingList[j].Destroy(DestroyMode.Vanish);
             }
         }
         this.BF[i] = new BloodFire(this.BF[i].position, this.BF[i].pulseCount + 1);
         GenExplosion.DoExplosion(this.BF[i].position, this.Map, .2f + (.4f * BF[i].pulseCount), TMDamageDefOf.DamageDefOf.TM_BloodBurn, this.launcher, Mathf.RoundToInt((Rand.Range(2.8f, 4.5f) * (1 + (.12f * pwrVal))) * this.arcaneDmg), .5f, TorannMagicDefOf.TM_FireWooshSD, null, null, null, null, 0f, 1, false, null, 0f, 1, 0.0f, false);
         if (this.BF[i].pulseCount >= 3)
         {
             this.BF.Remove(this.BF[i]);
         }
     }
 }
Beispiel #22
0
 public override void Tick()
 {
     base.Tick();
     //BackstoryCracker.TestforIncorrectChildhood();
     if (ticksToExplode > 0)
     {
         if (wickSustainer == null)
         {
             StartWickSustainer();
         }
         else
         {
             wickSustainer.Maintain();
         }
         ticksToExplode--;
         if (ticksToExplode == 0)
         {
             IntVec3 randomCell = this.OccupiedRect().RandomCell;
             float   radius     = Rand.Range(0.5f, 1f) * 3f * 1.7320508075688772935274463415059f;
             GenExplosion.DoExplosion(randomCell, Map, radius, DamageDefOf.Flame,
                                      instigator: null,
                                      damAmount: -1,
                                      armorPenetration: -1f,
                                      explosionSound: null,
                                      weapon: null,
                                      projectile: null,
                                      intendedTarget: null,
                                      postExplosionSpawnThingDef: null,
                                      postExplosionSpawnChance: 0f,
                                      postExplosionSpawnThingCount: 1,
                                      applyDamageToExplosionCellsNeighbors: false,
                                      preExplosionSpawnThingDef: null,
                                      preExplosionSpawnChance: 0f,
                                      preExplosionSpawnThingCount: 1,
                                      chanceToStartFire: 0f,
                                      damageFalloff: false
                                      );
             GetComp <CompPowerBattery>().DrawPower(EnergyToLoseWhenExplode);
         }
     }
 }
Beispiel #23
0
        private void PodImpact()
        {
            for (int i = 0; i < 6; i++)
            {
                Vector3 spawnLoc = base.Position.ToVector3Shifted() + Gen.RandomHorizontalVector(1f);
                MoteMaker.ThrowDustPuff(spawnLoc, this.Map, 1.2f);
            }
            MoteMaker.ThrowLightningGlow(base.Position.ToVector3Shifted(), this.Map, 2f);
            MoteMaker.ThrowSmoke(base.Position.ToVector3Shifted(), this.Map, 1f);

            MeteorIncoming.ExplodeSound.PlayOneShot(new TargetInfo(base.Position, base.Map, false));
            foreach (IntVec3 current in GenAdj.CellsAdjacent8Way(this))
            {
                MoteMaker.ThrowAirPuffUp(base.Position.ToVector3Shifted(), this.Map);
            }
            GenSpawn.Spawn(this.contents.SingleContainedThing, base.Position, this.Map, base.Rotation);
            if (this.contents.SingleContainedThing is AlienQueen queen)
            {
                queen.health.AddHediff(PurpleIvyDefOf.PI_CrashlandedDowned);
                queen.health.AddHediff(PurpleIvyDefOf.PI_Regen);
                queen.recoveryTick = Find.TickManager.TicksGame + new IntRange(80000, 140000).RandomInRange;
                queen.canGuard     = true;
            }
            else if (this.contents.SingleContainedThing is Building_Meteorite meteorite)
            {
                foreach (var dir in GenRadial.RadialCellsAround(meteorite.Position, 5, true))
                {
                    if (GenGrid.InBounds(dir, meteorite.Map))
                    {
                        Thing thing = ThingMaker.MakeThing(PurpleIvyDefOf.PI_Spores, null);
                        GenSpawn.Spawn(thing, dir, meteorite.Map, 0);
                        var Spores = (PurpleGas)thing;
                        Spores.destroyTick  = Find.TickManager.TicksGame + new IntRange(160000, 180000).RandomInRange;
                        Spores.activeDamage = true;
                        meteorite.spores.Add(Spores);
                    }
                }
            }
            GenExplosion.DoExplosion(base.Position, this.Map, 5f, DamageDefOf.Bomb, this);
            this.Destroy(DestroyMode.Vanish);
        }
Beispiel #24
0
        public override void Impact()
        {
            if (Payload != null)
            {
                if (Payload.projectile.explosionDelay == 0)
                {
                    this.Explode();
                    return;
                }
                this.landed            = true;
                this.ticksToDetonation = Payload.projectile.explosionDelay;
                GenExplosion.NotifyNearbyPawnsOfDangerousExplosive(this, Payload.projectile.damageDef, this.launcher.Faction);
            }
            else
            if (this.def.skyfaller.CausesExplosion)
            {
                //	Log.Message("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);
        }
Beispiel #25
0
        protected override void Impact(Thing hitThing)
        {
            Map map = base.Map;

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

            ModOptions.SettingsRef settingsRef = new ModOptions.SettingsRef();

            Pawn pawn   = this.launcher as Pawn;
            Pawn victim = hitThing as Pawn;

            if (pawn != null)
            {
                CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>();
                MagicPowerSkill      pwr  = pawn.GetComp <CompAbilityUserMagic>().MagicData.MagicPowerSkill_Firebolt.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_Firebolt_pwr");
                pwrVal    = pwr.level;
                arcaneDmg = comp.arcaneDmg;
                if (pawn.story.traits.HasTrait(TorannMagicDefOf.Faceless))
                {
                    MightPowerSkill mpwr = pawn.GetComp <CompAbilityUserMight>().MightData.MightPowerSkill_Mimic.FirstOrDefault((MightPowerSkill x) => x.label == "TM_Mimic_pwr");
                    pwrVal = mpwr.level;
                }
            }

            GenExplosion.DoExplosion(base.Position, map, 0.4f, TMDamageDefOf.DamageDefOf.Firebolt, this.launcher, Mathf.RoundToInt(this.def.projectile.GetDamageAmount(1, null) * arcaneDmg), 0, this.def.projectile.soundExplode, def, this.equipmentDef, this.intendedTarget.Thing, null, 0f, 1, false, null, 0f, 1, 0.6f, false);
            CellRect cellRect = CellRect.CenteredOn(base.Position, 3);

            cellRect.ClipInsideMap(map);

            victim = base.Position.GetFirstPawn(map);
            if (victim != null)
            {
                int dmg = Mathf.RoundToInt(this.def.projectile.GetDamageAmount(1, null) / 3 * pwrVal * arcaneDmg);  //projectile = 16
                if (settingsRef.AIHardMode && this.launcher is Pawn && !pawn.IsColonist)
                {
                    dmg += 10;
                }
                damageEntities(victim, dmg, TMDamageDefOf.DamageDefOf.Firebolt);
            }
        }
        public override void Event_Projectile_Impact(RuneComp rune, Projectile projectile, Thing hitThing, Thing launcher, Thing weapon)
        {
            //Log.Message("launcher: " + launcher.ToString());
            int   finalDamage = damageAmount;
            float finalRadius = radius;

            if (scaleToDamage != 0)
            {
                float damageScale = (float)projectile.def.projectile.GetDamageAmount(weapon) / (float)scaleToDamage;
                if (maximumScalingFactor != -1f && damageScale > maximumScalingFactor)
                {
                    damageScale = maximumScalingFactor;
                }

                finalDamage = (int)Math.Ceiling(damageAmount * damageScale);
                finalRadius = (float)Math.Ceiling(finalRadius * damageScale);
            }

            GenExplosion.DoExplosion(projectile.Position, launcher.Map, finalRadius, damageDef, launcher,
                                     damAmount: finalDamage);
        }
        public static bool TryShortCircuitInRain(Thing thing)
        {
            CompPowerTrader compPowerTrader = thing.TryGetComp <CompPowerTrader>();

            if ((compPowerTrader != null && compPowerTrader.PowerOn && compPowerTrader.Props.shortCircuitInRain) || (thing.TryGetComp <CompPowerBattery>() != null && thing.TryGetComp <CompPowerBattery>().StoredEnergy > 100f))
            {
                string     text   = "ShortCircuitRain".Translate(thing.Label, thing);
                TargetInfo target = new TargetInfo(thing.Position, thing.Map, false);
                if (thing.Faction == Faction.OfPlayer)
                {
                    Find.LetterStack.ReceiveLetter("LetterLabelShortCircuit".Translate(), text, LetterDefOf.NegativeEvent, target, null, null);
                }
                else
                {
                    Messages.Message(text, target, MessageTypeDefOf.NeutralEvent, true);
                }
                GenExplosion.DoExplosion(thing.OccupiedRect().RandomCell, thing.Map, 1.9f, DamageDefOf.Flame, null, -1, -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false);
                return(true);
            }
            return(false);
        }
 public override void Tick()
 {
     base.Tick();
     if (ticksToExplode > 0)
     {
         if (wickSustainer == null)
         {
             StartWickSustainer();
         }
         else
         {
             wickSustainer.Maintain();
         }
         ticksToExplode--;
         if (ticksToExplode == 0)
         {
             GenExplosion.DoExplosion(this.OccupiedRect().RandomCell, radius: Rand.Range(0.5f, 1f) * 3f, map: base.Map, damType: DamageDefOf.Flame, instigator: null);
             GetComp <CompPowerBattery>().DrawPower(400f);
         }
     }
 }
Beispiel #29
0
 protected void Detonate()
 {
     if (this.detonated)
     {
         return;
     }
     this.detonated = true;
     if (!this.parent.Destroyed)
     {
         this.parent.Destroy(DestroyMode.Vanish);
     }
     GenExplosion.DoExplosion(this.parent.Position, 5, this.props.explosiveDamageType, (Thing)this.parent, Null1, (ThingDef)null);
     GenExplosion.DoExplosion(this.parent.Position, 6, this.props.explosiveDamageType, (Thing)this.parent, Null1, (ThingDef)null);
     GenExplosion.DoExplosion(this.parent.Position, 8, this.props.explosiveDamageType, (Thing)this.parent, Null1, (ThingDef)null);
     GenExplosion.DoExplosion(this.parent.Position, 11, this.props.explosiveDamageType, (Thing)this.parent, Null1, (ThingDef)null);
     GenExplosion.DoExplosion(this.parent.Position, 14, this.props.explosiveDamageType, (Thing)this.parent, Null1, (ThingDef)null);
     GenExplosion.DoExplosion(this.parent.Position, 17, this.props.explosiveDamageType, (Thing)this.parent, Null1, (ThingDef)null);
     GenExplosion.DoExplosion(this.parent.Position, 20, this.props.explosiveDamageType, (Thing)this.parent, Null1, (ThingDef)null);
     GenExplosion.DoExplosion(this.parent.Position, 23, DamageDefOf.Flame, (Thing)this.parent, Null1, (ThingDef)null);
     SoundStarter.PlayOneShot(CompExplosiveNuke.NukeExplosion, (SoundInfo)this.parent.Position);
 }
        public override void PawnDied(Corpse corpse)
        {
            float radius;

            if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 0)
            {
                radius = 1.9f;
            }
            else if (corpse.InnerPawn.ageTracker.CurLifeStageIndex == 1)
            {
                radius = 2.9f;
            }
            else
            {
                radius = 3.9f;
            }



            GenExplosion.DoExplosion(corpse.Position, corpse.Map, radius, InternalDefOf.GR_Acid, corpse.InnerPawn, 10, -1, InternalDefOf.GR_Pop, null, null, null, ThingDef.Named("Filth_Fuel"), 0.3f, 1, false, null, 0f, 1);
        }