Пример #1
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);
        }
 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));
     }
 }
 // Token: 0x06004AA7 RID: 19111 RVA: 0x0022CB98 File Offset: 0x0022AF98
 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));
     }
 }
Пример #4
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));
        }
Пример #5
0
        public override void Tick()
        {
            base.Tick();

            if (Map != null)
            {
                FireUtility.TryStartFireIn(Position, Map, Rand.Range(0.4f, 0.8f));
            }
        }
        public static Building_BaseRobotRechargeStation FindRechargeStationFor(ArcBaseRobot sleeper, ArcBaseRobot traveler, bool sleeperWillBePrisoner, bool checkSocialProperness, bool medicalBedNeeded = false)
        {
            Predicate <Thing> predicate = delegate(Thing t) {
                bool flag3 = !ReservationUtility.CanReserveAndReach(traveler, t, PathEndMode.OnCell, Danger.Some, 1, -1, null, false);
                bool result2;
                if (flag3)
                {
                    result2 = false;
                }
                else
                {
                    Building_BaseRobotRechargeStation rechargeStation = t as Building_BaseRobotRechargeStation;
                    bool flag4 = rechargeStation == null;
                    if (flag4)
                    {
                        result2 = false;
                    }
                    else
                    {
                        bool flag5 = rechargeStation.robot != null && rechargeStation.robot != sleeper;
                        if (flag5)
                        {
                            result2 = false;
                        }
                        else
                        {
                            bool flag6 = ForbidUtility.IsForbidden(rechargeStation, traveler);
                            if (flag6)
                            {
                                result2 = false;
                            }
                            else
                            {
                                bool flag7 = FireUtility.IsBurning(rechargeStation);
                                result2 = !flag7;
                            }
                        }
                    }
                }
                return(result2);
            };
            bool flag = sleeper.rechargeStation != null && predicate(sleeper.rechargeStation);
            Building_BaseRobotRechargeStation result;

            if (flag)
            {
                Building_BaseRobotRechargeStation rechargeStation = sleeper.rechargeStation;
                bool flag2 = rechargeStation != null;
                if (flag2)
                {
                    result = rechargeStation;
                    return(result);
                }
            }
            result = null;
            return(result);
        }
        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();
        }
Пример #8
0
        private IntVec3 GetCell(ref IntVec3 root, Map map) => CellFinder.RandomClosewalkCellNear(root, map, Radius,
                                                                                                 (IntVec3 vec) =>
        {
            if (FireUtility.ContainsStaticFire(vec, map))
            {
                return(false);
            }

            return(true);
        });
        // 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));
            }
        }
Пример #10
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));
        }
Пример #11
0
 public override void Tick()
 {
     if(Position.GetThingList().Any(x => x.def == ThingDefOf.FilthFireFoam))
     {
         if (!Destroyed)
             Destroy();
     }
     else
     {
         FireUtility.TryStartFireIn(Position, maxFireSize);
     }
 }
Пример #12
0
        protected virtual void TryBurning(float fireSize)
        {
            if (FireUtility.ContainsStaticFire(base.parent.Position, base.parent.Map))
            {
                return;
            }

            Fire fire = (Fire)ThingMaker.MakeThing(ThingDefOf.Fire, null);

            fire.fireSize = fireSize;
            GenSpawn.Spawn(fire, base.parent.Position, base.parent.Map, Rot4.North);
            return;
        }
Пример #13
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            bool result = false;

            if (this.TryFindRandomPowerTraderBuilding((Map)parms.target, out Building building))
            {
                DamageInfo dinfo = new DamageInfo(DamageDefOf.Flame, 5f);
                building.TakeDamage(dinfo);
                FireUtility.TryStartFireIn(building.Position, (Map)parms.target, 0.3f);
                Find.LetterStack.ReceiveLetter(this.def.letterLabel, this.def.letterText, this.def.letterDef, building);
                result = true;
            }
            return(result);
        }
Пример #14
0
 protected override void Impact(Thing hitThing)
 {
     base.Impact(hitThing);
     if (hitThing != null)
     {
         hitThing.TryAttachFire(0.2f);
     }
     else
     {
         GenSpawn.Spawn(ThingDefOf.FilthFuel, base.Position);
         FireUtility.TryStartFireIn(base.Position, 0.2f);
     }
     MoteMaker.MakeStaticMote(this.Position, ThingDefOf.Mote_ShotFlash, 6f);
     MoteMaker.ThrowMicroSparks(base.Position.ToVector3Shifted());
 }
Пример #15
0
        private const int ignitionTemp = 21;                    // Temperature (in Celsius) above which the plant will start catching fire

        public override void TickLong()
        {
            base.TickLong();
            float temperature = Position.GetTemperature(base.Map);

            if (temperature > ignitionTemp)
            {
                float ignitionChance = 0.005f * Mathf.Pow((temperature - ignitionTemp), 2);
                float rand           = UnityEngine.Random.value;
                if (UnityEngine.Random.value < ignitionChance)
                {
                    FireUtility.TryStartFireIn(Position, base.Map, 0.1f);
                }
            }
        }
Пример #16
0
        protected virtual void Ignite()
        {
            Map map = Map;

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

            cellsToAffect.Clear();
            cellsToAffect.AddRange(def.projectile.damageDef.Worker.ExplosionCellsToHit(Position, map, radius));

            FleckMaker.Static(Position, map, FleckDefOf.ExplosionFlash, radius * 4f);
            for (int i = 0; i < 4; i++)
            {
                FleckMaker.ThrowSmoke(Position.ToVector3Shifted() + Gen.RandomHorizontalVector(radius * 0.7f), map, radius * 0.6f);
            }

            Rand.PushState();
            if (Rand.Chance(ignitionChance))
            {
                foreach (var vec3 in cellsToAffect)
                {
                    var fireSize = radius - vec3.DistanceTo(Position);
                    if (fireSize > 0.1f)
                    {
                        if (this.def.projectile.damageDef == AdeptusDamageDefOf.OG_Chaos_Deamon_Warpfire)
                        {
                            WarpfireUtility.TryStartWarpfireIn(vec3, map, fireSize);
                        }
                        else
                        {
                            FireUtility.TryStartFireIn(vec3, map, fireSize);
                        }
                    }
                }
            }
            Rand.PopState();

            //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);
        }
        private static bool TryStartFireNear(Building b)
        {
            GasExplosionUtility.tmpCells.Clear();
            int      num       = GenRadial.NumCellsInRadius(3f);
            CellRect startRect = b.OccupiedRect();

            for (int i = 0; i < num; i++)
            {
                IntVec3 intVec = b.Position + GenRadial.RadialPattern[i];
                if (GenSight.LineOfSight(b.Position, intVec, b.Map, startRect, CellRect.SingleCell(intVec), null) && FireUtility.ChanceToStartFireIn(intVec, b.Map) > 0f)
                {
                    GasExplosionUtility.tmpCells.Add(intVec);
                }
            }
            return(GasExplosionUtility.tmpCells.Any <IntVec3>() && FireUtility.TryStartFireIn(GasExplosionUtility.tmpCells.RandomElement <IntVec3>(), b.Map, Rand.Range(0.1f, 1.75f)));
        }
Пример #18
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            IntVec3 cell = CellFinder.RandomClosewalkCellNear(pawn.Position, pawn.Map, 10, (IntVec3 vec) =>
            {
                if (FireUtility.ContainsStaticFire(vec, pawn.Map))
                {
                    return(false);
                }

                return(true);
            });

            Job job = new Job(JobDefOfLocal.FireAround, cell);

            return(job);
        }
Пример #19
0
 protected override void Impact(Thing hitThing)
 {
     base.Impact(hitThing);
     if (hitThing != null)
     {
         hitThing.TryIgnite(0.3f);
         GenSpawn.Spawn(ThingDef.Named("Puddle_Fuel"), base.Position);
         FireUtility.TryStartFireIn(base.Position, 0.2f);
     }
     else
     {
         GenSpawn.Spawn(ThingDef.Named("FlareDeployed"), this.Position);
     }
     MoteMaker.ThrowFlash(base.Position, "ShotFlash", 6f);
     MoteMaker.TryThrowMicroSparks(base.Position.ToVector3Shifted());
 }
Пример #20
0
        //---------------------------

        new protected void TrySpread()
        {
            IntVec3 position = base.Position;
            bool    flag;

            if (Rand.Chance(0.8f))
            {
                position = base.Position + GenRadial.ManualRadialPattern[Rand.RangeInclusive(1, 8)];
                flag     = true;
            }
            else
            {
                position = base.Position + GenRadial.ManualRadialPattern[Rand.RangeInclusive(10, 20)];
                flag     = false;
            }
            if (!position.InBounds(base.Map) || !Rand.Chance(FireUtility.ChanceToStartFireIn(position, base.Map)))
            {
                return;
            }
            if (!flag)
            {
                CellRect startRect = CellRect.SingleCell(base.Position);
                CellRect endRect   = CellRect.SingleCell(position);
                if (GenSight.LineOfSight(base.Position, position, base.Map, startRect, endRect))
                {
                    if (occult)
                    {
                        ((OccultSpark)GenSpawn.Spawn(CultsDefOf.Cults_OccultSpark, base.Position, base.Map)).Launch(this, position, position, ProjectileHitFlags.All);
                    }
                    else
                    {
                        ((Spark)GenSpawn.Spawn(ThingDefOf.Spark, base.Position, base.Map)).Launch(this, position, position, ProjectileHitFlags.All);
                    }
                }
            }
            else
            {
                if (occult)
                {
                    OccultFireUtility.TryStartFireIn(position, base.Map, 0.1f);
                }
                else
                {
                    FireUtility.TryStartFireIn(position, base.Map, 0.1f);
                }
            }
        }
        protected override void Impact(Thing hitThing)
        {
            base.Impact(hitThing);
            if (!initialized)
            {
                Initialize();
            }

            var unused = def;
            var map    = caster.Map;

            expandingTick++;
            var centerCell        = Position;
            var oldExplosionCells = GenRadial.RadialCellsAround(centerCell, expandingTick - 1, true);
            var newExplosionCells = GenRadial.RadialCellsAround(centerCell, expandingTick, true);
            var explosionCells    = newExplosionCells.Except(oldExplosionCells);

            for (var i = 0; i < explosionCells.Count(); i++)
            {
                var curCell = explosionCells.ToArray()[i];
                if (!curCell.InBounds(map) || !curCell.IsValid)
                {
                    continue;
                }

                var heading   = (curCell - centerCell).ToVector3();
                var distance  = heading.magnitude;
                var direction = heading / distance;
                EffectMaker.MakeEffect(WizardryDefOf.Mote_ExpandingFlame, curCell.ToVector3(), map, .8f,
                                       (Quaternion.AngleAxis(90, Vector3.up) * direction).ToAngleFlat(), 4f, Rand.Range(100, 200));
                EffectMaker.MakeEffect(WizardryDefOf.Mote_RecedingFlame, curCell.ToVector3(), map, .7f,
                                       (Quaternion.AngleAxis(90, Vector3.up) * direction).ToAngleFlat(), 1f, 0);
                var hitList = curCell.GetThingList(map);
                foreach (var burnThing in hitList)
                {
                    DamageEntities(burnThing);
                }

                //GenExplosion.DoExplosion(this.currentPos.ToIntVec3(), this.Map, .4f, DamageDefOf.Flame, this.launcher, 10, SoundDefOf.ArtilleryShellLoaded, def, this.equipmentDef, null, 0f, 1, false, null, 0f, 1, 0f, false);
                if (Rand.Chance(fireStartChance))
                {
                    FireUtility.TryStartFireIn(curCell, map, Rand.Range(.1f, .35f));
                }
            }
        }
Пример #22
0
        protected override void Impact(Thing hitThing)
        {
            // This works. so if I check they are a pawn, I should be able to make them the hit thing and be done with it
            var  roll      = Rand.Value;
            bool BurnsSelf = roll <= Def.ChanceToBurnSelf ? true : false;
            Map  map       = base.Map;

            if (BurnsSelf && base.launcher is Pawn)
            {
                Messages.Message($"{base.launcher.Label} was burned by {base.equipmentDef.label}", MessageTypeDefOf.NegativeHealthEvent);
                base.Impact(base.launcher);
            }
            else
            {
                base.Impact(hitThing);
            }
            FireUtility.TryStartFireIn(base.Position, map, 0.05f);
        }
        protected override void Impact(Thing hitThing)
        {
            base.Impact(hitThing);
            if (!initialized)
            {
                Initialize();
            }
            ThingDef def = this.def;
            Map      map = caster.Map;

            this.expandingTick++;
            IntVec3 centerCell = base.Position;
            IntVec3 curCell;
            IEnumerable <IntVec3> oldExplosionCells = GenRadial.RadialCellsAround(centerCell, expandingTick - 1, true);
            IEnumerable <IntVec3> newExplosionCells = GenRadial.RadialCellsAround(centerCell, expandingTick, true);
            IEnumerable <IntVec3> explosionCells    = newExplosionCells.Except(oldExplosionCells);

            for (int i = 0; i < explosionCells.Count(); i++)
            {
                curCell = explosionCells.ToArray <IntVec3>()[i];
                if (curCell.InBounds(map) && curCell.IsValid)
                {
                    Vector3 heading   = (curCell - centerCell).ToVector3();
                    float   distance  = heading.magnitude;
                    Vector3 direction = heading / distance;
                    EffectMaker.MakeEffect(WizardryDefOf.Mote_ExpandingFlame, curCell.ToVector3(), map, .8f, (Quaternion.AngleAxis(90, Vector3.up) * direction).ToAngleFlat(), 4f, Rand.Range(100, 200));
                    EffectMaker.MakeEffect(WizardryDefOf.Mote_RecedingFlame, curCell.ToVector3(), map, .7f, (Quaternion.AngleAxis(90, Vector3.up) * direction).ToAngleFlat(), 1f, 0);
                    List <Thing> hitList   = curCell.GetThingList(map);
                    Thing        burnThing = null;
                    for (int j = 0; j < hitList.Count; j++)
                    {
                        burnThing = hitList[j];
                        DamageEntities(burnThing);
                    }
                    //GenExplosion.DoExplosion(this.currentPos.ToIntVec3(), this.Map, .4f, DamageDefOf.Flame, this.launcher, 10, SoundDefOf.ArtilleryShellLoaded, def, this.equipmentDef, null, 0f, 1, false, null, 0f, 1, 0f, false);
                    if (Rand.Chance(this.fireStartChance))
                    {
                        FireUtility.TryStartFireIn(curCell, map, Rand.Range(.1f, .35f));
                    }
                }
            }
        }
Пример #24
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;
            }
            Rand.PushState();
            if (Rand.Chance(FireUtility.ChanceToStartFireIn(intVec, base.Map)))
            {
                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 = (Spark)GenSpawn.Spawn(ThingDefOf.Spark, base.Position, base.Map, WipeMode.Vanish);
                    spark.Launch(this, intVec, intVec, ProjectileHitFlags.All, null);
                }
                else
                {
                    FireUtility.TryStartFireIn(intVec, base.Map, 0.1f);
                }
            }
            Rand.PopState();
        }
Пример #25
0
        public override void PreApplyDamage(ref DamageInfo dinfo, out bool absorbed)
        {
            absorbed = false;

            if (this.flammableLinkcomp != null)
            {
                if (!(FireUtility.ContainsStaticFire(base.Position, base.Map)))
                {
                    if ((dinfo.Instigator != null && dinfo.Instigator.Faction != Faction.OfPlayer) && !(dinfo.Weapon != null && dinfo.Weapon.IsRangedWeapon))
                    {
                        return;
                    }

                    float heat = flammableLinkcomp.HeatedByHitOf(dinfo);
                    this.flammableLinkcomp.TrySparksFly(heat);
                    MoteUtility.DrawHeatedMote(this.flammableLinkcomp.HeatRatio, base.DrawPos, base.Position, base.Map);
                    dinfo.SetAmount(0);
                }
            }
        }
 public override void CompTick()
 {
     base.CompTick();
     if (pawn.Dead)
     {
         base.parent.Destroy();
     }
     if (IsCheapIntervalTick)
     {
         base.parent.Map.weatherDecider.DisableRainFor(TickInterval + 100);
         if (PrecipRateTooHigh)
         {
             TakeDamageFromRain();
         }
         else
         {
             FireUtility.TryStartFireIn(base.parent.Position, map, size);
         }
     }
 }
Пример #27
0
        public static void Postfix(Thing __instance)
        {
            IntVec3    c       = __instance.Position;
            Map        map     = __instance.Map;
            TerrainDef terrain = c.GetTerrain(map);

            if (terrain != null && terrain.HasTag("Lava"))
            {
                FireUtility.TryStartFireIn(c, map, 5f);

                float statValue = __instance.GetStatValue(StatDefOf.Flammability, true);
                bool  alt       = __instance.def.altitudeLayer == AltitudeLayer.Item;
                if (statValue == 0f && alt == true)
                {
                    if (!__instance.Destroyed && __instance.def.destroyable)
                    {
                        __instance.Destroy(DestroyMode.Vanish);
                    }
                }
            }
        }
Пример #28
0
        // TODO: figure out how to start a small fire on miss (empty ground). currently, Impact only registers when an object is hit
        protected override void Impact(Thing hitThing)
        {
            base.Impact(hitThing);

            if (Def != null && hitThing != null)
            {
                // spawn a pool of chemfuel to guarantee an initial flame
                // GenSpawn.Spawn(ThingDefOf.Filth_Fuel, base.Position, Current.Game.CurrentMap);

                // set fire to struck unit (pawn, tree, etc.) only
                // hitThing.TryAttachFire(1);

                // set fire on map position, including ground or unit occupying that ground
                // chance depends on terrain type as seen in ChanceToStartFireIn()
                bool fireStarted = FireUtility.TryStartFireIn(base.Position, base.Map, 1);
                if (fireStarted)
                {
                    Messages.Message(TranslatorFormattedStringExtensions.Translate("Quiver_FireArrow_HitMessage", hitThing.Label, this.launcher.Label), MessageTypeDefOf.NeutralEvent);
                }
            }
        }
Пример #29
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.A));

            yield return(Toils_General.Wait(500).WithProgressBarToilDelay(TargetIndex.A));

            Toil toil = new Toil
            {
                initAction = delegate
                {
                    IntVec3 cell = TargetLocA;
                    if (cell != IntVec3.Invalid)
                    {
                        FireUtility.TryStartFireIn(cell, Map, 0.3f);
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            };

            yield return(toil);
        }
Пример #30
0
        private void UpdateDamage()
        {
            IntVec3 c = (from x in GenRadial.RadialCellsAround(base.Position, Radius, true)
                         where x.InBounds(base.Map)
                         select x).RandomElementByWeight((IntVec3 x) => 1f - Mathf.Min(x.DistanceTo(base.Position) / Radius, 1f) + 0.05f);

            FireUtility.TryStartFireIn(c, base.Map, Rand.Range(0.1f, 0.925f));
            tmpThings.Clear();
            tmpThings.AddRange(c.GetThingList(base.Map));
            for (int i = 0; i < tmpThings.Count; i++)
            {
                int  damage = (tmpThings[i] is Corpse) ? CorpseDamageAmountRange.RandomInRange : DamageAmountRange.RandomInRange;
                Pawn pawn   = tmpThings[i] as Pawn;
                BattleLogEntry_DamageTaken log = null;
                if (pawn != null)
                {
                    log = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_PowerBeam, this.instigator as Pawn);
                    Find.BattleLog.Add(log);
                }
                tmpThings[i].TakeDamage(new DamageInfo(DamageDef, (float)damage, ArmorPen, -1f, this.instigator, null, this.weaponDef, DamageInfo.SourceCategory.ThingOrUnknown, null)).AssociateWithLog(log);
            }
            tmpThings.Clear();
        }