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();
        }
Пример #2
0
        public static void BurnSnails(Pawn pawn)
        {
            BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Fire, null);

            Find.BattleLog.Add(battleLogEntry_DamageTaken);
            DamageInfo dinfo = new DamageInfo(RimWorld.DamageDefOf.Flame, 100, -1f, 0, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown, pawn);

            dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside);
            pawn.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_DamageTaken);
        }
        private void burnSnails(Pawn pawn)
        {
            BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Fire, null);

            Find.BattleLog.Add(battleLogEntry_DamageTaken);
            DamageInfo dinfo = new DamageInfo(DamageDefOf.Flame, 100, -1f, pawn, null, null, DamageInfo.SourceCategory.ThingOrUnknown);

            dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside);
            pawn.TakeDamage(dinfo).InsertIntoLog(battleLogEntry_DamageTaken);
        }
Пример #4
0
        private void DoDamage(IntVec3 c, float damageFactor)
        {
            Tornado.tmpThings.Clear();
            Tornado.tmpThings.AddRange(c.GetThingList(base.Map));
            Vector3 vector = c.ToVector3Shifted();
            Vector2 b      = new Vector2(vector.x, vector.z);
            float   num    = -this.realPosition.AngleTo(b) + 180f;

            for (int i = 0; i < Tornado.tmpThings.Count; i++)
            {
                BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null;
                switch (Tornado.tmpThings[i].def.category)
                {
                case ThingCategory.Pawn:
                {
                    Pawn pawn = (Pawn)Tornado.tmpThings[i];
                    battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Tornado, null);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    if (pawn.RaceProps.baseHealthScale < 1f)
                    {
                        damageFactor *= pawn.RaceProps.baseHealthScale;
                    }
                    if (pawn.RaceProps.Animal)
                    {
                        damageFactor *= 0.75f;
                    }
                    if (pawn.Downed)
                    {
                        damageFactor *= 0.2f;
                    }
                    break;
                }

                case ThingCategory.Item:
                    damageFactor *= 0.68f;
                    break;

                case ThingCategory.Building:
                    damageFactor *= 0.8f;
                    break;

                case ThingCategory.Plant:
                    damageFactor *= 1.7f;
                    break;
                }
                int       num2           = Mathf.Max(GenMath.RoundRandom(30f * damageFactor), 1);
                Thing     thing          = Tornado.tmpThings[i];
                DamageDef tornadoScratch = DamageDefOf.TornadoScratch;
                float     amount         = (float)num2;
                float     angle          = num;
                thing.TakeDamage(new DamageInfo(tornadoScratch, amount, 0f, angle, this, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null)).AssociateWithLog(battleLogEntry_DamageTaken);
            }
            Tornado.tmpThings.Clear();
        }
Пример #5
0
        private void DoDamage(IntVec3 c, float damageFactor)
        {
            DustDevil.tmpThings.Clear();
            DustDevil.tmpThings.AddRange(c.GetThingList(base.Map));
            Vector3 vector = c.ToVector3Shifted();
            Vector2 b      = new Vector2(vector.x, vector.z);
            float   angle  = -this.realPosition.AngleTo(b) + 180f;

            for (int i = 0; i < DustDevil.tmpThings.Count; i++)
            {
                BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null;
                switch (DustDevil.tmpThings[i].def.category)
                {
                case ThingCategory.Pawn:
                {
                    Pawn pawn = (Pawn)DustDevil.tmpThings[i];
                    battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Tornado, null);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    if (pawn.RaceProps.baseHealthScale < 1f)
                    {
                        damageFactor *= pawn.RaceProps.baseHealthScale;
                    }
                    if (pawn.RaceProps.Animal)
                    {
                        damageFactor *= AnimalPawnDamageFactor;
                    }
                    if (pawn.Downed)
                    {
                        damageFactor *= DownedPawnDamageFactor;
                    }
                    break;
                }

                case ThingCategory.Item:
                    damageFactor *= ItemDamageFactor;
                    break;

                case ThingCategory.Plant:
                    damageFactor *= PlantDamageFactor;
                    break;

                case ThingCategory.Building:
                    damageFactor *= BuildingDamageFactor;
                    break;
                }
                int amount = Mathf.Max(GenMath.RoundRandom(30f * damageFactor), 1);
                DustDevil.tmpThings[i].TakeDamage(new DamageInfo(DamageDefOf.TornadoScratch, amount, 0, angle, this, null, null, DamageInfo.SourceCategory.ThingOrUnknown)).AssociateWithLog(battleLogEntry_DamageTaken);
            }
            DustDevil.tmpThings.Clear();
        }
Пример #6
0
        private void DoDamage(IntVec3 c, float damageFactor)
        {
            Tornado.tmpThings.Clear();
            Tornado.tmpThings.AddRange(c.GetThingList(base.Map));
            Vector3 vector = c.ToVector3Shifted();
            Vector2 b      = new Vector2(vector.x, vector.z);
            float   angle  = (float)(0.0 - this.realPosition.AngleTo(b) + 180.0);

            for (int i = 0; i < Tornado.tmpThings.Count; i++)
            {
                BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null;
                switch (Tornado.tmpThings[i].def.category)
                {
                case ThingCategory.Pawn:
                {
                    Pawn pawn = (Pawn)Tornado.tmpThings[i];
                    battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Tornado, null);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    if (pawn.RaceProps.baseHealthScale < 1.0)
                    {
                        damageFactor *= pawn.RaceProps.baseHealthScale;
                    }
                    if (pawn.RaceProps.Animal)
                    {
                        damageFactor = (float)(damageFactor * 0.75);
                    }
                    if (pawn.Downed)
                    {
                        damageFactor = (float)(damageFactor * 0.20000000298023224);
                    }
                    break;
                }

                case ThingCategory.Building:
                    damageFactor = (float)(damageFactor * 0.800000011920929);
                    break;

                case ThingCategory.Item:
                    damageFactor = (float)(damageFactor * 0.68000000715255737);
                    break;

                case ThingCategory.Plant:
                    damageFactor = (float)(damageFactor * 1.7000000476837158);
                    break;
                }
                int amount = Mathf.Max(GenMath.RoundRandom((float)(30.0 * damageFactor)), 1);
                Tornado.tmpThings[i].TakeDamage(new DamageInfo(DamageDefOf.TornadoScratch, amount, angle, this, null, null, DamageInfo.SourceCategory.ThingOrUnknown)).InsertIntoLog(battleLogEntry_DamageTaken);
            }
            Tornado.tmpThings.Clear();
        }
Пример #7
0
        private void DoDamage(IntVec3 c, float damageFactor)
        {
            tmpThings.Clear();
            tmpThings.AddRange(c.GetThingList(base.Map));
            Vector3 vector = c.ToVector3Shifted();
            float   angle  = 0f - Vector2Utility.AngleTo(b: new Vector2(vector.x, vector.z), a: realPosition) + 180f;

            for (int i = 0; i < tmpThings.Count; i++)
            {
                BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null;
                switch (tmpThings[i].def.category)
                {
                case ThingCategory.Pawn:
                {
                    Pawn pawn = (Pawn)tmpThings[i];
                    battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Tornado);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    if (pawn.RaceProps.baseHealthScale < 1f)
                    {
                        damageFactor *= pawn.RaceProps.baseHealthScale;
                    }
                    if (pawn.RaceProps.Animal)
                    {
                        damageFactor *= 0.75f;
                    }
                    if (pawn.Downed)
                    {
                        damageFactor *= 0.2f;
                    }
                    break;
                }

                case ThingCategory.Building:
                    damageFactor *= 0.8f;
                    break;

                case ThingCategory.Item:
                    damageFactor *= 0.68f;
                    break;

                case ThingCategory.Plant:
                    damageFactor *= 1.7f;
                    break;
                }
                int num = Mathf.Max(GenMath.RoundRandom(30f * damageFactor), 1);
                tmpThings[i].TakeDamage(new DamageInfo(DamageDefOf.TornadoScratch, num, 0f, angle, this)).AssociateWithLog(battleLogEntry_DamageTaken);
            }
            tmpThings.Clear();
        }
Пример #8
0
        protected override void SpringSub(Pawn p)
        {
            SoundDefOf.TrapSpring.PlayOneShot(new TargetInfo(base.Position, base.Map, false));
            if (p == null)
            {
                return;
            }
            float      damage           = this.GetStatValue(RimWorld.StatDefOf.TrapMeleeDamage, true) * DamageRandomFactorRange.RandomInRange;
            float      armorPenetration = damage * VerbProperties.DefaultArmorPenetrationPerDamage;
            DamageInfo dinfo            = new DamageInfo(DamageDefOf.Stab, damage, armorPenetration, -1f, this, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null);

            DamageWorker.DamageResult  damageResult = p.TakeDamage(dinfo);
            BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(p, RulePackDefOf.DamageEvent_TrapSpike, null);

            Find.BattleLog.Add(battleLogEntry_DamageTaken);
            damageResult.AssociateWithLog(battleLogEntry_DamageTaken);
        }
Пример #9
0
        protected override void SpringSub(Pawn p)
        {
            IEnumerable <BodyPartRecord> enumerable = from x in p.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null)
                                                      where x.def == BodyPartDefOf.Eye
                                                      select x;

            foreach (BodyPartRecord current in enumerable)
            {
                DamageInfo dinfo = new DamageInfo(DamageDefOf.Burn, 5, 0.5f, -1f, this, current, null, DamageInfo.SourceCategory.ThingOrUnknown, null);
                DamageWorker.DamageResult damageResult = p.TakeDamage(dinfo);
            }


            SoundDefOf.TrapSpring.PlayOneShot(new TargetInfo(base.Position, base.Map, false));
            if (p == null)
            {
                return;
            }
            float num              = this.GetStatValue(StatDefOf.TrapMeleeDamage, true) * DamageRandomFactorRange.RandomInRange * SRFPSRT_settings.Gettrapdamage();
            float num2             = num / DamageCount;
            float armorPenetration = num2 * 0.015f * SRFPSRT_settings.Getarmorpenetrate();
            int   num3             = 0;

            while ((float)num3 < DamageCount)
            {
                DamageInfo dinfo = new DamageInfo(DamageDefOf.Stab, num2, armorPenetration, -1f, this, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null);
                DamageWorker.DamageResult damageResult = p.TakeDamage(dinfo);
                if (num3 == 0)
                {
                    BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(p, RulePackDefOf.DamageEvent_TrapSpike, null);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    damageResult.AssociateWithLog(battleLogEntry_DamageTaken);
                }
                num3++;
            }
            Map     map = base.Map;
            IntVec3 loc = this.Position;

            this.Destroy(DestroyMode.Vanish);
            Thing thing = GenSpawn.Spawn(ThingMaker.MakeThing(ThingDef.Named("Building_SRFPSRTunarmed"), this.Stuff), loc, map, WipeMode.Vanish);

            thing.SetFaction(Faction.OfPlayer, null);
        }
        // Token: 0x06000002 RID: 2 RVA: 0x00002058 File Offset: 0x00000258
        private void SpringSubImpl(Pawn hitPawn)
        {
            SoundDefOf.TrapSpring.PlayOneShot(new TargetInfo(Position, Map, false));
            var num = this.GetStatValue(StatDefOf.TrapMeleeDamage, true) * DamageRandomFactorRange.RandomInRange / DamageCount;
            var armorPenetration = num * 0.015f;
            var num2             = 0;

            while (num2 < DamageCount)
            {
                var dinfo = new DamageInfo(DamageDefOf.Stab, num, armorPenetration, -1f, this, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null);
                DamageWorker.DamageResult damageResult = hitPawn.TakeDamage(dinfo);
                if (num2 == 0)
                {
                    var battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(hitPawn, MengRulePackDefOf.DamageEvent_TrapMengPunjiSticks, null);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    damageResult.AssociateWithLog(battleLogEntry_DamageTaken);
                }
                num2++;
            }
        }
        // Token: 0x06000025 RID: 37 RVA: 0x00002904 File Offset: 0x00000B04
        private void DamagePawn(Pawn p)
        {
            float value = Rand.Value;
            float num   = StatExtension.GetStatValue(this, StatDefOf.TrapMeleeDamage, true) * Building_TrapRearmable.TrapDamageFactor.RandomInRange / (float)Building_TrapRearmable.DamageCount.RandomInRange;
            float num2  = num * 0.015f;
            int   num3  = 0;

            while ((float)num3 < (float)Building_TrapRearmable.DamageCount.RandomInRange)
            {
                DamageInfo damageInfo;
                damageInfo = new DamageInfo(DamageDefOf.Stab, num, num2, -1f, this, null, null, 0, null);
                DamageWorker.DamageResult damageResult = p.TakeDamage(damageInfo);
                if (num3 == 0)
                {
                    BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(p, RulePackDefOf.DamageEvent_TrapSpike, null);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    damageResult.AssociateWithLog(battleLogEntry_DamageTaken);
                }
                num3++;
            }
        }
Пример #12
0
 protected override void SpringSub(Pawn p)
 {
     SoundDefOf.TrapSpring.PlayOneShot(new TargetInfo(base.Position, base.Map));
     if (p != null)
     {
         float num              = this.GetStatValue(StatDefOf.TrapMeleeDamage) * DamageRandomFactorRange.RandomInRange;
         float num2             = num / DamageCount;
         float armorPenetration = num2 * 0.015f;
         for (int i = 0; (float)i < DamageCount; i++)
         {
             DamageInfo dinfo = new DamageInfo(DamageDefOf.Stab, num2, armorPenetration, -1f, this);
             DamageWorker.DamageResult damageResult = p.TakeDamage(dinfo);
             if (i == 0)
             {
                 BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(p, RulePackDefOf.DamageEvent_TrapSpike);
                 Find.BattleLog.Add(battleLogEntry_DamageTaken);
                 damageResult.AssociateWithLog(battleLogEntry_DamageTaken);
             }
         }
     }
 }
Пример #13
0
        private void DoFireDamage(Thing targ)
        {
            float damPerTick = 0.0125f + (0.0036f * fireSize);

            damPerTick = Mathf.Clamp(damPerTick, 0.0125f, 0.05f);
            int damAmount = GenMath.RoundRandom(damPerTick * ComplexCalcsInterval);

            if (damAmount < 1)
            {
                damAmount = 1;
            }

            Pawn p = targ as Pawn;

            if (p != null)
            {
                BattleLogEntry_DamageTaken log = new BattleLogEntry_DamageTaken(p, RulePackDefOf.DamageEvent_Fire);
                Find.BattleLog.Add(log);

                DamageInfo dinfo = new DamageInfo(DamageDefOf.Flame, damAmount, instigator: this);
                dinfo.SetBodyRegion(depth: BodyPartDepth.Outside);
                targ.TakeDamage(dinfo).AssociateWithLog(log);

                //Damage a random apparel
                if (p.apparel != null)
                {
                    Apparel ap;
                    if (p.apparel.WornApparel.TryRandomElement(out ap))
                    {
                        ap.TakeDamage(new DamageInfo(DamageDefOf.Flame, damAmount, instigator: this));
                    }
                }
            }
            else
            {
                targ.TakeDamage(new DamageInfo(DamageDefOf.Flame, damAmount, instigator: this));
            }
        }
Пример #14
0
        private void TakeFireDamage(Pawn pawn, float fireSize)
        {
            int num = GenMath.RoundRandom(Mathf.Clamp(0.5f + 0.01f * fireSize, 0.25f, 1f) * 150f);

            if (num < 1)
            {
                num = 1;
            }
            BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Fire, null);

            Find.BattleLog.Add(battleLogEntry_DamageTaken);
            DamageInfo dinfo = new DamageInfo(DamageDefOf.Flame, (float)num, 0f, -1f, vehicle, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null);

            dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside);
            pawn.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_DamageTaken);
            Apparel apparel;

            if (pawn.apparel != null && pawn.apparel.WornApparel.TryRandomElement(out apparel))
            {
                apparel.TakeDamage(new DamageInfo(DamageDefOf.Flame, (float)num, 0f, -1f, vehicle, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null));
                return;
            }
        }
Пример #15
0
        private void StartRandomFireAndDoFlameDamage()
        {
            IntVec3 c = (from x in GenRadial.RadialCellsAround(base.Position, 15f, useCenter: true)
                         where x.InBounds(base.Map)
                         select x).RandomElementByWeight((IntVec3 x) => 1f - Mathf.Min(x.DistanceTo(base.Position) / 15f, 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  num  = (tmpThings[i] is Corpse) ? CorpseFlameDamageAmountRange.RandomInRange : FlameDamageAmountRange.RandomInRange;
                Pawn pawn = tmpThings[i] as Pawn;
                BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null;
                if (pawn != null)
                {
                    battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_PowerBeam, instigator as Pawn);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                }
                tmpThings[i].TakeDamage(new DamageInfo(DamageDefOf.Flame, num, 0f, -1f, instigator, null, weaponDef)).AssociateWithLog(battleLogEntry_DamageTaken);
            }
            tmpThings.Clear();
        }
Пример #16
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();
        }
Пример #17
0
 public override void CompTick()
 {
     base.CompTick();
     flameCounter++;
     if (flameCounter >= 50)
     {
         Pawn pawn = this.parent as Pawn;
         if ((pawn.Map != null) && (pawn.IsBurning()))
         {
             BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null;
             if (pawn != null)
             {
                 battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Fire, pawn);
                 Find.BattleLog.Add(battleLogEntry_DamageTaken);
             }
             DamageDef flame      = Named("AA_PermanentBurn");
             float     amount     = (float)15;
             Thing     instigator = this.parent;
             //ThingDef weaponDef = ThingDef.Named("Gun_Autopistol");
             this.parent.TakeDamage(new DamageInfo(flame, amount, 0f, -1f, instigator, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null)).AssociateWithLog(battleLogEntry_DamageTaken);
         }
         flameCounter = 0;
     }
 }
        private void DamagePawn(Pawn p)
        {
            BodyPartHeight height = (Rand.Value >= 0.666f) ? BodyPartHeight.Middle : BodyPartHeight.Top;
            float          num    = this.GetStatValue(StatDefOf.TrapMeleeDamage, true) * Building_TrapRearmable.TrapDamageFactor.RandomInRange;
            float          num2   = num / Building_TrapRearmable.DamageCount.RandomInRange;



            float armorPenetration = num2 * ArmorPenetrationAmount;
            int   num3             = 0;

            while ((float)num3 < Building_TrapRearmable.DamageCount.RandomInRange)
            {
                DamageInfo dinfo = new DamageInfo(DamageDefOf.Stab, num2, armorPenetration, -1f, this, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null);
                DamageWorker.DamageResult damageResult = p.TakeDamage(dinfo);
                if (num3 == 0)
                {
                    BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(p, RulePackDefOf.DamageEvent_TrapSpike, null);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    damageResult.AssociateWithLog(battleLogEntry_DamageTaken);
                }
                num3++;
            }
        }
Пример #19
0
        protected override void SpringSub(Pawn p)
        {
            int temp = UnityEngine.Random.Range(0, 5);

            if (temp == 0)
            {
                for (int i = 0; i < 3; i++)
                {
                    Pawn pawn = PawnGenerator.GeneratePawn(PawnKindDef.Named("Rat"), null);
                    pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
                    IntVec3 spawncell = CellFinder.RandomClosewalkCellNear(this.Position, this.Map, 5, (IntVec3 c) => c.Standable(this.Map) &&
                                                                           this.Map.reachability.CanReach(c, this, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false)));
                    Thing spawnedCreature = GenSpawn.Spawn(pawn, spawncell, this.Map, WipeMode.Vanish);
                    pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
                }
            }
            else if (temp == 1)
            {
                for (int i = 0; i < 2; i++)
                {
                    Pawn pawn = PawnGenerator.GeneratePawn(PawnKindDef.Named("Cat"), null);
                    pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
                    IntVec3 spawncell = CellFinder.RandomClosewalkCellNear(this.Position, this.Map, 5, (IntVec3 c) => c.Standable(this.Map) &&
                                                                           this.Map.reachability.CanReach(c, this, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false)));
                    Thing spawnedCreature = GenSpawn.Spawn(pawn, spawncell, this.Map, WipeMode.Vanish);
                    pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
                }
            }
            else if (temp == 2)
            {
                Pawn pawn = PawnGenerator.GeneratePawn(PawnKindDef.Named("Cougar"), null);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
                IntVec3 spawncell = CellFinder.RandomClosewalkCellNear(this.Position, this.Map, 5, (IntVec3 c) => c.Standable(this.Map) &&
                                                                       this.Map.reachability.CanReach(c, this, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false)));
                Thing spawnedCreature = GenSpawn.Spawn(pawn, spawncell, this.Map, WipeMode.Vanish);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
            }
            else if (temp == 3)
            {
                Pawn pawn = PawnGenerator.GeneratePawn(PawnKindDef.Named("WildBoar"), null);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
                IntVec3 spawncell = CellFinder.RandomClosewalkCellNear(this.Position, this.Map, 5, (IntVec3 c) => c.Standable(this.Map) &&
                                                                       this.Map.reachability.CanReach(c, this, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false)));
                Thing spawnedCreature = GenSpawn.Spawn(pawn, spawncell, this.Map, WipeMode.Vanish);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
            }
            else
            {
                Pawn pawn = PawnGenerator.GeneratePawn(PawnKindDef.Named("Bear_Grizzly"), null);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
                IntVec3 spawncell = CellFinder.RandomClosewalkCellNear(this.Position, this.Map, 5, (IntVec3 c) => c.Standable(this.Map) &&
                                                                       this.Map.reachability.CanReach(c, this, PathEndMode.Touch, TraverseParms.For(TraverseMode.PassDoors, Danger.Deadly, false)));
                Thing spawnedCreature = GenSpawn.Spawn(pawn, spawncell, this.Map, WipeMode.Vanish);
                pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Berserk, null, true, false, null, false);
            }

            SoundDefOf.TrapSpring.PlayOneShot(new TargetInfo(base.Position, base.Map, false));
            if (p == null)
            {
                return;
            }
            float num              = this.GetStatValue(StatDefOf.TrapMeleeDamage, true) * DamageRandomFactorRange.RandomInRange * SRFPSRT_settings.Gettrapdamage();
            float num2             = num / DamageCount;
            float armorPenetration = num2 * 0.015f * SRFPSRT_settings.Getarmorpenetrate();
            int   num3             = 0;

            while ((float)num3 < DamageCount)
            {
                DamageInfo dinfo = new DamageInfo(DamageDefOf.Stab, num2, armorPenetration, -1f, this, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null);
                DamageWorker.DamageResult damageResult = p.TakeDamage(dinfo);
                if (num3 == 0)
                {
                    BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(p, RulePackDefOf.DamageEvent_TrapSpike, null);
                    Find.BattleLog.Add(battleLogEntry_DamageTaken);
                    damageResult.AssociateWithLog(battleLogEntry_DamageTaken);
                }
                num3++;
            }
            Map     map   = base.Map;
            IntVec3 loc   = this.Position;
            Thing   thing = GenSpawn.Spawn(ThingMaker.MakeThing(ThingDef.Named("Building_SRFPSRTunarmed"), this.Stuff), loc, map, WipeMode.Vanish);

            thing.SetFaction(Faction.OfPlayer, null);
        }
Пример #20
0
        public override void Impact(Thing hitThing)
        {
            bool cookOff = (launcher is AmmoThing);

            Map map = base.Map;
            LogEntry_DamageResult logEntry = null;

            if (!cookOff && (logMisses || hitThing is Pawn || hitThing is Building_Turret))
            {
                LogImpact(hitThing, out logEntry);
            }

            if (hitThing != null)
            {
                // launcher being the pawn equipping the weapon, not the weapon itself
                float damageAmountBase  = DamageAmount;
                var   projectilePropsCE = (ProjectilePropertiesCE)def.projectile;
                var   isSharpDmg        = def.projectile.damageDef.armorCategory == DamageArmorCategoryDefOf.Sharp;
                var   penetration       = PenetrationAmount;
                var   damDefCE          = def.projectile.damageDef.GetModExtension <DamageDefExtensionCE>() ?? new DamageDefExtensionCE();
                var   dinfo             = new DamageInfo(
                    def.projectile.damageDef,
                    damageAmountBase,
                    penetration,       //Armor Penetration
                    ExactRotation.eulerAngles.y,
                    launcher,
                    null,
                    def);

                // Set impact height
                BodyPartDepth partDepth = damDefCE.harmOnlyOutsideLayers ? BodyPartDepth.Outside : BodyPartDepth.Undefined;
                //NOTE: ExactPosition.y isn't always Height at the point of Impact!
                BodyPartHeight partHeight = new CollisionVertical(hitThing).GetCollisionBodyHeight(ExactPosition.y);
                dinfo.SetBodyRegion(partHeight, partDepth);
                if (damDefCE.harmOnlyOutsideLayers)
                {
                    dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside);
                }

                //The following code excludes turrets etcetera from having cook off projectile impacts recorded in their combat log.
                //If it is necessary to add cook off to turret logs, a new BattleLogEntry_ must be created, because BattleLogEntry_DamageTaken,
                //which is the only method capable of handling cookoff and only using pawns, can not take !(hitThing is Pawn).
                if (cookOff && hitThing is Pawn hitPawn)
                {
                    logEntry =
                        new BattleLogEntry_DamageTaken(
                            hitPawn,
                            CookOff
                            );
                    Find.BattleLog.Add(logEntry);
                }

                try
                {
                    // Apply primary damage
                    hitThing.TakeDamage(dinfo).AssociateWithLog(logEntry);

                    // Apply secondary to non-pawns (pawn secondary damage is handled in the damage worker)
                    // The !(hitThing is Pawn) already excludes non-pawn cookoff projectiles from being logged, as logEntry == null
                    if (!(hitThing is Pawn) && projectilePropsCE != null && !projectilePropsCE.secondaryDamage.NullOrEmpty())
                    {
                        foreach (SecondaryDamage cur in projectilePropsCE.secondaryDamage)
                        {
                            if (hitThing.Destroyed || !Rand.Chance(cur.chance))
                            {
                                break;
                            }

                            var secDinfo = cur.GetDinfo(dinfo);
                            hitThing.TakeDamage(secDinfo).AssociateWithLog(logEntry);
                        }
                    }
                }
                catch (Exception e)
                {
                    Log.Error("CombatExtended :: BulletCE impacting thing " + hitThing.LabelCap + " of def " + hitThing.def.LabelCap + " added by mod " + hitThing.def.modContentPack.Name + ". See following stacktrace for information.");
                    throw e;
                }
                finally
                {
                    base.Impact(hitThing);
                }
            }
            else
            {
                SoundDefOf.BulletImpact_Ground.PlayOneShot(new TargetInfo(base.Position, map, false));

                //Only display a dirt/water hit for projectiles with a dropshadow
                if (base.castShadow)
                {
                    FleckMaker.Static(this.ExactPosition, map, FleckDefOf.ShotHit_Dirt, 1f);
                    if (base.Position.GetTerrain(map).takeSplashes)
                    {
                        FleckMaker.WaterSplash(this.ExactPosition, map, Mathf.Sqrt(def.projectile.GetDamageAmount(this.launcher)) * 1f, 4f);
                    }
                }
                base.Impact(null);
            }
            NotifyImpact(hitThing, map, Position);
        }
Пример #21
0
        protected override void Impact(Thing hitThing)
        {
            bool cookOff = (launcher is AmmoThing);

            Map map = base.Map;
            LogEntry_DamageResult logEntry = null;

            if (logMisses
                ||
                (!logMisses &&
                 hitThing != null &&
                 (hitThing is Pawn ||
                  hitThing is Building_Turret)
                ))
            {
                if (!cookOff)
                {
                    LogImpact(hitThing, out logEntry);
                }
            }

            if (hitThing != null)
            {
                // launcher being the pawn equipping the weapon, not the weapon itself
                int damageAmountBase          = def.projectile.GetDamageAmount(1);
                DamageDefExtensionCE damDefCE = def.projectile.damageDef.GetModExtension <DamageDefExtensionCE>() ?? new DamageDefExtensionCE();
                var projectilePropsCE         = (ProjectilePropertiesCE)def.projectile;

                DamageInfo dinfo = new DamageInfo(
                    def.projectile.damageDef,
                    damageAmountBase,
                    projectilePropsCE.GetArmorPenetration(1), //Armor Penetration
                    ExactRotation.eulerAngles.y,
                    launcher,
                    null,
                    def);

                // Set impact height
                BodyPartDepth partDepth = damDefCE != null && damDefCE.harmOnlyOutsideLayers ? BodyPartDepth.Outside : BodyPartDepth.Undefined;
                //NOTE: ExactPosition.y isn't always Height at the point of Impact!
                BodyPartHeight partHeight = new CollisionVertical(hitThing).GetCollisionBodyHeight(ExactPosition.y);
                dinfo.SetBodyRegion(partHeight, partDepth);
                if (damDefCE != null && damDefCE.harmOnlyOutsideLayers)
                {
                    dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside);
                }

                //The following code excludes turrets etcetera from having cook off projectile impacts recorded in their combat log.
                //If it is necessary to add cook off to turret logs, a new BattleLogEntry_ must be created, because BattleLogEntry_DamageTaken,
                //which is the only method capable of handling cookoff and only using pawns, can not take !(hitThing is Pawn).
                if (cookOff && hitThing is Pawn)
                {
                    logEntry =
                        new BattleLogEntry_DamageTaken(
                            (Pawn)hitThing,
                            DefDatabase <RulePackDef> .GetNamed("DamageEvent_CookOff"));
                    Find.BattleLog.Add(logEntry);
                }

                // Apply primary damage
                hitThing.TakeDamage(dinfo).AssociateWithLog(logEntry);

                // Apply secondary to non-pawns (pawn secondary damage is handled in the damage worker)
                // The !(hitThing is Pawn) already excludes non-pawn cookoff projectiles from being logged, as logEntry == null
                if (!(hitThing is Pawn) && projectilePropsCE != null && !projectilePropsCE.secondaryDamage.NullOrEmpty())
                {
                    foreach (SecondaryDamage cur in projectilePropsCE.secondaryDamage)
                    {
                        if (hitThing.Destroyed)
                        {
                            break;
                        }
                        var secDinfo = new DamageInfo(
                            cur.def,
                            cur.amount,
                            projectilePropsCE.GetArmorPenetration(1), //Armor Penetration
                            ExactRotation.eulerAngles.y,
                            launcher,
                            null,
                            def
                            );
                        hitThing.TakeDamage(secDinfo).AssociateWithLog(logEntry);
                    }
                }
            }
            else
            {
                SoundDefOf.BulletImpact_Ground.PlayOneShot(new TargetInfo(base.Position, map, false));

                //Only display a dirt/water hit for projectiles with a dropshadow
                if (base.castShadow)
                {
                    MoteMaker.MakeStaticMote(this.ExactPosition, map, ThingDefOf.Mote_ShotHit_Dirt, 1f);
                    if (base.Position.GetTerrain(map).takeSplashes)
                    {
                        MoteMaker.MakeWaterSplash(this.ExactPosition, map, Mathf.Sqrt(def.projectile.GetDamageAmount(this.launcher)) * 1f, 4f);
                    }
                }
            }
            base.Impact(hitThing);
        }
        public static bool Prefix(ProjectileCE __instance, Thing ___launcher, IntVec3 ___originInt, Vector2 ___origin, Vector2 ___destinationInt, int ___startingTicksToImpactInt, int ___ticksToImpact, int ___intTicksToImpact, ThingDef ___equipmentDef, ref float ___suppressionAmount, Thing hitThing)
        {
            if (hitThing != null)
            {
                bool  Rending       = false;
                float RendingChance = 0.167f;
                Pawn  caster        = ___launcher as Pawn;
                Thing Launcher      = ___launcher;
                if (caster != null)
                {
                    if (caster.equipment != null)
                    {
                        //    Log.Warning(string.Format("___launcher: {0}", ___launcher));
                        if (caster.equipment.Primary != null)
                        {
                            //    Log.Warning(string.Format("caster.equipment != null"));
                            Launcher = caster.equipment.Primary;
                            //    Log.Warning(string.Format("Launcher = caster.equipment.Primary"));
                            CompWeapon_GunSpecialRules _GunSpecialRules = Launcher.TryGetCompFast <CompWeapon_GunSpecialRules>();
                            if (_GunSpecialRules != null)
                            {
                                //    Log.Warning(string.Format("_GunSpecialRules != null"));
                                Rending       = _GunSpecialRules.Rending;
                                RendingChance = _GunSpecialRules.RendingChance;
                            }
                        }
                        else
                        {
                            //    Log.Warning(string.Format("caster.equipment == null"));
                            if (caster.health.hediffSet.hediffs.Any(x => x.TryGetCompFast <HediffComp_VerbGiverExtra>() != null))
                            {
                                //    Log.Warning(string.Format("HediffComp_VerbGiverExtra: {0}", ___launcher));
                                HediffComp_VerbGiverExtra _VGE = caster.health.hediffSet.hediffs.Find(x => x.TryGetCompFast <HediffComp_VerbGiverExtra>() is HediffComp_VerbGiverExtra z && z.verbTracker.AllVerbs.Any(y => y.verbProps.defaultProjectile == __instance.def)).TryGetCompFast <HediffComp_VerbGiverExtra>();
                                if (_VGE != null)
                                {
                                    //    Log.Warning(string.Format("_VGE != null: {0}", _VGE.parent.LabelCap));
                                    GunVerbEntry entry = _VGE.Props.verbEntrys.Find(x => x.VerbProps.defaultProjectile == __instance.def);
                                    if (entry != null)
                                    {
                                        //    Log.Warning(string.Format("{0}, Rending: {1}, Chance: {2}", entry.VerbProps.label, entry.Rending, entry.RendingChance));
                                        Rending       = entry.Rending;
                                        RendingChance = entry.RendingChance;
                                    }
                                }
                            }
                        }
                    }
                }
                if (Rending)
                {
                    //    Log.Warning(string.Format("Rending: {0}", ___launcher));
                    Rand.PushState();
                    bool RendingEffect = Rand.Chance(RendingChance);
                    Rand.PopState();
                    if (RendingEffect)
                    {
                        DamageDef damageDef = __instance.def.projectile.damageDef;
                        DamageArmorCategoryDef armorCategory = damageDef.armorCategory != null ? damageDef.armorCategory: null;
                        StatDef armorcatdef = damageDef.armorCategory != null ? armorCategory.armorRatingStat : null;
                        float   num         = 0f;
                        float   num2        = Mathf.Clamp01((armorcatdef != null ? hitThing.GetStatValue(armorcatdef, true) : 0f) / 2f);
                        if (hitThing is Pawn hitPawn)
                        {
                            List <BodyPartRecord> allParts = hitPawn.RaceProps.body.AllParts;
                            List <Apparel>        list     = (hitPawn.apparel == null) ? null : hitPawn.apparel.WornApparel;
                            for (int i = 0; i < allParts.Count; i++)
                            {
                                float num3 = 1f - num2;
                                if (list != null)
                                {
                                    for (int j = 0; j < list.Count; j++)
                                    {
                                        if (list[j].def.apparel.CoversBodyPart(allParts[i]))
                                        {
                                            float num4 = Mathf.Clamp01((armorcatdef != null ? list[j].GetStatValue(armorcatdef, true) : 0f) / 2f);
                                            num3 *= 1f - num4;
                                        }
                                    }
                                }
                                num += allParts[i].coverageAbs * (1f - num3);
                            }
                        }
                        num = Mathf.Clamp(num * 2f, 0f, 2f);
                        float armorPenetration = num;

                        MoteMaker.ThrowText(hitThing.PositionHeld.ToVector3(), hitThing.MapHeld, "AdeptusMechanicus.Rending_Shot".Translate(__instance.LabelCap, hitThing.LabelShortCap), 3f);
                        //    Log.Warning(string.Format("ArmorPenetration: {0}", ArmorPenetration));

                        bool flag = ___launcher is AmmoThing;
                        Map  map  = __instance.Map;
                        LogEntry_DamageResult logEntry_DamageResult = null;
                        bool flag2 = __instance.logMisses || (!__instance.logMisses && hitThing != null && (hitThing is Pawn || hitThing is Building_Turret));
                        if (flag2)
                        {
                            bool flag3 = !flag;
                            if (flag3)
                            {
                                LogImpact(__instance, ___launcher, ___equipmentDef, hitThing, out logEntry_DamageResult);
                            }
                        }
                        bool flag4 = hitThing != null;
                        if (flag4)
                        {
                            int damageAmount = __instance.def.projectile.GetDamageAmount(1f, null);
                            DamageDefExtensionCE   damageDefExtensionCE   = __instance.def.projectile.damageDef.GetModExtension <DamageDefExtensionCE>() ?? new DamageDefExtensionCE();
                            ProjectilePropertiesCE projectilePropertiesCE = (ProjectilePropertiesCE)__instance.def.projectile;
                            //    float armorPenetration = (this.def.projectile.damageDef.armorCategory == DamageArmorCategoryDefOf.Sharp) ? projectilePropertiesCE.armorPenetrationSharp : projectilePropertiesCE.armorPenetrationBlunt;
                            DamageInfo     damageInfo          = new DamageInfo(__instance.def.projectile.damageDef, (float)damageAmount, armorPenetration, __instance.ExactRotation.eulerAngles.y, ___launcher, null, __instance.def, DamageInfo.SourceCategory.ThingOrUnknown, null);
                            BodyPartDepth  depth               = (damageDefExtensionCE != null && damageDefExtensionCE.harmOnlyOutsideLayers) ? BodyPartDepth.Outside : BodyPartDepth.Undefined;
                            BodyPartHeight collisionBodyHeight = new CollisionVertical(hitThing).GetCollisionBodyHeight(__instance.ExactPosition.y);
                            damageInfo.SetBodyRegion(collisionBodyHeight, depth);
                            bool flag5 = damageDefExtensionCE != null && damageDefExtensionCE.harmOnlyOutsideLayers;
                            if (flag5)
                            {
                                damageInfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside);
                            }
                            bool flag6 = flag && hitThing is Pawn;
                            if (flag6)
                            {
                                logEntry_DamageResult = new BattleLogEntry_DamageTaken((Pawn)hitThing, DefDatabase <RulePackDef> .GetNamed("DamageEvent_CookOff", true), null);
                                Find.BattleLog.Add(logEntry_DamageResult);
                            }
                            try
                            {
                                hitThing.TakeDamage(damageInfo).AssociateWithLog(logEntry_DamageResult);
                                bool flag7 = !(hitThing is Pawn) && projectilePropertiesCE != null && !projectilePropertiesCE.secondaryDamage.NullOrEmpty <SecondaryDamage>();
                                if (flag7)
                                {
                                    foreach (SecondaryDamage secondaryDamage in projectilePropertiesCE.secondaryDamage)
                                    {
                                        bool destroyed = hitThing.Destroyed;
                                        if (destroyed)
                                        {
                                            break;
                                        }
                                        DamageInfo dinfo = secondaryDamage.GetDinfo(damageInfo);
                                        hitThing.TakeDamage(dinfo).AssociateWithLog(logEntry_DamageResult);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Log.Error("CombatExtended :: BulletCE impacting thing " + hitThing.LabelCap + " of def " + hitThing.def.LabelCap + " added by mod " + hitThing.def.modContentPack.Name + ". See following stacktrace for information.", false);
                                throw ex;
                            }
                            finally
                            {
                                Impact(__instance, ___launcher, ___equipmentDef, hitThing, ___originInt, ___origin, ___destinationInt, ___startingTicksToImpactInt, ___ticksToImpact, ___intTicksToImpact, ref ___suppressionAmount);
                            }
                        }
                        else
                        {
                            SoundDefOf.BulletImpact_Ground.PlayOneShot(new TargetInfo(__instance.Position, map, false));
                            bool castShadow = __instance.castShadow;
                            if (castShadow)
                            {
                                FleckMaker.Static(__instance.ExactPosition, map, FleckDefOf.ShotHit_Dirt, 1f);
                                bool takeSplashes = __instance.Position.GetTerrain(map).takeSplashes;
                                if (takeSplashes)
                                {
                                    FleckMaker.WaterSplash(__instance.ExactPosition, map, Mathf.Sqrt((float)__instance.def.projectile.GetDamageAmount(___launcher, null)) * 1f, 4f);
                                }
                            }
                            Impact(__instance, ___launcher, ___equipmentDef, hitThing, ___originInt, ___origin, ___destinationInt, ___startingTicksToImpactInt, ___ticksToImpact, ___intTicksToImpact, ref ___suppressionAmount);
                        }
                        NotifyImpact(__instance, ___launcher, hitThing, map, __instance.Position);
                    }
                    return(false);
                }
            }
            return(true);
        }