private void interceptPods(bool flag_InterceptDropPod) { if (!this.shieldInterceptDropPod || !flag_InterceptDropPod) { return; } IEnumerable <Thing> source = (IEnumerable <Thing>)Find.get_ListerThings().ThingsOfDef((ThingDef)ThingDefOf.DropPod); if (source == null) { return; } using (List <Thing> .Enumerator enumerator = source.Where <Thing>((Func <Thing, bool>)(t => { IntVec3 position = t.get_Position(); // ISSUE: explicit reference operation return(((IntVec3)@position).InHorDistOf(this.position, (float)this.shieldShieldRadius)); })).ToList <Thing>().GetEnumerator()) { while (enumerator.MoveNext()) { DropPod current = (DropPod)enumerator.Current; ((Thing)current).Destroy((DestroyMode)0); BodyPartDamageInfo bodyPartDamageInfo = new BodyPartDamageInfo(new BodyPartHeight?(), new BodyPartDepth?((BodyPartDepth)2)); ExplosionInfo explosionInfo = (ExplosionInfo)null; explosionInfo.center = (__Null)((Thing)current).get_Position(); explosionInfo.radius = (__Null)1.0; explosionInfo.dinfo = (__Null) new DamageInfo((DamageDef)DamageDefOf.Flame, 10, (Thing)current, new BodyPartDamageInfo?(), (ThingDef)null); // ISSUE: explicit reference operation ((ExplosionInfo)@explosionInfo).DoExplosion(); } } }
/// <summary> /// Impacts a pawn/object or the ground. /// </summary> protected override void Impact(Thing hitThing) { if (hitThing != null) { int damageAmountBase = this.def.projectile.damageAmountBase; BodyPartDamageInfo value = new BodyPartDamageInfo(null, null); DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.launcher, this.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), this.equipmentDef); hitThing.TakeDamage(dinfo); hitThing.def.soundImpactDefault.PlayOneShot(this.DestinationCell); if (this.canStartFire && Rand.Range(0f, 1f) > startFireChance) { hitThing.TryAttachFire(0.05f); } Pawn pawn = hitThing as Pawn; if (pawn != null) { MoteMaker.ThrowMicroSparks(this.destination); MoteMaker.MakeStaticMote(this.destination, ThingDefOf.Mote_ShotHit_Dirt, 1f); } } else { SoundDefOf.BulletImpactGround.PlayOneShot(base.Position); MoteMaker.MakeStaticMote(this.ExactPosition, ThingDefOf.Mote_ShotHit_Dirt, 1f); MoteMaker.ThrowMicroSparks(this.ExactPosition); } }
protected override void Impact(Thing hitThing) { base.Impact(hitThing); if (hitThing != null) { int damageAmountBase = this.def.projectile.damageAmountBase; BodyPartDamageInfo value; DamageDef_CR damDefCR = def.projectile.damageDef as DamageDef_CR; if (damDefCR != null && damDefCR.harmOnlyOutsideLayers) { value = new BodyPartDamageInfo(null, BodyPartDepth.Outside); } else { value = new BodyPartDamageInfo(null, null); } DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.launcher, this.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), this.def); ProjectilePropertiesCR propsCR = def.projectile as ProjectilePropertiesCR; if (propsCR != null && !propsCR.secondaryDamage.NullOrEmpty()) { // Get the correct body part Pawn pawn = hitThing as Pawn; if (pawn != null && def.projectile.damageDef.workerClass == typeof(DamageWorker_AddInjuryCR)) { dinfo = new DamageInfo(dinfo.Def, dinfo.Amount, dinfo.Instigator, dinfo.Angle, new BodyPartDamageInfo(DamageWorker_AddInjuryCR.GetExactPartFromDamageInfo(dinfo, pawn), false, (HediffDef)null), dinfo.Source); } List <DamageInfo> dinfoList = new List <DamageInfo>() { dinfo }; foreach (SecondaryDamage secDamage in propsCR.secondaryDamage) { dinfoList.Add(new DamageInfo(secDamage.def, secDamage.amount, dinfo.Instigator, dinfo.Part, dinfo.Source)); } foreach (DamageInfo curDinfo in dinfoList) { hitThing.TakeDamage(curDinfo); } } else { hitThing.TakeDamage(dinfo); } } else { SoundDefOf.BulletImpactGround.PlayOneShot(base.Position); MoteThrower.ThrowStatic(this.ExactPosition, ThingDefOf.Mote_ShotHit_Dirt, 1f); } }
//Explosion method private void ExplosionThing(IntVec3 position) { BodyPartDamageInfo value1 = new BodyPartDamageInfo(null, new BodyPartDepth?(BodyPartDepth.Outside)); //What body parts will be damaged, you can use Inside, Outside and Inherit(no ide what this means and do) ExplosionInfo explosionInfo = new ExplosionInfo(); //This create new explosion instance explosionInfo.center = position; // Center of explosion, if hitThing exist it will use hitThing position, if not then it will use bullet position explosionInfo.radius = UnityEngine.Random.Range(1f, 5f); // This is randome range from 1 to 5 but you can set any you want. "Exeample: explosionInfo.radius =5f" this is 5 square radius explosionInfo.dinfo = new DamageInfo(this.def.projectile.damageDef, this.def.projectile.damageAmountBase, this.launcher, new BodyPartDamageInfo?(value1), null);// This packs all our explosion info stuff above into dinfo so explosion class can use it(i think :D) explosionInfo.DoExplosion(); // This starts explosion class with our info pack to do BOOM! }
private void Command_Detonate() { radius = base.GetComp <CompExplosive>().props.explosiveRadius; dmgdef = base.GetComp <CompExplosive>().props.explosiveDamageType; BodyPartDamageInfo value = new BodyPartDamageInfo(null, new BodyPartDepth?(BodyPartDepth.Outside)); ExplosionInfo explosionInfo = default(ExplosionInfo); explosionInfo.center = base.Position; explosionInfo.radius = radius; explosionInfo.dinfo = new DamageInfo(dmgdef, 30, this, new BodyPartDamageInfo?(value), null); explosionInfo.Explode(); }
protected virtual void Explode() { this.Destroy(DestroyMode.Vanish); BodyPartDamageInfo value = new BodyPartDamageInfo(null, new BodyPartDepth?(BodyPartDepth.Outside)); ExplosionInfo explosionInfo = default(ExplosionInfo); explosionInfo.center = base.Position; explosionInfo.radius = this.def.projectile.explosionRadius; explosionInfo.dinfo = new DamageInfo(this.def.projectile.damageDef, 999, this.launcher, new BodyPartDamageInfo?(value), null); explosionInfo.postExplosionSpawnThingDef = this.def.projectile.postExplosionSpawnThingDef; explosionInfo.explosionSpawnChance = this.def.projectile.explosionSpawnChance; explosionInfo.explosionSound = this.def.projectile.soundExplode; explosionInfo.projectile = this.def; explosionInfo.DoExplosion(); }
private void CheckDuplicateSmallPawnDamageToPartParent(DamageInfo dinfo, Pawn pawn, ref DamageWorker_AddInjuryCR.LocalInjuryResult result) { if (!dinfo.AllowDamagePropagation) { return; } if (result.lastHitPart != null && dinfo.Def.harmsHealth && result.lastHitPart != pawn.RaceProps.body.corePart && result.lastHitPart.parent != null && pawn.health.hediffSet.GetPartHealth(result.lastHitPart.parent) > 0f && dinfo.Amount >= 10 && pawn.HealthScale <= 0.5001f) { DamageInfo dinfo2 = dinfo; BodyPartDamageInfo part = new BodyPartDamageInfo(result.lastHitPart.parent, false); dinfo2.SetPart(part); this.ApplyDamagePartial(dinfo2, pawn, ref result); } }
protected virtual void Explode() { this.Destroy(DestroyMode.Vanish); BodyPartDamageInfo value = new BodyPartDamageInfo(null, new BodyPartDepth?(BodyPartDepth.Outside)); ExplosionInfo explosionInfo = default(ExplosionInfo); explosionInfo.center = base.Position; explosionInfo.radius = this.def.projectile.explosionRadius; explosionInfo.dinfo = new DamageInfo(DamageDefOf.Bomb, 999, this.launcher, new BodyPartDamageInfo?(value), null); explosionInfo.postExplosionSpawnThingDef = this.def.projectile.postExplosionSpawnThingDef; explosionInfo.explosionSpawnChance = this.def.projectile.explosionSpawnChance; explosionInfo.explosionSound = this.def.projectile.soundExplode; explosionInfo.projectile = this.def; explosionInfo.DoExplosion(); ThrowBigExplode(explosionInfo.center.ToVector3Shifted() + Gen.RandomHorizontalVector(explosionInfo.radius * 0.7f), explosionInfo.radius * 0.6f); }
private void Command_Detonate() { radius = base.GetComp <CompExplosive>().props.explosiveRadius; dmgdef = base.GetComp <CompExplosive>().props.explosiveDamageType; this.Destroy(DestroyMode.Vanish); BodyPartDamageInfo value = new BodyPartDamageInfo(null, new BodyPartDepth?(BodyPartDepth.Outside)); ExplosionInfo explosionInfo = default(ExplosionInfo); explosionInfo.center = Position; explosionInfo.radius = radius; explosionInfo.dinfo = new DamageInfo(dmgdef, 100, this, new BodyPartDamageInfo?(value), null); explosionInfo.Explode(); explosionInfo.dinfo = new DamageInfo(dmgdef, 100, this, new BodyPartDamageInfo?(value), null); explosionInfo.dinfo = new DamageInfo(dmgdef, 100, this, new BodyPartDamageInfo?(value), null); explosionInfo.dinfo = new DamageInfo(dmgdef, 100, this, new BodyPartDamageInfo?(value), null); MoteMaker.TryThrowMicroSparks(Position.ToVector3Shifted()); if (Position.GetRoof() != null) { if (Find.RoofGrid.RoofDefAt(Position).isThickRoof == true) { RoofDef roofType = DefDatabase <RoofDef> .GetNamed("RoofRockThin"); Find.RoofGrid.SetRoof(Position, roofType); } else { Find.RoofGrid.SetRoof(Position, null); } } foreach (IntVec3 current in GenAdj.AdjacentSquares8Way(this)) { if (current.GetRoof() != null) { if (Find.RoofGrid.RoofDefAt(current).isThickRoof == true) { RoofDef roofType = DefDatabase <RoofDef> .GetNamed("RoofRockThin"); Find.RoofGrid.SetRoof(current, roofType); } else { Find.RoofGrid.SetRoof(current, null); } } } }
/// <summary> /// Damages the pawn. /// </summary> /// <param name="pawn">The pawn.</param> protected override void InteractWithPawn(Pawn pawn) { var bodyPartDamageInfo = new BodyPartDamageInfo(GetDamagedBodyPartHeight(), BodyPartDepth.Outside); var num = Mathf.RoundToInt(this.GetStatValue(StatDefOf.TrapMeleeDamage)*TrapDamageFactor.RandomInRange); var randomInRange = DamageCount.RandomInRange; for (var index = 0; index < randomInRange && num > 0; ++index) { var amount = Mathf.Max(1, Mathf.RoundToInt(Rand.Value*num)); num -= amount; pawn.TakeDamage(new DamageInfo(DamageDefOf.Stab, amount, this, bodyPartDamageInfo)); } }
protected override void DoWork(TargetInfo target, out bool finished) { BodyPartDamageInfo bodyPartDamageInfo = new BodyPartDamageInfo(BodyPartHeight.Top, BodyPartDepth.Outside); DamageInfo dinfo = new DamageInfo(DamageDefOf.Mining, amount, caster, bodyPartDamageInfo); target.Thing.TakeDamage(dinfo); if (target.ThingDestroyed) { MineStrikeManager.CheckStruckOre(target.Cell, target.Thing.def, caster); finished = true; } else { finished = false; } }
protected override void Impact(Thing hitThing) { base.Impact(hitThing); if (hitThing != null) { int damageAmountBase = this.def.projectile.damageAmountBase; BodyPartDamageInfo value = new BodyPartDamageInfo(null, null); DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.launcher, this.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), this.equipment); hitThing.TakeDamage(dinfo); ExplosionThing(hitThing.Position);//Explosion method luncher } else { SoundDefOf.BulletImpactGround.PlayOneShot(base.Position); MoteThrower.ThrowStatic(this.ExactPosition, ThingDefOf.Mote_ShotHit_Dirt, 1f); ExplosionThing(this.Position);//Explosion method luncher } }
/// <summary> /// Impacts a pawn/object or the ground. /// </summary> protected override void Impact(Thing hitThing) { if (hitThing != null) { int damageAmountBase = this.def.projectile.damageAmountBase; BodyPartDamageInfo value = new BodyPartDamageInfo(null, null); DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.launcher, this.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), this.equipmentDef); hitThing.TakeDamage(dinfo); hitThing.def.soundImpactDefault.PlayOneShot(this.DestinationCell); Pawn pawn = hitThing as Pawn; if (pawn != null && !pawn.Downed && Rand.Value < Projectile_LaserRifle.stunChance) { hitThing.TakeDamage(new DamageInfo(DamageDefOf.Stun, 10, this.launcher, null, null)); } } else { MoteThrower.ThrowStatic(this.destination, ThingDefOf.Mote_MicroSparks); } }
protected override void Impact(Thing hitThing) { base.Impact(hitThing); if (hitThing != null) { float height = this.GetProjectileHeight(this.shotHeight, this.distanceFromOrigin, this.shotAngle, this.shotSpeed); int damageAmountBase = this.def.projectile.damageAmountBase; BodyPartHeight? bodyPartHeight = null; Pawn pawn = hitThing as Pawn; if (pawn != null && pawn.GetPosture() == PawnPosture.Standing) //Downed pawns randomly get damaged wherever, I guess { float fullHeight = Utility.GetCollisionHeight(hitThing); float percentOfBodySize = height / fullHeight; if (percentOfBodySize >= 0.8) { bodyPartHeight = BodyPartHeight.Top; } else { if (percentOfBodySize < 0.45) { bodyPartHeight = BodyPartHeight.Bottom; } else { bodyPartHeight = BodyPartHeight.Middle; } } } //All the rest is handled further on - Even the BodyPartHeight not existing doesn't matter. BodyPartDamageInfo value = new BodyPartDamageInfo(bodyPartHeight, null); DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.launcher, this.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), this.equipmentDef); hitThing.TakeDamage(dinfo); } else { SoundDefOf.BulletImpactGround.PlayOneShot(base.Position); MoteThrower.ThrowStatic(this.ExactPosition, ThingDefOf.Mote_ShotHit_Dirt, 1f); } }
protected override void Impact(Thing hitThing) { base.Impact(hitThing); if (hitThing != null) { float height = this.GetProjectileHeight(this.shotHeight, this.distanceFromOrigin, this.shotAngle, this.shotSpeed); int damageAmountBase = this.def.projectile.damageAmountBase; BodyPartHeight?bodyPartHeight = null; Pawn pawn = hitThing as Pawn; if (pawn != null && pawn.GetPosture() == PawnPosture.Standing) //Downed pawns randomly get damaged wherever, I guess { float fullHeight = Utility.GetCollisionHeight(hitThing); float percentOfBodySize = height / fullHeight; if (percentOfBodySize >= 0.8) { bodyPartHeight = BodyPartHeight.Top; } else { if (percentOfBodySize < 0.45) { bodyPartHeight = BodyPartHeight.Bottom; } else { bodyPartHeight = BodyPartHeight.Middle; } } } //All the rest is handled further on - Even the BodyPartHeight not existing doesn't matter. BodyPartDamageInfo value = new BodyPartDamageInfo(bodyPartHeight, null); DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.launcher, this.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), this.equipmentDef); hitThing.TakeDamage(dinfo); } else { SoundDefOf.BulletImpactGround.PlayOneShot(base.Position); MoteThrower.ThrowStatic(this.ExactPosition, ThingDefOf.Mote_ShotHit_Dirt, 1f); } }
private void KillFormerBearer() { this.RemoveBannerBlessings(); if (this.lastBearer == null) { Log.Warning("Humakt's Raven Banner tried to kill a null bearer!"); return; } if (this.lastBearer.corpse != null) { Log.Warning("Humakt's Raven Banner can't kill bearer " + lastBearer.Label + ", bearer is already dead!"); this.lastBearer = null; return; } Messages.Message("Once hoisted, Humakt's Raven Banner cannot be laid down without its due in death!", this.lastBearer, MessageSound.Negative); int cuts = 0; while (this.lastBearer.corpse == null && cuts < 100) { var brainRecord = this.lastBearer.health.hediffSet.GetBrain(); BodyPartDamageInfo value = new BodyPartDamageInfo(brainRecord, false); var dinfo = new DamageInfo(DamageDefOf.ExecutionCut, 9999, this, value, null); dinfo.AllowDamagePropagation = false; this.lastBearer.TakeDamage(dinfo); cuts++; } if (this.lastBearer.corpse == null) { Log.Error("Humakt's Raven Banner could not execute " + this.lastBearer.Label + "!"); } this.lastBearer = null; }
/// <summary> /// Impacts a pawn/object or the ground. /// </summary> protected override void Impact(Thing hitThing) { base.Impact(hitThing); if (hitThing != null) { int damageAmountBase = this.def.projectile.damageAmountBase; BodyPartDamageInfo value = new BodyPartDamageInfo(null, null); DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.launcher, this.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), this.equipmentDef); hitThing.TakeDamage(dinfo); Pawn pawn = hitThing as Pawn; if (pawn != null && !pawn.Downed && Rand.Value < compED.chanceToProc) { MoteThrower.ThrowMicroSparks(this.destination); hitThing.TakeDamage(new DamageInfo(DefDatabase<DamageDef>.GetNamed(compED.damageDef, true), compED.damageAmount, this.launcher, null, null)); } } else { SoundDefOf.BulletImpactGround.PlayOneShot(base.Position); MoteThrower.ThrowStatic(this.ExactPosition, ThingDefOf.Mote_ShotHit_Dirt, 1f); ThrowMicroSparksBlue(this.ExactPosition); } }
/// <summary> /// Impacts a pawn/object or the ground. /// </summary> protected override void Impact(Thing hitThing) { base.Impact(hitThing); if (hitThing != null) { int damageAmountBase = this.def.projectile.damageAmountBase; BodyPartDamageInfo value = new BodyPartDamageInfo(null, null); DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.launcher, this.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), this.equipmentDef); hitThing.TakeDamage(dinfo); Pawn pawn = hitThing as Pawn; if (pawn != null && !pawn.Downed && Rand.Value < Projectile_Plasma.burnChance) { MoteThrower.ThrowMicroSparks(this.destination); hitThing.TryAttachFire(0.1f); } } else { SoundDefOf.BulletImpactGround.PlayOneShot(base.Position); MoteThrower.ThrowStatic(this.ExactPosition, ThingDefOf.Mote_ShotHit_Dirt, 1f); ThrowMicroSparksGreen(this.ExactPosition); } }
private void PawnResting(Pawn p) { if (p.needs.rest.CurLevel < 1) { float restEffectiveness = this.GetStatValue(StatDefOf.BedRestEffectiveness, true); p.needs.rest.CurLevel += (restEffectiveness / 100); int amount = 6; int num = this.def.building.bed_healTickInterval; if (p.health.hediffSet.GetNaturallyHealingInjuredParts().Any<BodyPartRecord>() && p.needs.food != null && !p.needs.food.Starving) { BodyPartRecord part = p.health.hediffSet.GetNaturallyHealingInjuredParts().RandomElement<BodyPartRecord>(); List<HediffDef> healHediff = ( from def in DefDatabase<HediffDef>.AllDefs where def.naturallyHealed select def).ToList<HediffDef>(); BodyPartDamageInfo value = new BodyPartDamageInfo(part, false, healHediff); p.TakeDamage(new DamageInfo(DamageDefOf.HealInjury, amount, null, new BodyPartDamageInfo?(value), null)); if (p.health.ShouldGetTreatment && p.health.WantsToRemainInBedForMedicine && p.health.hediffSet.GetNaturallyHealingInjuredParts().Any<BodyPartRecord>()) { object[] args = new object[] { p.LabelBaseShort }; Messages.Message("MessageFullyHealed".Translate(args), MessageSound.Benefit); } } } }
private void ProtectSquare(IntVec3 square) { if (!square.InBounds()) { return; } List<Thing> list = Find.ThingGrid.ThingsListAt(square); List<Thing> list2 = new List<Thing>(); int i = 0; int num = list.Count<Thing>(); while (i < num) { if (list[i] != null && list[i] is Projectile) { Projectile projectile = (Projectile)list[i]; if (!projectile.Destroyed) { bool flag = true; if (flag) { Quaternion exactRotation = projectile.ExactRotation; Vector3 exactPosition = projectile.ExactPosition; exactPosition.y = 0f; Vector3 b = Vectors.IntVecToVec(this.Position); b.y = 0f; Quaternion b2 = Quaternion.LookRotation(exactPosition - b); if (Quaternion.Angle(exactRotation, b2) > 90f) { MoteThrower.ThrowLightningGlow(projectile.ExactPosition, 0.5f); Building_DefenceShield.SoundAbsorbDamage.PlayOneShot(projectile.Position); int damageAmountBase = projectile.def.projectile.damageAmountBase; BodyPartDamageInfo value = new BodyPartDamageInfo(null, null); DamageInfo dinfo = new DamageInfo(projectile.def.projectile.damageDef, damageAmountBase, projectile, projectile.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), null); this.AbsorbedDamage(dinfo); list2.Add(projectile); if (!this.ShouldDisplay) { break; } } } } } i++; } foreach (Thing current in list2) { current.Destroy(DestroyMode.Vanish); } }
/// <summary> /// Damages the pawn. /// </summary> /// <param name="pawn">The pawn.</param> protected override void InteractWithPawn(Pawn pawn) { var bodyPartDamageInfo = new BodyPartDamageInfo(BodyPartHeight.Bottom, BodyPartDepth.Outside); pawn.TakeDamage(new DamageInfo(TrapDef.TrapDamageDef, Mathf.CeilToInt(_damageRange.RandomInRange), this, bodyPartDamageInfo)); }
protected override void Impact(Thing hitThing) { base.Impact(hitThing); if (hitThing != null) { Pawn victim = hitThing as Pawn; if (victim != null) { if (mpdef.IsMentalStateGiver) { string str = "MentalStateByPsyker".Translate(new object[] { victim.NameStringShort, }); if (mpdef.InducesMentalState == MentalStateDefOf.Berserk && victim.RaceProps.intelligence < Intelligence.Humanlike) { if (CanOverpowerMind(this.Caster, victim)) { victim.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter, str, true); } } else { if (CanOverpowerMind(this.Caster, victim)) { victim.mindState.mentalStateHandler.TryStartMentalState(mpdef.InducesMentalState, str, true); } } } else if (mpdef.IsBuffGiver && victim.needs.TryGetNeed <Need_Soul>().PsykerPowerLevel != PsykerPowerLevel.Omega) { if (mpdef.BuffDef.isBad) { if (CanOverpowerMind(this.Caster, victim)) { victim.health.AddHediff(mpdef.BuffDef); } } else { victim.health.AddHediff(mpdef.BuffDef); } } else if (mpdef.IsHealer) { List <Hediff> list = victim.health.hediffSet.hediffs.Where(x => x.def != HediffDefOf.PsychicShock && x.def != CorruptionDefOfs.DemonicPossession).ToList <Hediff>(); if (Rand.Range(0f, 1f) > this.mpdef.HealFailChance && victim.health.hediffSet.hediffs.Count > 0) { for (int i = 0; i < mpdef.HealCapacity + 1; i++) { Hediff hediff = list.RandomElement(); hediff.DirectHeal(this.def.projectile.damageAmountBase); } } } else { int damageAmountBase = this.def.projectile.damageAmountBase; BodyPartDamageInfo value = new BodyPartDamageInfo(null, null); DamageInfo dinfo = new DamageInfo(this.def.projectile.damageDef, damageAmountBase, this.launcher, this.ExactRotation.eulerAngles.y, new BodyPartDamageInfo?(value), this.equipmentDef); hitThing.TakeDamage(dinfo); } } } else { SoundDefOf.PowerOffSmall.PlayOneShot(base.Position); MoteMaker.MakeStaticMote(this.ExactPosition, ThingDefOf.Mote_ShotHit_Spark, 1f); } }
private void interceptPods(bool flag_InterceptDropPod) { if (this.shieldInterceptDropPod && flag_InterceptDropPod) { IEnumerable<Thing> dropPods = Find.ListerThings.ThingsOfDef(ThingDefOf.DropPod); if (dropPods != null) { //Test to protect the entire map from droppods. //IEnumerable<Thing> closeFires = dropPods.Where<Thing>(t => t.Position.InHorDistOf(this.position, 9999999.0f)); IEnumerable<Thing> closeFires = dropPods.Where<Thing>(t => t.Position.InHorDistOf(this.position, this.shieldShieldRadius)); foreach (RimWorld.DropPod currentDropPod in closeFires.ToList()) { //currentDropPod.Destroy(); currentDropPod.Destroy(DestroyMode.Vanish); BodyPartDamageInfo bodyPartDamageInfo = new BodyPartDamageInfo(new BodyPartHeight?(), new BodyPartDepth?(BodyPartDepth.Outside)); new ExplosionInfo() { center = currentDropPod.Position, radius = 1, //dinfo = new DamageInfo(this.def.projectile.damageDef, 999, currentDropPod, new BodyPartDamageInfo?(bodyPartDamageInfo), (ThingDef)null), dinfo = new DamageInfo(DamageDefOf.Flame, 10, currentDropPod) //preExplosionSpawnThingDef = this.def.projectile.preExplosionSpawnThingDef, //postExplosionSpawnThingDef = this.def.projectile.postExplosionSpawnThingDef, //explosionSpawnChance = this.def.projectile.explosionSpawnChance, //explosionSound = this.def.projectile.soundExplode, //projectile = this.def }.DoExplosion(); } } } }