Exemplo n.º 1
0
        private void AffectCell(IntVec3 c)
        {
            bool flag2 = !GenGrid.InBounds(c, base.Map);

            if (!flag2)
            {
                bool flag  = this.ShouldCellBeAffectedOnlyByDamage(c);
                bool flag3 = !flag && Rand.Chance(this.preExplosionSpawnChance) && GenGrid.Walkable(c, base.Map);
                if (flag3)
                {
                    this.TrySpawnExplosionThing(this.preExplosionSpawnThingDef, c, this.preExplosionSpawnThingCount);
                }
                this.damType.Worker.ExplosionAffectCell(this, c, this.damagedThings, this.ignoredThings, !flag);
                bool flag4 = !flag && Rand.Chance(this.postExplosionSpawnChance) && GenGrid.Walkable(c, base.Map);
                if (flag4)
                {
                    this.TrySpawnExplosionThing(this.postExplosionSpawnThingDef, c, this.postExplosionSpawnThingCount);
                }
                float num           = this.chanceToStartFire;
                bool  damageFalloff = this.damageFalloff;
                if (damageFalloff)
                {
                    num *= Mathf.Lerp(1f, 0.2f, IntVec3Utility.DistanceTo(c, base.Position) / this.radius);
                }
                bool flag5 = Rand.Chance(num);
                if (flag5)
                {
                    FireUtility.TryStartFireIn(c, base.Map, Rand.Range(0.1f, 0.925f));
                }
            }
        }
Exemplo n.º 2
0
        // Token: 0x06000053 RID: 83 RVA: 0x00004800 File Offset: 0x00002A00
        public void JPIgnite(IntVec3 cell, Map map)
        {
            var pilot = GetThingForGraphic();

            if (pilot == null)
            {
                return;
            }

            var JP = JPUtility.GetWornJP(pilot);

            if (JP == null)
            {
                return;
            }

            var jetPackApparel = JP as JetPackApparel;
            var fuel           = jetPackApparel?.JPFuelItem;

            if (fuel == null)
            {
                return;
            }

            var factor = JPUtility.GetIgnitionFactor(fuel);
            var Rnd    = Rand.Range(1, 100);

            if (Rnd < factor)
            {
                FireUtility.TryStartFireIn(cell, map, Math.Max(10f, factor - Rnd) / 100f);
            }
        }
Exemplo n.º 3
0
        protected void StartRandomFireAndDoFlameDamage()
        {
            float   effectRange = Beam != null ? Beam.Props.width * 2 : 15f;
            IntVec3 c           = (from x in GenRadial.RadialCellsAround(EffectLoc, effectRange, true)
                                   where x.InBounds(base.Map)
                                   select x).RandomElementByWeight((IntVec3 x) => 1f - Mathf.Min(x.DistanceTo(EffectLoc) / effectRange, 1f) + 0.05f);

            if (base.HitRoof(c))
            {
                return;
            }
            FireUtility.TryStartFireIn(c, base.Map, Rand.Range(0.1f, 0.925f));
            OrbitalBeam.tmpThings.Clear();
            OrbitalBeam.tmpThings.AddRange(c.GetThingList(base.Map));
            for (int i = 0; i < OrbitalBeam.tmpThings.Count; i++)
            {
                int  num  = (OrbitalBeam.tmpThings[i] is Corpse) ? OrbitalBeam.CorpseFlameDamageAmountRange.RandomInRange : OrbitalBeam.FlameDamageAmountRange.RandomInRange;
                Pawn pawn = OrbitalBeam.tmpThings[i] as Pawn;
                BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null;
                if (pawn != null)
                {
                    battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_PowerBeam, this.instigator as Pawn);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                }
                OrbitalBeam.tmpThings[i].TakeDamage(new DamageInfo(strikeDef.ordnance.projectile.damageDef, (float)num, strikeDef.ordnance.projectile.GetArmorPenetration(this), -1f, this.instigator, null, this.weaponDef, DamageInfo.SourceCategory.ThingOrUnknown, null)).AssociateWithLog(battleLogEntry_DamageTaken);
            }
            OrbitalBeam.tmpThings.Clear();
        }
Exemplo n.º 4
0
        public void SunfireDamage(IntVec3 c)
        {
            List <Thing> tList      = c.GetThingList(this.Map);
            float        baseDamage = 4f * lightPotency * this.arcaneDmg;

            for (int i = 0; i < tList.Count; i++)
            {
                if (tList[i] is Pawn)
                {
                    Pawn           p   = tList[i] as Pawn;
                    BodyPartRecord bpr = p.health.hediffSet.GetRandomNotMissingPart(TMDamageDefOf.DamageDefOf.TM_BurningLight, BodyPartHeight.Undefined, BodyPartDepth.Outside);
                    if (bpr != null)
                    {
                        TM_Action.DamageEntities(tList[i], bpr, baseDamage + pwrVal, .1f * pwrVal, TMDamageDefOf.DamageDefOf.TM_BurningLight, caster);
                    }
                }
                if (tList[i] is Building)
                {
                    TM_Action.DamageEntities(tList[i], null, 4 * (baseDamage + pwrVal), TMDamageDefOf.DamageDefOf.TM_BurningLight, caster);
                }
                if (Rand.Chance(.02f))
                {
                    if (FireUtility.CanEverAttachFire(tList[i]))
                    {
                        FireUtility.TryAttachFire(tList[i], .2f);
                    }
                    else
                    {
                        FireUtility.TryStartFireIn(c, this.Map, .2f);
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void AffectCell(IntVec3 c)
        {
            if (!c.InBounds(base.Map))
            {
                return;
            }
            var flag      = ShouldCellBeAffectedOnlyByDamage(c);
            var spawnMote = c.GetFirstThing(Map, damType.explosionCellMote) == null;

            if (!flag && Rand.Chance(preExplosionSpawnChance) && c.Walkable(Map))
            {
                TrySpawnExplosionThing(preExplosionSpawnThingDef, c, preExplosionSpawnThingCount);
            }
            damType.Worker.ExplosionAffectCell(this, c, damagedThings, null, spawnMote && !flag);
            if (!flag && Rand.Chance(postExplosionSpawnChance) && c.Walkable(Map))
            {
                TrySpawnExplosionThing(postExplosionSpawnThingDef, c, postExplosionSpawnThingCount);
            }
            var num = chanceToStartFire;

            if (damageFalloff)
            {
                num *= Mathf.Lerp(1f, (float)DamageAtEdge / damAmount, c.DistanceTo(Position) / radius);
            }
            if (Rand.Chance(num))
            {
                FireUtility.TryStartFireIn(c, Map, Rand.Range(0.1f, 0.925f));
            }
            //ExplosionCE (this) can be Destroyed after ExplosionAffectCell
        }
Exemplo n.º 6
0
        private static void AffectCell(Explosion __instance, IntVec3 c)
        {
            if (!c.InBounds(__instance.Map))
            {
                return;
            }
            bool flag = ShouldCellBeAffectedOnlyByDamage(__instance, c);

            if (!flag && Rand.Chance(__instance.preExplosionSpawnChance) && c.Walkable(__instance.Map))
            {
                TrySpawnExplosionThing(__instance, __instance.preExplosionSpawnThingDef, c, __instance.preExplosionSpawnThingCount);
            }
            if (null != __instance.damType)
            {
                __instance.damType.Worker.ExplosionAffectCell(__instance, c, damagedThings(__instance), ignoredThingsFR(__instance), !flag);
            }
            if (!flag && Rand.Chance(__instance.postExplosionSpawnChance) && c.Walkable(__instance.Map))
            {
                TrySpawnExplosionThing(__instance, __instance.postExplosionSpawnThingDef, c, __instance.postExplosionSpawnThingCount);
            }
            float num = __instance.chanceToStartFire;

            if (__instance.damageFalloff)
            {
                num *= Mathf.Lerp(1f, 0.2f, c.DistanceTo(__instance.Position) / __instance.radius);
            }
            if (Rand.Chance(num))
            {
                FireUtility.TryStartFireIn(c, __instance.Map, Rand.Range(0.1f, 0.925f));
            }
        }
Exemplo n.º 7
0
        private void DoFailure()
        {
            if (CustomProps.failureEffecter != null)
            {
                CustomProps.failureEffecter.Spawn().Trigger(new TargetInfo(Position, Map), null);
            }
            var map = Map;

            Destroy(DestroyMode.KillFinalize);
            // try spawn fire in own or adjacent cell
            var adjacents = GenAdj.CardinalDirections.ToList();

            adjacents.Shuffle();
            adjacents.Add(IntVec3.Zero);             // include own tile
            adjacents.Reverse();
            Fire created = null;

            foreach (var adjacent in adjacents)
            {
                var candidatePos = adjacent + Position;
                FireUtility.TryStartFireIn(candidatePos, map, Rand.Range(.4f, .6f));
                created = map.thingGrid.ThingAt <Fire>(candidatePos);
                if (created != null)
                {
                    break;
                }
            }
            Alert_DetonatorWireFailure.Instance.ReportFailue(created);
        }
Exemplo n.º 8
0
        private void OnNewPawnDetected(Pawn pawn)
        {
            if (Growth < CustomDef.minimumIgnitePlantGrowth)
            {
                return;
            }
            var doEffects = false;

            if (Rand.Range(0f, 1f) < CustomDef.ignitePlantChance)
            {
                FireUtility.TryStartFireIn(Position, Map, Rand.Range(0.15f, 0.4f));
                doEffects = true;
            }
            if (Rand.Range(0f, 1f) < CustomDef.ignitePawnChance)
            {
                pawn.TryAttachFire(Rand.Range(0.15f, 0.25f));
                doEffects = true;
            }
            if (doEffects)
            {
                if (CustomDef.igniteEffecter != null)
                {
                    CustomDef.igniteEffecter.Spawn().Trigger(this, pawn);
                }
            }
        }
Exemplo n.º 9
0
        private Toil Ignite(Thing target)
        {
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                Pawn feenix = pawn;
                if (target.FlammableNow && !target.IsBurning())
                {
                    if (target.CanEverAttachFire())
                    {
                        target.TryAttachFire(1f);
                    }
                    else
                    {
                        FireUtility.TryStartFireIn(target.Position, target.Map, 1f);
                    }
                    PawnUtility.ForceWait(feenix, 250, target);
                }
                else
                {
                    return;
                }
            };
            toil.defaultCompleteMode = ToilCompleteMode.Delay;
            toil.defaultDuration     = 250;
            return(toil);
        }
Exemplo n.º 10
0
 private void AffectCell(IntVec3 c)
 {
     if (c.InBounds(base.Map))
     {
         bool flag = this.ShouldCellBeAffectedOnlyByDamage(c);
         if (!flag)
         {
             if (Rand.Chance(this.preExplosionSpawnChance) && c.Walkable(base.Map))
             {
                 this.TrySpawnExplosionThing(this.preExplosionSpawnThingDef, c, this.preExplosionSpawnThingCount);
             }
         }
         this.damType.Worker.ExplosionAffectCell(this, c, this.damagedThings, !flag);
         if (!flag)
         {
             if (Rand.Chance(this.postExplosionSpawnChance) && c.Walkable(base.Map))
             {
                 this.TrySpawnExplosionThing(this.postExplosionSpawnThingDef, c, this.postExplosionSpawnThingCount);
             }
         }
         float num = this.chanceToStartFire;
         if (this.damageFalloff)
         {
             num *= Mathf.Lerp(1f, 0.2f, c.DistanceTo(base.Position) / this.radius);
         }
         if (Rand.Chance(num))
         {
             FireUtility.TryStartFireIn(c, base.Map, Rand.Range(0.1f, 0.925f));
         }
     }
 }
Exemplo n.º 11
0
        private void EmptyBoilerContents()
        {
            if (!this.compRefuelable.HasFuel)
            {
                Messages.Message("Estate_EmptyFuelContentsNoFuel".Translate(), MessageTypeDefOf.RejectInput);
                return;
            }
            ThingDef thingDef = ThingDef.Named("Estate_Coal");
            float    num      = 1f;
            var      curFuel  = this.compRefuelable.Fuel;

            this.compRefuelable.Refuel(-this.compRefuelable.Fuel);
            int     i   = GenMath.RoundRandom(num * curFuel);
            IntVec3 loc = this.OccupiedRect().AdjacentCellsCardinal.RandomElement();

            while (i > 0)
            {
                Thing thing = ThingMaker.MakeThing(thingDef, null);
                thing.stackCount = Mathf.Min(i, thingDef.stackLimit);
                i  -= thing.stackCount;
                loc = this.OccupiedRect().AdjacentCellsCardinal.RandomElement();
                GenPlace.TryPlaceThing(thing, loc, this.MapHeld, ThingPlaceMode.Near, null);
            }
            if (CompSteam != null && CompSteam.TransmitsSteamNow)
            {
                //for (int i = 0; i < Rand.Range(1, 2); i++)
                FireUtility.TryStartFireIn(loc, MapHeld, Rand.Range(0.33f, 0.55f));
            }
        }
Exemplo n.º 12
0
 private void BurnCells(Map map)
 {
     if (burnRadius > 0 && VehicleMod.settings.main.burnRadiusOnRockets)
     {
         foreach (IntVec3 intVec in CellsToBurn(drawPos.ToIntVec3(), map, burnRadius, null, null))
         {
             Rand.PushState();
             float fireSize = Rand.Range(0.65f, 0.95f);
             if (map.terrainGrid.TerrainAt(intVec).Flammable())
             {
                 FireUtility.TryStartFireIn(intVec, map, fireSize);
             }
             foreach (Thing thing in map.thingGrid.ThingsAt(intVec))
             {
                 if (thing == vehicle)
                 {
                     continue;
                 }
                 if (thing.FlammableNow)
                 {
                     if (thing is Pawn pawn)
                     {
                         TakeFireDamage(pawn, fireSize);
                     }
                     FireUtility.TryStartFireIn(intVec, map, fireSize);
                 }
             }
             Rand.PopState();
         }
     }
 }
Exemplo n.º 13
0
 // ===================== Main function =====================
 public override void Tick()
 {
     // Check if a new building is cutting the laser fence.
     if (Find.TickManager.TicksGame >= this.nextBuildingCheckTick)
     {
         this.nextBuildingCheckTick = Find.TickManager.TicksGame + buildingCheckPeriodInTicks;
         if (this.Position.GetEdifice(this.Map) != null)
         {
             if (pylon != null)
             {
                 pylon.Notify_EdificeIsBlocking();
             }
         }
     }
     // Check if a plant or pawn is in the laser fence path.
     if (Find.TickManager.TicksGame >= this.nextPlantOrPawnCheckTick)
     {
         this.nextPlantOrPawnCheckTick = Find.TickManager.TicksGame + plantOrPawnCheckPeriodInTick;
         List <Thing> thingList = this.Position.GetThingList(this.Map);
         for (int thingIndex = thingList.Count - 1; thingIndex >= 0; thingIndex--)
         {
             Thing thing = thingList[thingIndex];
             if (thing is Plant)
             {
                 FireUtility.TryStartFireIn(this.Position, this.Map, 0.1f);
                 break;
             }
             if (thing is Pawn)
             {
                 FireUtility.TryAttachFire(thing, 0.1f);
                 break;
             }
         }
     }
 }
Exemplo n.º 14
0
        protected void StartRandomFireAndDoFlameDamage()
        {
            float   effectRange = beamWidth / 2 + 7f;
            IntVec3 effectLoc   = DrawPos.ToIntVec3();
            IntVec3 c           = (from x in GenRadial.RadialCellsAround(effectLoc, effectRange, true)
                                   where x.InBounds(base.Map)
                                   select x).RandomElementByWeight((IntVec3 x) => 1f - Mathf.Min(x.DistanceTo(effectLoc) / effectRange, 1f) + 0.05f);

            FireUtility.TryStartFireIn(c, base.Map, Rand.Range(0.1f, 0.925f));
            WarpRift.tmpThings.Clear();
            WarpRift.tmpThings.AddRange(c.GetThingList(base.Map));
            for (int i = 0; i < WarpRift.tmpThings.Count; i++)
            {
                int  num  = (WarpRift.tmpThings[i] is Corpse) ? WarpRift.CorpseFlameDamageAmountRange.RandomInRange : WarpRift.FlameDamageAmountRange.RandomInRange;
                Pawn pawn = WarpRift.tmpThings[i] as Pawn;
                BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null;
                if (pawn != null)
                {
                    battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_PowerBeam, this.instigator as Pawn);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                }
                WarpRift.tmpThings[i].TakeDamage(new DamageInfo(DamageDefOf.Flame, (float)num, 0, -1f, this.instigator, null, this.weaponDef, DamageInfo.SourceCategory.ThingOrUnknown, null)).AssociateWithLog(battleLogEntry_DamageTaken);
            }
            WarpRift.tmpThings.Clear();
        }
Exemplo n.º 15
0
        public static void TrySpread(IntVec3 srcPos, Map map)
        {
            IntVec3 position = srcPos;
            bool    flag;

            if (Rand.Chance(0.8f))
            {
                position = srcPos + GenRadial.ManualRadialPattern[Rand.RangeInclusive(1, 8)];
                flag     = true;
            }
            else
            {
                position = srcPos + GenRadial.ManualRadialPattern[Rand.RangeInclusive(10, 20)];
                flag     = false;
            }
            if (!position.InBounds(map) || !Rand.Chance(FireUtility.ChanceToStartFireIn(position, map)))
            {
                return;
            }
            if (!flag)
            {
                CellRect startRect = CellRect.SingleCell(srcPos);
                CellRect endRect   = CellRect.SingleCell(position);
                if (GenSight.LineOfSight(srcPos, position, map, startRect, endRect))
                {
                    ((Spark)GenSpawn.Spawn(ThingDefOf.Spark, srcPos, map)).Launch(null, position, position, ProjectileHitFlags.All);
                }
            }
            else
            {
                FireUtility.TryStartFireIn(position, map, 0.1f);
            }
        }
Exemplo n.º 16
0
        public static void TrySpread(Fire __instance)
        {
            IntVec3 position = __instance.Position;
            IntVec3 intVec3;
            bool    flag;

            if (Rand.Chance(0.8f))
            {
                intVec3 = __instance.Position + GenRadial.ManualRadialPattern[Rand.RangeInclusive(1, 8)];
                flag    = true;
            }
            else
            {
                intVec3 = __instance.Position + GenRadial.ManualRadialPattern[Rand.RangeInclusive(10, 20)];
                flag    = false;
            }
            if (!intVec3.InBounds(__instance.Map) || !Rand.Chance(FireUtility.ChanceToStartFireIn(intVec3, __instance.Map)))
            {
                return;
            }
            if (!flag)
            {
                CellRect startRect = CellRect.SingleCell(__instance.Position);
                CellRect endRect   = CellRect.SingleCell(intVec3);
                if (!GenSight.LineOfSight(__instance.Position, intVec3, __instance.Map, startRect, endRect, (Func <IntVec3, bool>)null))
                {
                    return;
                }
                ((Projectile)GenSpawn.Spawn(ThingDefOf.Spark, __instance.Position, __instance.Map, WipeMode.Vanish)).Launch((Thing)__instance, (LocalTargetInfo)intVec3, (LocalTargetInfo)intVec3, ProjectileHitFlags.All, (Thing)null);
            }
            else
            {
                FireUtility.TryStartFireIn(intVec3, __instance.Map, 0.1f);
            }
        }
Exemplo n.º 17
0
        protected override void Impact(Thing hitThing)
        {
            Map     map      = Map;
            IntVec3 position = Position;

            base.Impact(hitThing);

            if (Rand.Range(0, 1) <= SpawnProps.chanceToSpawnThing)
            {
                if (SpawnProps.thingToSpawn.defName == "Fire")
                {
                    float fireSize = Rand.Range(0.25f, 0.925f);
                    if (!FireUtility.TryStartFireIn(position, map, fireSize))
                    {
                        foreach (Thing thing in map.thingGrid.ThingsAt(position))
                        {
                            thing.TryAttachFire(fireSize);
                        }
                    }
                }
                else
                {
                    GenSpawn.Spawn(SpawnProps.thingToSpawn, position, map);
                }
            }
        }
Exemplo n.º 18
0
        private void DestroyTarget()
        {
            if (this.targetWillBeHit)
            {
                foreach (Thing thing in this.target.contents.containedThings)
                {
                    if (thing is Pawn)
                    {
                        // Spawn a dead copy of the pawn as the original one will be destroyed with the incoming drop pod.
                        Pawn pawn     = thing as Pawn;
                        Pawn pawnCopy = PawnGenerator.GeneratePawn(pawn.kindDef, pawn.Faction);
                        GenPlace.TryPlaceThing(pawnCopy, this.target.Position, ThingPlaceMode.Near);
                        if (pawnCopy.equipment.Primary != null)
                        {
                            pawnCopy.equipment.Primary.HitPoints = (int)(Rand.Range(0.05f, 0.30f) * pawnCopy.equipment.Primary.MaxHitPoints);
                        }
                        HealthUtility.GiveInjuriesToKill(pawnCopy);
                        // TODO: add tale. Destroyed drop pod.

                        /*TaleRecorder.RecordTale(TaleDef.Named("LandedInPod"), new object[]
                         * {
                         *  pawnCopy
                         * });*/
                        break;
                    }
                }
                for (int slagIndex = 0; slagIndex < 3; slagIndex++)
                {
                    GenPlace.TryPlaceThing(ThingMaker.MakeThing(ThingDefOf.ChunkSlagSteel), this.target.Position + new IntVec3(Rand.Range(-3, 3), 0, Rand.Range(-3, 3)), ThingPlaceMode.Near);
                }
                FireUtility.TryStartFireIn(this.target.Position + new IntVec3(Rand.Range(-3, 3), 0, Rand.Range(-3, 3)), 0.3f);
                this.target.Destroy(DestroyMode.Vanish);
            }
        }
Exemplo n.º 19
0
        // ######## Tick ######## //

        public override void Tick()
        {
            // Check if a new building is cutting the laser fence.
            if ((Find.TickManager.TicksGame % 30) == 0)
            {
                if (this.Position.GetEdifice() != null)
                {
                    if (pylon != null)
                    {
                        pylon.InformEdificeIsBlocking();
                    }
                }
            }
            // Check if a plant or pawn is in the laser fence path.
            if ((Find.TickManager.TicksGame % 200) == 0)
            {
                List <Thing> thingList = this.Position.GetThingList();
                for (int thingIndex = thingList.Count - 1; thingIndex >= 0; thingIndex--)
                {
                    Thing thing = thingList[thingIndex];
                    if (thing is Plant)
                    {
                        FireUtility.TryStartFireIn(this.Position, 0.1f);
                        break;
                    }
                    if (thing is Pawn)
                    {
                        FireUtility.TryAttachFire(thing, 0.1f);
                        break;
                    }
                }
            }
        }
Exemplo n.º 20
0
        public static bool Impact(Spark __instance, Thing hitThing)
        {
            Map map = __instance.Map;

            Projectile_Patch.Base_Impact(__instance, hitThing);
            FireUtility.TryStartFireIn(__instance.Position, map, 0.1f);
            return(false);
        }
Exemplo n.º 21
0
        private void StartRandomFire()
        {
            int num = OPBombDefGetValue.OPBombGetImpactRadius(this.def) + 2;

            FireUtility.TryStartFireIn((from x in GenRadial.RadialCellsAround(base.Position, (float)num, true)
                                        where x.InBounds(base.Map)
                                        select x).RandomElementByWeight((IntVec3 x) => OPBombardment.DistanceChanceFactor.Evaluate(x.DistanceTo(base.Position))), base.Map, Rand.Range(0.1f, 0.925f));
        }
Exemplo n.º 22
0
        private void StartRandomFire()
        {
            IntVec3 c = (from x in GenRadial.RadialCellsAround(base.Position, 25f, true)
                         where x.InBounds(base.Map)
                         select x).RandomElementByWeight((IntVec3 x) => LaserDrillVisual.DistanceChanceFactor.Evaluate(x.DistanceTo(base.Position)));

            FireUtility.TryStartFireIn(c, base.Map, Rand.Range(0.1f, 0.925f));
        }
Exemplo n.º 23
0
 public override void ExplosionAffectCell(Explosion explosion, IntVec3 c, List <Thing> damagedThings, bool canThrowMotes)
 {
     base.ExplosionAffectCell(explosion, c, damagedThings, canThrowMotes);
     if (def == DamageDefOf.Flame && c.IsValid && explosion.Map != null)
     {
         FireUtility.TryStartFireIn(c, explosion.Map, Rand.Range(0.2f, 0.6f));
     }
 }
Exemplo n.º 24
0
 public override void ExplosionAffectCell(Explosion explosion, IntVec3 c, List <Thing> damagedThings, bool canThrowMotes)
 {
     base.ExplosionAffectCell(explosion, c, damagedThings, canThrowMotes);
     if (ShouldCreateFire())
     {
         FireUtility.TryStartFireIn(c, explosion.Map, Rand.Range(0.2f, 0.6f));
     }
 }
Exemplo n.º 25
0
 public override void ExplosionAffectCell(Explosion explosion, IntVec3 c, List <Thing> damagedThings, bool canThrowMotes)
 {
     base.ExplosionAffectCell(explosion, c, damagedThings, canThrowMotes);
     if (this.def == DamageDefOf.Flame && Rand.Chance(FireUtility.ChanceToStartFireIn(c, explosion.Map)))
     {
         FireUtility.TryStartFireIn(c, explosion.Map, Rand.Range(0.2f, 0.6f));
     }
 }
Exemplo n.º 26
0
        public override void Tick()
        {
            base.Tick();

            if (Map != null)
            {
                FireUtility.TryStartFireIn(Position, Map, Rand.Range(0.4f, 0.8f));
            }
        }
        private void StartRandomFireAndDoFlameDamage(ThingDef OPBeamDef)
        {
            float EffRadius = OPBeamDefGetValue.OPBeamGetRadius(OPBeamDef);

            if (EffRadius < 1f)
            {
                EffRadius = 1f;
            }
            if (EffRadius > 15f)
            {
                EffRadius = 15f;
            }
            IntVec3 c = (from x in GenRadial.RadialCellsAround(base.Position, EffRadius, true)
                         where x.InBounds(this.Map)
                         select x).RandomElementByWeight((IntVec3 x) => 1f - Mathf.Min(x.DistanceTo(this.Position) / EffRadius, 1f) + 0.05f);

            FireUtility.TryStartFireIn(c, base.Map, Rand.Range(0.1f, 0.5f));
            OPPowerBeam.tmpThings.Clear();
            OPPowerBeam.tmpThings.AddRange(c.GetThingList(base.Map));
            for (int i = 0; i < OPPowerBeam.tmpThings.Count; i++)
            {
                int   num  = (!(OPPowerBeam.tmpThings[i] is Corpse)) ? OPPowerBeam.FlameDamageAmountRange.RandomInRange : OPPowerBeam.CorpseFlameDamageAmountRange.RandomInRange;
                float num2 = OPBeamDefGetValue.OPBeamGetDmgFact(OPBeamDef);
                if (num2 > 2f)
                {
                    num2 = 2f;
                }
                if (num2 < 0.1f)
                {
                    num2 = 0.1f;
                }
                num = (int)((float)num * num2);
                if (num < 1)
                {
                    num = 1;
                }
                if (num > 99)
                {
                    num = 99;
                }
                Pawn pawn = OPPowerBeam.tmpThings[i] as Pawn;
                BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null;
                if (pawn != null)
                {
                    battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_PowerBeam, this.instigator as Pawn);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                }
                Thing     thing      = OPPowerBeam.tmpThings[i];
                DamageDef flame      = DamageDefOf.Flame;
                float     num3       = (float)num;
                Thing     instigator = this.instigator;
                ThingDef  weaponDef  = this.weaponDef;
                thing.TakeDamage(new DamageInfo(flame, num3, 0f, -1f, instigator, null, weaponDef, DamageInfo.SourceCategory.ThingOrUnknown, null)).AssociateWithLog(battleLogEntry_DamageTaken);
            }
            OPPowerBeam.tmpThings.Clear();
        }
        // Token: 0x06000F42 RID: 3906 RVA: 0x00057D54 File Offset: 0x00055F54
        public override void ExplosionAffectCell(Explosion explosion, IntVec3 c, List <Thing> damagedThings, List <Thing> ignoredThings, bool canThrowMotes)
        {
            base.ExplosionAffectCell(explosion, c, damagedThings, ignoredThings, canThrowMotes);
            bool fire = this.def.defName.Contains("Fire") || this.def.defName.Contains("Flame");

            if (fire && Rand.Chance(FireUtility.ChanceToStartFireIn(c, explosion.Map)))
            {
                FireUtility.TryStartFireIn(c, explosion.Map, Rand.Range(0.2f, 0.6f));
            }
        }
Exemplo n.º 29
0
        private void StartRandomFire()
        {
            IntVec3 c;

            CellFinder.TryFindRandomCellNear(base.Position, base.Map, 40, null, out c, -1);

            if (c == null)
            {
                c = base.Position;
            }
            FireUtility.TryStartFireIn(c, base.Map, Rand.Range(0.2f, 0.925f));
        }
Exemplo n.º 30
0
 public override void Tick()
 {
     if(Position.GetThingList().Any(x => x.def == ThingDefOf.FilthFireFoam))
     {
         if (!Destroyed)
             Destroy();
     }
     else
     {
         FireUtility.TryStartFireIn(Position, maxFireSize);
     }
 }