Exemple #1
0
        // Token: 0x06002656 RID: 9814 RVA: 0x00123A60 File Offset: 0x00121E60
        public static bool TryStartWarpfireIn(IntVec3 c, Map map, float fireSize)
        {
            float num = WarpfireUtility.ChanceToStartWarpfireIn(c, map);

            if (num <= 0f)
            {
                return(false);
            }
            Warpfire fire = (Warpfire)ThingMaker.MakeThing(AdeptusThingDefOf.OG_Warpfire, null);

            fire.fireSize = fireSize;
            GenSpawn.Spawn(fire, c, map, Rot4.North, WipeMode.Vanish, false);
            return(true);
        }
Exemple #2
0
        // Token: 0x06002652 RID: 9810 RVA: 0x00123790 File Offset: 0x00121B90
        protected new void TrySpread()
        {
            IntVec3 intVec = base.Position;
            bool    flag;

            Rand.PushState();
            if (Rand.Chance(0.8f))
            {
                intVec = base.Position + GenRadial.ManualRadialPattern[Rand.RangeInclusive(1, 8)];
                flag   = true;
            }
            else
            {
                intVec = base.Position + GenRadial.ManualRadialPattern[Rand.RangeInclusive(10, 20)];
                flag   = false;
            }
            Rand.PopState();
            if (!intVec.InBounds(base.Map))
            {
                return;
            }
            Rand.PushState();
            bool startfire = Rand.Chance(WarpfireUtility.ChanceToStartWarpfireIn(intVec, base.Map));

            Rand.PopState();
            if (startfire)
            {
                if (!flag)
                {
                    CellRect startRect = CellRect.SingleCell(base.Position);
                    CellRect endRect   = CellRect.SingleCell(intVec);
                    if (!GenSight.LineOfSight(base.Position, intVec, base.Map, startRect, endRect, null))
                    {
                        return;
                    }
                    WarpSpark spark = (WarpSpark)GenSpawn.Spawn(AdeptusThingDefOf.OG_WarpSpark, base.Position, base.Map, WipeMode.Vanish);
                    spark.Launch(this, intVec, intVec, ProjectileHitFlags.All, null);
                }
                else
                {
                    WarpfireUtility.TryStartWarpfireIn(intVec, base.Map, 0.1f);
                }
            }
        }
Exemple #3
0
        protected void TrySpread()
        {
            IntVec3 intVec = base.Position;
            bool    flag;

            Rand.PushState();
            if (Rand.Chance(0.8f))
            {
                intVec = base.Position + GenRadial.ManualRadialPattern[Rand.RangeInclusive(1, 8)];
                flag   = true;
            }
            else
            {
                intVec = base.Position + GenRadial.ManualRadialPattern[Rand.RangeInclusive(10, 20)];
                flag   = false;
            }
            Rand.PopState();
            if (!intVec.InBounds(base.Map))
            {
                return;
            }

            float chance;

            if (this.def.projectile.damageDef == AdeptusDamageDefOf.OG_Chaos_Deamon_Warpfire)
            {
                chance = WarpfireUtility.ChanceToStartWarpfireIn(intVec, base.Map);
            }
            else
            {
                chance = FireUtility.ChanceToStartFireIn(intVec, base.Map);
            }

            Rand.PushState();
            bool f = Rand.Chance(chance);

            Rand.PopState();
            if (f)
            {
                if (!flag)
                {
                    CellRect startRect = CellRect.SingleCell(base.Position);
                    CellRect endRect   = CellRect.SingleCell(intVec);
                    if (!GenSight.LineOfSight(base.Position, intVec, base.Map, startRect, endRect, null))
                    {
                        return;
                    }
                    Spark spark;
                    if (this.def.projectile.damageDef == AdeptusDamageDefOf.OG_Chaos_Deamon_Warpfire)
                    {
                        spark = (Spark)GenSpawn.Spawn(AdeptusThingDefOf.OG_WarpSpark, base.Position, base.Map, WipeMode.Vanish);
                    }
                    else
                    {
                        spark = (Spark)GenSpawn.Spawn(ThingDefOf.Spark, base.Position, base.Map, WipeMode.Vanish);
                    }
                    spark.Launch(this, intVec, intVec, ProjectileHitFlags.All, false, null);
                }
                else
                {
                    if (this.def.projectile.damageDef == AdeptusDamageDefOf.OG_Chaos_Deamon_Warpfire)
                    {
                        WarpfireUtility.TryStartWarpfireIn(intVec, base.Map, 0.1f);
                    }
                    else
                    {
                        FireUtility.TryStartFireIn(intVec, base.Map, 0.1f);
                    }
                }
            }
        }
Exemple #4
0
 public override void ExplosionAffectCell(Explosion explosion, IntVec3 c, List <Thing> damagedThings, List <Thing> ignoredThings, bool canThrowMotes)
 {
     base.ExplosionAffectCell(explosion, c, damagedThings, ignoredThings, canThrowMotes);
     Rand.PushState();
     if ((this.def == AdeptusDamageDefOf.OG_Chaos_Deamon_Warpfire || this.def == AdeptusDamageDefOf.OG_WarpStormStrike) && Rand.Chance(WarpfireUtility.ChanceToStartWarpfireIn(c, explosion.Map)))
     {
         WarpfireUtility.TryStartWarpfireIn(c, explosion.Map, Rand.Range(0.2f, 0.6f));
     }
     Rand.PopState();
 }