In other languages: Deutsch Español Français 日本語 한국어 Русский Українська 简体中文

Damage: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (Use space-age=yes instead of {{SA}} for IconLinks)
 
(29 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
 
[[File:player_attacked_by_biters_small.png|thumb|300px|right|Red flashing while taking damage.]]Taking '''damage''' is the effect of lowering the health of the [[player]], [[enemies]] or other entities.
== Overview ==
== Overview ==
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.
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 [[player|character]]'s maximum health is 100 (without [[energy shield]]s). Other entities' health values are listed in their individual entries.
The player's maximum health is 250 (without [[energy shield]]s). Other entities' health values are listed in their individual entries.


== Achievements ==
== Achievements ==
Line 15: Line 14:
{{Achievement|watch-your-step}}
{{Achievement|watch-your-step}}


== Damage Types ==
== Damage types ==
{|class="wikitable"
{|class="wikitable"
|-
|-
! Damage type !! Used by
! Damage type !! Used by
|-
|-
| Physical || Bullets ([[Firearm magazine|regular]]/[[Piercing rounds magazine|piercing]]/[[Uranium rounds magazine|uranium]]), shotgun ([[Shotgun shells|regular]]/[[Piercing shotgun shells|piercing]]), [[Enemies#Biters|biters]], axe ([[Iron axe|iron]]/[[Steel axe|steel]]), [[Defender_capsule|defender robots]]
| Physical || {{Icon|Firearm magazine}}{{Icon|piercing rounds magazine}}{{Icon|uranium rounds magazine}}Bullets, {{Icon|shotgun shells}}{{Icon|Piercing shotgun shells}}shotgun shells, {{IconLink|railgun ammo||space-age=yes}}, {{IconLink|defender capsule}}
[[Enemies#Biters|Biters]] and [[Enemies#Wrigglers|wriggler pentapods]] {{SA}}
|-
|-
| Impact || Collision (of [[Locomotive|train]]/[[car]])
| Physical and explosion || {{Icon|cannon shell}}{{Icon|explosive cannon shell}}{{Icon|uranium cannon shell}}{{Icon|explosive uranium cannon shell}}Cannon shells, {{IconLink|artillery shell}}
|-
|-
| Fire || [[Flamethrower]]
| Impact || Collision (of [[Locomotive|train]]/[[car]]/[[tank]])
|-
|-
| Acid || [[Enemies#Worms|Worm Turrets]], [[Enemies#Spitters|Spitters]]
| Fire || {{IconLink|Flamethrower ammo}}, {{IconLink|flamethrower turret}}
|-
|-
| Poison || [[Poison capsule]]
| Acid || [[Enemies#Spitters|Spitters]], [[Enemies#Worms|worms]], and [[Enemies#Stompers|stomper pentapods]] {{SA}}
|-
|-
| Explosion || [[Rocket|Rockets]], [[Explosive rocket|Explosive Rockets]], [[Grenade]], [[Cluster grenade]]
| Poison || {{IconLink|Poison capsule}}
[[Enemies#Wrigglers|Wriggler pentapods]] {{SA}}
|-
|-
| Laser || [[Turret#Laser Turrets|Laser turrets]], [[Distractor capsule|distractor]]/[[Destroyer capsule|destroyer robots]], [[personal laser defense]]
| Explosion || {{Icon|Rocket}}{{Icon|explosive rocket}}{{Icon|atomic bomb}}Rockets, {{Icon|Grenade}}{{Icon|cluster grenade}}grenades, {{IconLink|land mine}}
[[Enemies#Strafers|Strafer pentapods]] {{SA}}
|-
| Laser || {{IconLink|Laser turret}}, {{IconLink|distractor capsule}}, {{IconLink|personal laser defense}}
|-
| Electric || {{IconLink|Discharge defense}}, {{IconLink|destroyer capsule}}, {{IconLink|tesla ammo||space-age=yes}}, {{IconLink|tesla turret||space-age=yes}}
|}
|}


=== Piercing Power ===
=== Piercing power ===
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.[https://forums.factorio.com/viewtopic.php?f=5&t=30917] 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.
Piercing power is present with [[tank]] ammunition. It determines how much 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.[https://forums.factorio.com/viewtopic.php?f=5&t=30917] 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 ==
== Resistance ==
Resistance has two aspects:
Resistance has two aspects:
* Decrease, or "flat" resistance
=== 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.
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
Let R denote the flat resistance value, D the incoming damage, and M the modified damage, after accounting for flat resistance. Then


if D-R>1
if R+1<D
 
<code>M=D-R</code>
 
otherwise if D>1


M=D-R
<code>M=1/(R-D+2)</code>


otherwise
otherwise


M=1/(1-(D-R))=1/(1+R-D)
<code>M=1/(R+1)</code>.


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:
If flat resistance matches or exceeds the raw damage, then modified damage is asymptotic towards 0, as shown by following example table:


{| class="wikitable"
{| class="wikitable"
|-
|-
! Damage !! Resistance !! Result damage (0% damage loss)
! Damage !! Flat Resistance !! Modified damage (with 0% resistance)
|-
|-
| 5 || 0 || 5
| 5 || 0 || 5
Line 79: Line 89:
|}
|}


* Percentile resistance
=== Percentage 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


F=M*(1-P)
Percentage resistance reduces the damage by the specified percent. It is applied ''after'' flat/decrease 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. This is the only way to have an entity immune to a type of damage, as flat reduction cannot reduce damage beneath 1.


In Factorio, resistances are displayed as follows:
As an example, an entity with 25% resistance to physical damage hit with a bullet dealing 100 physical damage would take 75 damage instead of 100.


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 formula used for percentage resistance to damage is as follows:


The calculation proceeds as follows:
Let M denote the flat-resistance-modified starter damage, and let P denote the percentage resistance (in decimal form, so 25%=0.25), and let F denote final damage.


D=30, and R=10, so D-R=20>1, and we use the first formula above for M:
<code>F = M * (1 - P)</code>


M=30-10=20
--------


and since P=20%=0.2, we obtain
In Factorio, resistances are displayed in the UI as follows:


F=20*(1-0.2)=20*0.8=16
Decrease resistance/Percentage resistance (Damage type)


== Combined Formulas ==
So, an entity that displays 10/20% resistance to fire has 10 flat resistance and 20% percent resistance to fire. If the aforementioned entity were to take 30 fire damage, they would instead take 16 damage, after resistances were applied.
 
The formula used for the above:
 
16<sup>final damage</sup> = (30<sup>initial raw damage</sup> - 10<sup>flat resist</sup>) * 0.8<sup>20% resistance</sup>
 
== Combined formulas ==
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.
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.
=== If D-R>1 ===
=== If R+1<D ===
F = (D - R) * (1 - P)
F = (D - R) * (1 - P)
=== If D-R<1 ===
=== otherwise if D>1 ===
F = (1 - P) / (1 + R - D)
F = (1 - P) / (R-D+2)
=== otherwise ===
F = (1 - P) / (R+1)
 
{{C|Main}}

Latest revision as of 21:51, 24 November 2024

Red flashing while taking damage.

Taking damage is the effect of lowering the health of the player, enemies or other entities.

Overview

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 player's maximum health is 250 (without energy shields). Other entities' health values are listed in their individual entries.

Achievements

The concept of damage is directly connected to the following achievements:

Run-forrest-run-achievement.png Run Forrest, run

Destroy 100 trees by impact.

Pyromaniac-achievement.png Pyromaniac

Destroy 10k trees with fire.

Steamrolled-achievement.png Steamrolled

Destroy 10 spawners by impact.

Golem-achievement.png Golem

Survive a hit of 500 damage or more.

Watch-your-step-achievement.png Watch your step

Get killed by a moving locomotive.

Damage types

Damage type Used by
Physical
Firearm magazine.png
Piercing rounds magazine.png
Uranium rounds magazine.png
Bullets,
Shotgun shells.png
Piercing shotgun shells.png
shotgun shells,
Railgun ammo.png
railgun ammo,
Defender capsule.png
defender capsule

Biters and wriggler pentapods

Physical and explosion
Cannon shell.png
Explosive cannon shell.png
Uranium cannon shell.png
Explosive uranium cannon shell.png
Cannon shells,
Artillery shell.png
artillery shell
Impact Collision (of train/car/tank)
Fire
Flamethrower ammo.png
Flamethrower ammo,
Flamethrower turret.png
flamethrower turret
Acid Spitters, worms, and stomper pentapods
Poison
Poison capsule.png
Poison capsule

Wriggler pentapods

Explosion
Rocket.png
Explosive rocket.png
Atomic bomb.png
Rockets,
Grenade.png
Cluster grenade.png
grenades,
Land mine.png
land mine

Strafer pentapods

Laser
Laser turret.png
Laser turret,
Distractor capsule.png
distractor capsule,
Personal laser defense.png
personal laser defense
Electric
Discharge defense.png
Discharge defense,
Destroyer capsule.png
destroyer capsule,
Tesla ammo.png
tesla ammo,
Tesla turret.png
tesla turret

Piercing power

Piercing power is present with tank ammunition. It determines how much 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.[1] 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

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

if R+1<D

M=D-R

otherwise if D>1

M=1/(R-D+2)

otherwise

M=1/(R+1).

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)
5 0 5
5 1 4
5 2 3
5 3 2
5 4 1
5 5 1/2
5 6 1/3
5 7 1/4
5 8 1/5
... ... ...

Percentage resistance

Percentage resistance reduces the damage by the specified percent. It is applied after flat/decrease 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. This is the only way to have an entity immune to a type of damage, as flat reduction cannot reduce damage beneath 1.

As an example, an entity with 25% resistance to physical damage hit with a bullet dealing 100 physical damage would take 75 damage instead of 100.


The formula used for percentage resistance to damage is as follows:

Let M denote the flat-resistance-modified starter damage, and let P denote the percentage resistance (in decimal form, so 25%=0.25), and let F denote final damage.

F = M * (1 - P)


In Factorio, resistances are displayed in the UI as follows:

Decrease resistance/Percentage resistance (Damage type)

So, an entity that displays 10/20% resistance to fire has 10 flat resistance and 20% percent resistance to fire. If the aforementioned entity were to take 30 fire damage, they would instead take 16 damage, after resistances were applied.

The formula used for the above:

16final damage = (30initial raw damage - 10flat resist) * 0.820% resistance

Combined formulas

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.

If R+1<D

F = (D - R) * (1 - P)

otherwise if D>1

F = (1 - P) / (R-D+2)

otherwise

F = (1 - P) / (R+1)