Explosions (DX)

This page describes the mechanics of explosions in Deus Ex. 
==Overview==
Explosions cause damage in an area of effect. The amount of damage that is inflicted depends on the base damage of the object causing the explosion, its blast radius, and the distance between the center of the blast and the center of the target. 
Explosions can be classified into two categories:
*Explosions with gradual hurt steps – Caused by projectiles fired by weapons and the detonation of explosive game-environment objects. 
**Damage is applied five times by creating five separate explosions of different blast radiuses.
**Each sub-explosions has a base damage of 40% of the projectile's (or object's) nominal base damage. This damage is further reduced by multiplying with a distance-related factor that is between 0 and 1. 
*Explosions without gradual hurt steps – Caused by the destruction of robots and men in black.
**This type of explosions applies damage only once, using the base damage and the base blast radius.
Explosions should not be confused with the "exploded" damage type. All damage sources that use the "exploded" damage type are also explosions for purposes of damage calculation, but not all explosions are of the "exploded" damage type. For example, the damage inflicted by EMP grenades ("EMP" damage type), scramble grenades ("NanoVirus" damage type), and plasma bolts ("burned" damage type) are also applied in the manner of explosions. Formally, explosions are a manner of computing area-of-effect damage using the HurtRadius function of the game's engine. 
==Explosions with gradual hurt steps==
===Weapon projectiles===
Certain weapons launch projectiles that explode over a blast radius. These weapons include the LAW, GEP gun, plasma rifle, and PS20. The assault rifle's 20mm HE round is also a projectile with a blast radius. Additionally, all demolition skill grenades are projectiles that explode. Whether or not a projectile is explosive is governed by the bExplodes property. 
The damage caused by explosions is based on the weapon's base damage (or, more accurately, the projectile's base damage), and the projectile's blast radius. When an explosive projective explodes, it creates 5 separate explosions (referred to here as sub-explosions) with successively larger radiuses, from 1/5 of the projectile's blast radius to the projectile's full blast radius. Each of the 5 sub-explosions has a base damage that is 40% of the projectile's base damage, further scaled by a factor (in the range of 0 to 1) that depends on the size of the projectile's blast radius, the distance between the impact location and the target (accounting for the collision radius of the target), and the "step" corresponding to the sub-explosion.
====Calculation steps====
*Calculate the damage and radiuses of the 5 separate explosions (sub-explosions) for the exploding projectile.DeusExProjectile.Exploding.DamageRing in DeusEx.u
**Damage of each explosion = (base damage × 2) / 5
**Radiuses of the five explosions = (projectile's blast radius / 5) × {1, 2, 3, 4, 5}
***That is, the five explosions have radiuses that are 1/5, 2/5, 3/5, 4/5 and 5/5 of the blast radius, respectively.
*For each of the five explosions, calculate the damage scaling factor:Actor.HurtRadius in Engine.u
**Measure the length of the vector from where the explosion occurred to the location of the target taking damage, with a minimum value of 1. Subtract the target's collision radius from the vector length, and divide the result by the previously calculated explosion radiuses, with a minimum value of 0.
**Subtract the above values from 1 to compute the damage scaling factor.
*For each of the five explosions, the damage that the target takes is the explosion's damage (which is the same for all five explosions) multiplied by the respective damage scaling factor (which differs among the explosions). These values are subject to the floor function (e.g., a value of 2.8 is rounded down to 2).
*The values calculated from the above step are then subject to the damage modifiers described above.
====Example====
*The plasma bolt has a base damage of 8 and a blast radius of 300.
**The damage of each of the five explosions is (8 × 2) / 5 = 3.2.
**The blast radiuses of the five explosions are 60, 120, 160, 240, and 300.
*Assume that the vector length is 32 and that the collision radius of the target is 20 (note that 20 is the collision radius of a common trooper).
**Vector length: 32 - 20 = 12
**12 / {60, 120, 160, 240, 300} = {0.2, 0.1, 0.075, 0.05, 0.04}
*Damage scaling factors:
**1 - {0.2, 0.1, 0.075, 0.05, 0.04} = {0.8, 0.9, 0.925, 0.95, 0.96}
*Damage taken by the target:
**3.2 × {0.8, 0.9, 0.925, 0.95, 0.96} = {2.56, 2.88, 2.96, 3.04, 3.07}
**Integer values: {2, 2, 2, 3, 3}, for a total damage of 12
*Apply damage modifiers (if applicable)
**For example, if all of the above damages are headshots (with a 8x multiplier for damage), the resulting damage would be 8 × (2 + 2 + 2 + 3 + 3) = 96
Due to the manner in which explosions are handled, weapons that launch explosive projectiles tend to do more damage than what their nominal base damage would otherwise suggest, if the explosion occurs close to the target. 
In the example above, the plasma bolt's base damage 8 ends up inflicting a total damage of 12. Note that the plasma bolt's low base damage amplified the effect of integer truncation. Without the integer truncation, the total damage would be 2.56 + 2.88 + 2.96 + 3.04 + 3.07 = 14.51. In practice, explosions from projectiles with very high base damage can approach 2x the nominal base damage of the projectile, assuming that the target has a relatively small collision radius.
===Game environment objects===
Explosions from game environment objects are calculated in the same way as projectiles.DeusExDecoration.Exploding in DeusEx.u 
Object 	Damage	Damage Type	Blast Radius
TNT Crate 	300 	Exploded 	800 (50 feet)
Barrel (Barrel1Tex5)	400 	Exploded 	1000 units (62.5 feet)
Barrel (Barrel1Tex7)	200 	Exploded 	768 units (48 feet)
==Explosions without gradual hurt steps==
Explosions without gradual hurt steps are calculated in the manner described above, except that there is only one explosion, which has the original base damage and full blast radius.
When men in black (and women in black) die, they explode with a blast radius of 256 units (16 feet) and a damage of 100 ("exploded" damage type).MiB.Explode and WiB.Explode in DeusEx.u
When robots are destroyed, they set off an explosion whose radius and damage depends on the collision radius and collision height of the robot. The damage type of the explosion is "exploded."Robot.Explode in DeusEx.u
*Blast radius = (Collision Radius + Collision Height) × 4
*Damage = (Collision Radius + Collision Height) × 0.25
Therefore, destruction of the largest bot (military bot) causes an explosion of 39 base damage with a radius of 636 units (39.75 feet). 
==References==
Category:Deus Ex gameplay