In Factorio, entities have health, can die/be destroyed, and have resistances. Damage is defined as the concept of lowering an entity's health by using an attack, such as a gun firing at it, or a biter chewing on it. An entity's resistances will define exactly how much damage the entity will take off of an arbitrary attack.
The concept of damage is directly connected to the following achievements:
| Run Forrest, run|
Destroy 100 trees by impact.
Destroy 10k trees with fire.
Destroy 10 spawners by impact.
Survive a hit of 500 damage or more.
| Watch your step|
Get killed by a moving locomotive.
|Damage type||Used by|
|Physical||Bullets (regular/piercing/uranium), shotgun (regular/piercing), biters, axe (iron/steel), defender robots|
|Impact||Collision (of train/car)|
|Acid||Worm Turrets, Spitters|
|Explosion||Rockets, Explosive Rockets, Grenade, Cluster grenade|
|Laser||Laser turrets, distractor/destroyer robots, personal laser defense|
Piercing power is present with Tank ammunition and piercing shotgun shells. It determines how many HP of enemies can a projectile damage before it is no longer able to travel further. To penetrate an enemy, the enemy has to be killed by the projectile, and the damage dealt for the kill must be less than current piercing power. The damage dealt also decreases piercing power. For example, shooting medium biters with 75 health with a cannon shell of 300 piercing power means that the shell will pierce through 4 medium biters, killing them, and still destroy/damage one more target.
Resistance has two aspects:
- Decrease, or "flat" resistance
Decrease resistance decreases the damage by specified number as long as the resulting damage wouldn't be less than 1. If the result damage would be less than 1, an alternate formula is used. Let R denote the flat resistance value, D the incoming damage, and M the modified damage, after accounting for flat resistance. Then
Notice that if D-R=1, then M=1 with either formula, hence the overall model for flat resistance is continuous. If flat resistance matches or exceeds the raw damage, then modified damage is asymptotic towards 0, as shown by following example table:
|Damage||Flat Resistance||Modified damage (with 0% resistance)|
- Percentile resistance
Percentile resistance reduces the damage by the specified percent. It is applied after flat resistances when both are present and thus changes the 'modified damage' value above, decreasing it by the specified percentage. If the value is 100%, the entity is immune to the damage. As an example, an entity having 25% resistance physical damage is hit with a bullet dealing 100 physical damage would take 75 damage instead of 100. Let M denoted the modified damage derived from the applicable formula above, P denote percentage resistance (in decimal form, so 25%=0.25), and F denote final damage, then
In Factorio, resistances are displayed as follows:
Decrease resistance/Percent resistance
So, an entity displaying 10/20% resistance to fire means that that entity has 10 flat resistance and 20% percentile resistance to fire. So, if said entity were to take 30 fire damage, they would instead take 16 damage, after resistances were applied.
The calculation proceeds as follows:
D=30, and R=10, so D-R=20>1, and we use the first formula above for M:
and since P=20%=0.2, we obtain
Let D denote the raw incoming damage (of applicable type), R denoted the flat resistance value (against damage of the applicable type), P the percentage resistance (against damage of the same type) in decimal form (e.g. 20%=0.2), and let F denote the final damage (of applicable type) dealt to the target.
F = (D - R) * (1 - P)
F = (1 - P) / (1 + R - D)