protected virtual void defaultDamageThing(Explosion explosion, Thing t, List <Thing> damagedThings, IntVec3 cell) { if (t.def.category != ThingCategory.Mote && t.def.category != ThingCategory.Ethereal) { if (!damagedThings.Contains(t)) { damagedThings.Add(t); if (this.def == DamageDefOf.Bomb && t.def == ThingDefOf.Fire && !t.Destroyed) { t.Destroy(DestroyMode.Vanish); } else { float num; if (t.Position == explosion.Position) { num = (float)Rand.RangeInclusive(0, 359); } else { num = (t.Position - explosion.Position).AngleFlat; } DamageDef damageDef = this.def; float amount = (float)explosion.GetDamageAmountAt(cell); float armorPenetrationAt = explosion.GetArmorPenetrationAt(cell); float angle = num; Thing instigator = explosion.instigator; ThingDef weapon = explosion.weapon; DamageInfo dinfo = new DamageInfo(damageDef, amount, armorPenetrationAt, angle, instigator, null, weapon, DamageInfo.SourceCategory.ThingOrUnknown, explosion.intendedTarget); if (this.def.explosionAffectOutsidePartsOnly) { dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); } if (t.def.category == ThingCategory.Building) { int num2 = Mathf.RoundToInt(dinfo.Amount * this.def.explosionBuildingDamageFactor); dinfo.SetAmount((float)num2); } else if (t.def.category == ThingCategory.Plant) { int num3 = Mathf.RoundToInt(dinfo.Amount * this.def.explosionPlantDamageFactor); dinfo.SetAmount((float)num3); } BattleLogEntry_ExplosionImpact battleLogEntry_ExplosionImpact = null; Pawn pawn = t as Pawn; if (pawn != null) { battleLogEntry_ExplosionImpact = new BattleLogEntry_ExplosionImpact(explosion.instigator, t, explosion.weapon, explosion.projectile, this.def); Find.BattleLog.Add(battleLogEntry_ExplosionImpact); } DamageWorker.DamageResult damageResult = t.TakeDamage(dinfo); damageResult.AssociateWithLog(battleLogEntry_ExplosionImpact); if (pawn != null && damageResult.wounded && pawn.stances != null) { pawn.stances.StaggerFor(95); } } } } }
public override void OnIntervalPassed(Pawn pawn, Hediff cause) { float ambientTemperature = pawn.AmbientTemperature; FloatRange floatRange = pawn.ComfortableTemperatureRange(); FloatRange floatRange2 = pawn.SafeTemperatureRange(); HediffSet hediffSet = pawn.health.hediffSet; Hediff firstHediffOfDef = hediffSet.GetFirstHediffOfDef(this.hediff, false); if (ambientTemperature > floatRange2.max) { float num = ambientTemperature - floatRange2.max; num = HediffGiver_Heat.TemperatureOverageAdjustmentCurve.Evaluate(num); float num2 = num * 6.45E-05f; num2 = Mathf.Max(num2, 0.000375f); HealthUtility.AdjustSeverity(pawn, this.hediff, num2); } else if (firstHediffOfDef != null && ambientTemperature < floatRange.max) { float num3 = firstHediffOfDef.Severity * 0.027f; num3 = Mathf.Clamp(num3, 0.0015f, 0.015f); firstHediffOfDef.Severity -= num3; } if (pawn.Dead) { return; } if (pawn.IsNestedHashIntervalTick(60, 420)) { float num4 = floatRange.max + 150f; if (ambientTemperature > num4) { float num5 = ambientTemperature - num4; num5 = HediffGiver_Heat.TemperatureOverageAdjustmentCurve.Evaluate(num5); int num6 = Mathf.Max(GenMath.RoundRandom(num5 * 0.06f), 3); DamageInfo dinfo = new DamageInfo(DamageDefOf.Burn, (float)num6, 0f, -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown, null); dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); pawn.TakeDamage(dinfo); if (pawn.Faction == Faction.OfPlayer) { Find.TickManager.slower.SignalForceNormalSpeed(); if (MessagesRepeatAvoider.MessageShowAllowed("PawnBeingBurned", 60f)) { Messages.Message("MessagePawnBeingBurned".Translate(new object[] { pawn.LabelShort }).CapitalizeFirst(), pawn, MessageTypeDefOf.ThreatSmall, true); } } Lord lord = pawn.GetLord(); if (lord != null) { lord.ReceiveMemo(HediffGiver_Heat.MemoPawnBurnedByAir); } } } }
protected virtual void ExplosionDamageThing(Explosion explosion, Thing t, List <Thing> damagedThings, IntVec3 cell) { if (t.def.category == ThingCategory.Mote) { return; } if (damagedThings.Contains(t)) { return; } damagedThings.Add(t); if (this.def == DamageDefOf.Bomb && t.def == ThingDefOf.Fire && !t.Destroyed) { t.Destroy(DestroyMode.Vanish); return; } float num; if (t.Position == explosion.Position) { num = (float)Rand.RangeInclusive(0, 359); } else { num = (t.Position - explosion.Position).AngleFlat; } DamageDef damageDef = this.def; int amount = explosion.GetDamageAmountAt(cell); float angle = num; Thing instigator = explosion.instigator; ThingDef weapon = explosion.weapon; DamageInfo dinfo = new DamageInfo(damageDef, amount, angle, instigator, null, weapon, DamageInfo.SourceCategory.ThingOrUnknown); if (this.def.explosionAffectOutsidePartsOnly) { dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); } if (t.def.category == ThingCategory.Building) { int num2 = Mathf.RoundToInt((float)dinfo.Amount * this.def.explosionBuildingDamageFactor); damageDef = this.def; amount = num2; angle = dinfo.Angle; instigator = explosion.instigator; weapon = dinfo.Weapon; dinfo = new DamageInfo(damageDef, amount, angle, instigator, null, weapon, DamageInfo.SourceCategory.ThingOrUnknown); } BattleLogEntry_ExplosionImpact battleLogEntry_ExplosionImpact = null; if (t is Pawn) { battleLogEntry_ExplosionImpact = new BattleLogEntry_ExplosionImpact(explosion.instigator, t, explosion.weapon, explosion.projectile, this.def); Find.BattleLog.Add(battleLogEntry_ExplosionImpact); } t.TakeDamage(dinfo).InsertIntoLog(battleLogEntry_ExplosionImpact); }
// Token: 0x060004DA RID: 1242 RVA: 0x000187A4 File Offset: 0x000169A4 protected override void ExplosionDamageThing(Explosion explosion, Thing t, List <Thing> damagedThings, List <Thing> ignoredThings, IntVec3 cell) { if (t.def.category == ThingCategory.Mote || t.def.category == ThingCategory.Ethereal) { return; } if (damagedThings.Contains(t)) { return; } damagedThings.Add(t); if (ignoredThings != null && ignoredThings.Contains(t)) { return; } if (this.def == DamageDefOf.Bomb && t.def == ThingDefOf.Fire && !t.Destroyed) { t.Destroy(DestroyMode.Vanish); return; } float angle; if (t.Position == explosion.Position) { angle = (float)Rand.RangeInclusive(0, 359); } else { angle = (t.Position - explosion.Position).AngleFlat; } DamageInfo dinfo = new DamageInfo(this.def, (float)explosion.GetDamageAmountAt(cell), explosion.GetArmorPenetrationAt(cell), angle, explosion.instigator, null, explosion.weapon, DamageInfo.SourceCategory.ThingOrUnknown, explosion.intendedTarget); if (this.def.explosionAffectOutsidePartsOnly) { dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); } BattleLogEntry_ExplosionImpact battleLogEntry_ExplosionImpact = null; Pawn pawn = t as Pawn; if (pawn != null) { battleLogEntry_ExplosionImpact = new BattleLogEntry_ExplosionImpact(explosion.instigator, t, explosion.weapon, explosion.projectile, this.def); Find.BattleLog.Add(battleLogEntry_ExplosionImpact); } DamageWorker.DamageResult damageResult = t.TakeDamage(dinfo); damageResult.AssociateWithLog(battleLogEntry_ExplosionImpact); if (pawn != null && damageResult.wounded && pawn.stances != null) { pawn.stances.StaggerFor(95); } }
public override void OnIntervalPassed(Pawn pawn, Hediff cause) { float ambientTemperature = pawn.AmbientTemperature; FloatRange floatRange = pawn.ComfortableTemperatureRange(); FloatRange floatRange2 = pawn.SafeTemperatureRange(); Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(hediff); if (ambientTemperature > floatRange2.max) { float x = ambientTemperature - floatRange2.max; x = TemperatureOverageAdjustmentCurve.Evaluate(x); float a = x * 6.45E-05f; a = Mathf.Max(a, 0.000375f); HealthUtility.AdjustSeverity(pawn, hediff, a); } else if (firstHediffOfDef != null && ambientTemperature < floatRange.max) { float value = firstHediffOfDef.Severity * 0.027f; value = Mathf.Clamp(value, 0.0015f, 0.015f); firstHediffOfDef.Severity -= value; } if (pawn.Dead || !pawn.IsNestedHashIntervalTick(60, 420)) { return; } float num = floatRange.max + 150f; if (!(ambientTemperature > num)) { return; } float x2 = ambientTemperature - num; x2 = TemperatureOverageAdjustmentCurve.Evaluate(x2); int num2 = Mathf.Max(GenMath.RoundRandom(x2 * 0.06f), 3); DamageInfo dinfo = new DamageInfo(DamageDefOf.Burn, num2); dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); pawn.TakeDamage(dinfo); if (pawn.Faction == Faction.OfPlayer) { Find.TickManager.slower.SignalForceNormalSpeed(); if (MessagesRepeatAvoider.MessageShowAllowed("PawnBeingBurned", 60f)) { Messages.Message("MessagePawnBeingBurned".Translate(pawn.LabelShort, pawn), pawn, MessageTypeDefOf.ThreatSmall); } } pawn.GetLord()?.ReceiveMemo(MemoPawnBurnedByAir); }
public override void OnIntervalPassed(Pawn pawn, Hediff cause) { float ambientTemperature = pawn.AmbientTemperature; FloatRange floatRange = pawn.ComfortableTemperatureRange(); FloatRange floatRange2 = pawn.SafeTemperatureRange(); HediffSet hediffSet = pawn.health.hediffSet; Hediff firstHediffOfDef = hediffSet.GetFirstHediffOfDef(base.hediff, false); if (ambientTemperature > floatRange2.max) { float x = ambientTemperature - floatRange2.max; x = HediffGiver_Heat.TemperatureOverageAdjustmentCurve.Evaluate(x); float a = (float)(x * 6.44999963697046E-05); a = Mathf.Max(a, 0.000375f); HealthUtility.AdjustSeverity(pawn, base.hediff, a); } else if (firstHediffOfDef != null && ambientTemperature < floatRange.max) { float value = (float)(firstHediffOfDef.Severity * 0.027000000700354576); value = Mathf.Clamp(value, 0.0015f, 0.015f); firstHediffOfDef.Severity -= value; } if (!pawn.Dead && pawn.IsNestedHashIntervalTick(60, 420)) { float num = (float)(floatRange.max + 150.0); if (ambientTemperature > num) { float x2 = ambientTemperature - num; x2 = HediffGiver_Heat.TemperatureOverageAdjustmentCurve.Evaluate(x2); int amount = Mathf.Max(GenMath.RoundRandom((float)(x2 * 0.059999998658895493)), 3); DamageInfo dinfo = new DamageInfo(DamageDefOf.Burn, amount, -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown); dinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); pawn.TakeDamage(dinfo); if (pawn.Faction == Faction.OfPlayer) { Find.TickManager.slower.SignalForceNormalSpeed(); if (MessagesRepeatAvoider.MessageShowAllowed("PawnBeingBurned", 60f)) { Messages.Message("MessagePawnBeingBurned".Translate(pawn.LabelShort).CapitalizeFirst(), pawn, MessageTypeDefOf.ThreatSmall); } } Lord lord = pawn.GetLord(); if (lord != null) { lord.ReceiveMemo(HediffGiver_Heat.MemoPawnBurnedByAir); } } } }
private static void DropRoofInCellPhaseOne(IntVec3 c, Map map, List <Thing> outCrushedThings) { RoofDef roofDef = map.roofGrid.RoofAt(c); if (roofDef == null) { return; } if (roofDef.collapseLeavingThingDef != null && roofDef.collapseLeavingThingDef.passability == Traversability.Impassable) { for (int i = 0; i < 2; i++) { List <Thing> thingList = c.GetThingList(map); for (int j = thingList.Count - 1; j >= 0; j--) { Thing thing = thingList[j]; RoofCollapserImmediate.TryAddToCrushedThingsList(thing, outCrushedThings); Pawn pawn = thing as Pawn; DamageInfo dinfo; if (pawn != null) { DamageDef crush = DamageDefOf.Crush; float amount = 99999f; float armorPenetration = 999f; BodyPartRecord brain = pawn.health.hediffSet.GetBrain(); dinfo = new DamageInfo(crush, amount, armorPenetration, -1f, null, brain, null, DamageInfo.SourceCategory.Collapse, null); } else { dinfo = new DamageInfo(DamageDefOf.Crush, 99999f, 999f, -1f, null, null, null, DamageInfo.SourceCategory.Collapse, null); dinfo.SetBodyRegion(BodyPartHeight.Top, BodyPartDepth.Outside); } BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null; if (i == 0 && pawn != null) { battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Ceiling, null); Find.BattleLog.Add(battleLogEntry_DamageTaken); } thing.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_DamageTaken); if (!thing.Destroyed && thing.def.destroyable) { thing.Kill(new DamageInfo?(new DamageInfo(DamageDefOf.Crush, 99999f, 999f, -1f, null, null, null, DamageInfo.SourceCategory.Collapse, null)), null); } } } } else { List <Thing> thingList2 = c.GetThingList(map); for (int k = thingList2.Count - 1; k >= 0; k--) { Thing thing2 = thingList2[k]; if (thing2.def.category == ThingCategory.Item || thing2.def.category == ThingCategory.Plant || thing2.def.category == ThingCategory.Building || thing2.def.category == ThingCategory.Pawn) { RoofCollapserImmediate.TryAddToCrushedThingsList(thing2, outCrushedThings); float num = (float)RoofCollapserImmediate.ThinRoofCrushDamageRange.RandomInRange; if (thing2.def.building != null) { num *= thing2.def.building.roofCollapseDamageMultiplier; } BattleLogEntry_DamageTaken battleLogEntry_DamageTaken2 = null; if (thing2 is Pawn) { battleLogEntry_DamageTaken2 = new BattleLogEntry_DamageTaken((Pawn)thing2, RulePackDefOf.DamageEvent_Ceiling, null); Find.BattleLog.Add(battleLogEntry_DamageTaken2); } DamageInfo dinfo2 = new DamageInfo(DamageDefOf.Crush, (float)GenMath.RoundRandom(num), 0f, -1f, null, null, null, DamageInfo.SourceCategory.Collapse, null); dinfo2.SetBodyRegion(BodyPartHeight.Top, BodyPartDepth.Outside); thing2.TakeDamage(dinfo2).AssociateWithLog(battleLogEntry_DamageTaken2); } } } if (roofDef.collapseLeavingThingDef != null) { Thing thing3 = GenSpawn.Spawn(roofDef.collapseLeavingThingDef, c, map, WipeMode.Vanish); if (thing3.def.rotatable) { thing3.Rotation = Rot4.Random; } } for (int l = 0; l < 1; l++) { Vector3 vector = c.ToVector3Shifted(); vector += Gen.RandomHorizontalVector(0.6f); MoteMaker.ThrowDustPuff(vector, map, 2f); } }
private static void DropRoofInCellPhaseOne(IntVec3 c, Map map, List <Thing> outCrushedThings) { RoofDef roofDef = map.roofGrid.RoofAt(c); if (roofDef == null) { return; } if (roofDef.collapseLeavingThingDef != null && roofDef.collapseLeavingThingDef.passability == Traversability.Impassable) { for (int i = 0; i < 2; i++) { List <Thing> thingList = c.GetThingList(map); for (int num = thingList.Count - 1; num >= 0; num--) { Thing thing = thingList[num]; TryAddToCrushedThingsList(thing, outCrushedThings); Pawn pawn = thing as Pawn; DamageInfo dinfo; if (pawn != null) { dinfo = new DamageInfo(DamageDefOf.Crush, 99999f, 999f, -1f, null, pawn.health.hediffSet.GetBrain(), null, DamageInfo.SourceCategory.Collapse); } else { dinfo = new DamageInfo(DamageDefOf.Crush, 99999f, 999f, -1f, null, null, null, DamageInfo.SourceCategory.Collapse); dinfo.SetBodyRegion(BodyPartHeight.Top, BodyPartDepth.Outside); } BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null; if (i == 0 && pawn != null) { battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Ceiling); Find.BattleLog.Add(battleLogEntry_DamageTaken); } thing.TakeDamage(dinfo).AssociateWithLog(battleLogEntry_DamageTaken); if (!thing.Destroyed && thing.def.destroyable) { thing.Kill(new DamageInfo(DamageDefOf.Crush, 99999f, 999f, -1f, null, null, null, DamageInfo.SourceCategory.Collapse)); } } } } else { List <Thing> thingList2 = c.GetThingList(map); for (int num2 = thingList2.Count - 1; num2 >= 0; num2--) { Thing thing2 = thingList2[num2]; if (thing2.def.category == ThingCategory.Item || thing2.def.category == ThingCategory.Plant || thing2.def.category == ThingCategory.Building || thing2.def.category == ThingCategory.Pawn) { TryAddToCrushedThingsList(thing2, outCrushedThings); float num3 = ThinRoofCrushDamageRange.RandomInRange; if (thing2.def.building != null) { num3 *= thing2.def.building.roofCollapseDamageMultiplier; } BattleLogEntry_DamageTaken battleLogEntry_DamageTaken2 = null; if (thing2 is Pawn) { battleLogEntry_DamageTaken2 = new BattleLogEntry_DamageTaken((Pawn)thing2, RulePackDefOf.DamageEvent_Ceiling); Find.BattleLog.Add(battleLogEntry_DamageTaken2); } DamageInfo dinfo2 = new DamageInfo(DamageDefOf.Crush, GenMath.RoundRandom(num3), 0f, -1f, null, null, null, DamageInfo.SourceCategory.Collapse); dinfo2.SetBodyRegion(BodyPartHeight.Top, BodyPartDepth.Outside); thing2.TakeDamage(dinfo2).AssociateWithLog(battleLogEntry_DamageTaken2); } } } if (roofDef.collapseLeavingThingDef != null) { Thing thing3 = GenSpawn.Spawn(roofDef.collapseLeavingThingDef, c, map); if (thing3.def.rotatable) { thing3.Rotation = Rot4.Random; } } for (int j = 0; j < 1; j++) { MoteMaker.ThrowDustPuff(c.ToVector3Shifted() + Gen.RandomHorizontalVector(0.6f), map, 2f); } }
private static void DropRoofInCellPhaseOne(IntVec3 c, Map map) { RoofDef roofDef = map.roofGrid.RoofAt(c); if (roofDef != null) { if (roofDef.collapseLeavingThingDef != null && roofDef.collapseLeavingThingDef.passability == Traversability.Impassable) { for (int i = 0; i < 2; i++) { List <Thing> thingList = c.GetThingList(map); for (int num = thingList.Count - 1; num >= 0; num--) { Thing thing = thingList[num]; map.roofCollapseBuffer.Notify_Crushed(thing); Pawn pawn = thing as Pawn; DamageInfo dinfo = default(DamageInfo); if (pawn != null) { DamageDef crush = DamageDefOf.Crush; int amount = 99999; BodyPartRecord brain = pawn.health.hediffSet.GetBrain(); dinfo = new DamageInfo(crush, amount, -1f, null, brain, null, DamageInfo.SourceCategory.Collapse); } else { dinfo = new DamageInfo(DamageDefOf.Crush, 99999, -1f, null, null, null, DamageInfo.SourceCategory.Collapse); dinfo.SetBodyRegion(BodyPartHeight.Top, BodyPartDepth.Outside); } BattleLogEntry_DamageTaken battleLogEntry_DamageTaken = null; if (i == 0 && pawn != null) { battleLogEntry_DamageTaken = new BattleLogEntry_DamageTaken(pawn, RulePackDefOf.DamageEvent_Ceiling, null); Find.BattleLog.Add(battleLogEntry_DamageTaken); } thing.TakeDamage(dinfo).InsertIntoLog(battleLogEntry_DamageTaken); if (!thing.Destroyed && thing.def.destroyable) { thing.Destroy(DestroyMode.Vanish); } } } } else { List <Thing> thingList2 = c.GetThingList(map); for (int num2 = thingList2.Count - 1; num2 >= 0; num2--) { Thing thing2 = thingList2[num2]; if (thing2.def.category == ThingCategory.Item || thing2.def.category == ThingCategory.Plant || thing2.def.category == ThingCategory.Building || thing2.def.category == ThingCategory.Pawn) { map.roofCollapseBuffer.Notify_Crushed(thing2); float num3 = (float)RoofCollapserImmediate.ThinRoofCrushDamageRange.RandomInRange; if (thing2.def.building != null) { num3 *= thing2.def.building.roofCollapseDamageMultiplier; } BattleLogEntry_DamageTaken battleLogEntry_DamageTaken2 = null; if (thing2 is Pawn) { battleLogEntry_DamageTaken2 = new BattleLogEntry_DamageTaken(thing2 as Pawn, RulePackDefOf.DamageEvent_Ceiling, null); Find.BattleLog.Add(battleLogEntry_DamageTaken2); } DamageInfo dinfo2 = new DamageInfo(DamageDefOf.Crush, GenMath.RoundRandom(num3), -1f, null, null, null, DamageInfo.SourceCategory.Collapse); dinfo2.SetBodyRegion(BodyPartHeight.Top, BodyPartDepth.Outside); thing2.TakeDamage(dinfo2).InsertIntoLog(battleLogEntry_DamageTaken2); } } } if (roofDef.collapseLeavingThingDef != null) { Thing thing3 = GenSpawn.Spawn(roofDef.collapseLeavingThingDef, c, map); if (thing3.def.rotatable) { thing3.Rotation = Rot4.Random; } } for (int j = 0; j < 1; j++) { Vector3 a = c.ToVector3Shifted(); a += Gen.RandomHorizontalVector(0.6f); MoteMaker.ThrowDustPuff(a, map, 2f); } } }