Jump to content

Damage (LWR): Difference between revisions

From UFOpaedia
Lorthos (talk | contribs)
mNo edit summary
Lorthos (talk | contribs)
mNo edit summary
 
(29 intermediate revisions by 3 users not shown)
Line 4: Line 4:
=== Complete Damage Formula ===
=== Complete Damage Formula ===


<code>'''Damage Taken''' = ([(('''Weapon Damage''' + '''Barrel Modifiers''') <-- Randomization ) * '''Target Modifiers'''] * (1 - '''Percent DR''') + '''Penetration''')</code>
<code>'''Damage Taken''' = [(('''Weapon Damage''' + '''Barrel Modifiers''') <-- '''Randomization''' ) * '''Target Modifiers'''] * [1 - Clamp(('''DR - Penetration''') / 100, 0, 0.8)]</code>


This can be broken down into 5 categories:  
This can be broken down into 5 steps:  


  '''1) Weapon Damage''' = Weapon Damage
  '''1) Weapon Damage''' = Weapon Damage
Line 14: Line 14:
  '''3) Travel Damage''' = Barrel Damage is Randomized (and for explosives fall off is then calculated)
  '''3) Travel Damage''' = Barrel Damage is Randomized (and for explosives fall off is then calculated)


  '''4) Damage Dealt''' = Travel Damage * Target Modifiers (include crit)
  '''4) Damage Dealt''' = Travel Damage * Target Modifiers


  '''5) Damage Taken ''' = Min(Damage Dealt, Damage Dealt * (1 - DR/100) + Penetration)
  '''5) Damage Taken''' = Damage Dealt * [1 - Clamp((DR - Penetration) / 100, 0, 0.8)]


Each category represents a section of the damage calculation (as explained below).
Each category represents a section of the damage calculation (as explained below).
Line 26: Line 26:
=== Barrel Damage ===
=== Barrel Damage ===


<code>'''Barrel Damage''' = ('''Weapon Damage''' + '''Barrel Modifiers''')</code>
Damage from the barrel is: '''Weapon Damage''' + '''Barrel Modifiers''' (e.g. Ranger, Alloy Enhanced Rounds, ...). It is truncated after each calculation. Some Barrel Modifiers give straight damage (e.g. +1 damage) and others give damage based on the weapon damage (e.g. +50% weapon damage). These are all summed together. For example, a sniper with Ranger (+1 damage), Magnum (+50% weapon damage), and a Sniper Rifle (6 weapon damage) would have a barrel damage of 6 + 1 + 3 = 10.


Damage from the barrel is: '''Weapon Damage''' + '''Barrel Modifiers''' (e.g. ranger, alloy-jacketed rounds, burst etc.). It is truncated after calculation. Some '''Barrel Modifiers''' give straight damage (e.g. +1 damage) and others give damage based on the weapon damage (e.g. +50% weapon damage). These are all summed together. For example, a sniper with ranger (+1 damage), mayhem (+70% weapon damage), and a sniper rifle (6 weapon damage) would have a barrel damage of 6 + 1 + 4 = 11.
Almost anything that modifies Weapon Damage (e.g. +50% weapon damage) is added as a Barrel Modifier.
 
Almost anything that modifies '''Weapon Damage''' (e.g. +50% weapon damage) is added as a '''Barrel Modifier'''.
 
'''Critical Damage''' flat bonuses (e.g. +1 crit damage) are added as barrel damage, but only if the shot is a critical hit.


Barrel Damage can be viewed in-game by pressing F1.
Barrel Damage can be viewed in-game by pressing F1.
Line 38: Line 34:
=== Travel Damage ===
=== Travel Damage ===


<code>'''Travel Damage''' = '''Barrel Damage''' is Randomized</code>
Travel Damage is basically the Barrel Damage that is modified by '''Randomization'''.
 
Travel Damage is basically the Barrel Damage that is modified by Randomization.


After it leaves the barrel and is travelling towards the target, the damage is '''Randomized'''.
For all damage 1-9, the damage is randomized from -1 to +1, with an even chance of being -1, 0, or +1 (the minimum damage is always at least 1). For all damage 10-19, the damage is randomized from -2 to +2, with an even chance of being -2, -1, 0, +1, or +2. The same occurs for damage of 20-29, 30-39, etc.
 
For all damage 1-9, the damage is randomized from -1 to +1, with an even chance of being -1, 0, or +1.
 
For all damage 10-19, the damage is randomized from -2 to +2, with an even chance of being -2, -1, 0, +1, or +2.
 
The same occurs for damage of 20-29, 30-39, etc.
 
The minimum damage is always at least 1.


The actual formula is:
The actual formula is:
<code>Randomized Damage = Max(1, Damage + Rand[1 + (2 * (1 + Damage / 10))] - (1 + Damage / 10))</code>
<code>Randomized Damage = Max(1, Damage + Rand[1 + (2 * (1 + Damage / 10))] - (1 + Damage / 10)).</code>
The randomization works in integer values so all values are constantly truncated (e.g. If x is 6 then x/10 = 0).


The randomization works in integer values so all values are constantly truncated (e.g. If x is 6 then x/10 = 0).
If this is a critical hit (from an explosive or a shot), any damage that would be randomized lower than the Barrel Damage is instead set to the Barrel Damage.


Randomization can occur twice or not at all if certain second wave options are enabled.
Randomization can occur twice or not at all if certain second wave options are enabled.
==== Critical Hit Randomization ====
If this is a critical hit (from an explosive or a shot), any damage that would be randomized lower than the '''Barrel Damage''' is instead set to the '''Barrel Damage'''.


=== Damage Dealt ===
=== Damage Dealt ===


<code>'''Damage Dealt''' = '''Travel Damage''' * '''Target Modifiers'''</code>
Once it reaches the targets, '''Target Modifiers''' are applied. The first target modifier applied is critical damage. If the shot or explosive rolled a critical hit, the damage is increased by 50%. Other target modifiers also applied include: Shred, VPT, CST, Graze, Distortion, TK Field. After each calculation the damage is truncated to an integer.


Once it reaches the targets, '''Target Modifiers''' are applied. The first target modifier applied is critical damage. If the shot or explosive rolled a critical hit, the damage is increased by 50%. Other target modifiers also applied include: Shred, VPT, CST, Graze, Distortion. After each calculation the damage is truncated to an integer.
Critical Damage has a base of 150% (so it adds 50% to the damage dealt)However, many abilities can increase this to higher levels.


'''Damage Dealt''' cannot be lower than 1.
Damage Dealt cannot be lower than 1.


=== Damage Taken ===
=== Damage Taken ===


<code>'''Damage Taken''' = '''Min(Damage Dealt, Damage Dealt * (1 - DR/100) + Penetration)'''</code>
<code>'''Damage Taken''' = '''Damage Dealt * (1 - (DR - Pen) / 100))'''</code>
 
This step takes the '''Damage Dealt''' and mitigates it by considering the target's '''DR''' and the damage dealer's '''Pen'''.


'''Damage Resistance (DR)''' is applied first, then '''Penetration'''. The '''Damage Taken''' is truncated only after all '''DR''' has been removed from the '''Damage Dealt'''. '''Damage Dealt''' cannot be reduced below 1 by Damage Resistance.
'''DR''' (Damage Resistance) is calculated by summing the unit's DR sources.


Every 10 '''Damage Dealt''' against targets increases penetration by 1.  So if the damage taken is 30 damage, an additional 3 penetration will be added to any other forms of penetration.  
'''Pen''' (Penetration) is calculated by summing the unit's Pen sources.


To calculate total %DR, see [[Other Abilities (LWR)#Base DR|Base DR]]
Once you have the target's '''DR''' and the damage dealer's '''Pen''' you can calculate the amount of mitigation on the '''Damage Dealt''' to end up with the '''Damage Taken'''. This is done by simply subtracting Pen from DR. However, the result from the '''(DR - Pen)''' step is clamped between the '''Impenetrable Cover''' value and '''80''' (a '''Mitigation Ceiling'''). The '''Impenetrable Cover''' value is 30 for units' in partial cover and 50 for unit's in full cover, but is halved by both reaction fire and steadied shots.  The '''Mitigation Ceiling''' is always 80 which means that shots can always get at least 20% of their damage in. Do note that extra effective DR (above 80) can still be useful for counteracting pen while remaining at 80% mitigation.
 
The '''Damage Taken''' is truncated only after all '''DR''' has been removed from the '''Damage Dealt'''. '''Damage Dealt''' cannot be reduced below 1 by Damage Resistance. '''Penetration''' cannot reduce '''DR''' below 0.


== Exceptions ==
== Exceptions ==
Line 101: Line 88:
=== Explosive Damage ===
=== Explosive Damage ===


Each unit damaged by explosive damage has the '''Travel Damage''' reduced based on distance from the center after it is randomized. Damage falls as [half of the distance:radius ratio + 0.5], down to [50% + 0.5] at the periphery. The exception to this is that damage within 1 tile of the center has no fall-off.
Each unit damaged by explosive damage has the '''Travel Damage''' reduced based on distance from the center after it is randomized. Damage falls off linearly to 50% at the periphery. The exception to this is that damage within 1 tile of the center has no fall-off.
 
Note: The 0.5 damage is added on explosive fall-off to accommodate for truncation.


<div style="max-width: 1000px;">
Note: +0.5 damage is added on explosive fall-off to accommodate for truncation.
Explosive Travel Damage = 0.50 + Travel Damage * (1.0 - FMin[0.50, 0.50 * Distance_to_Target/Radius_of_Explosive])
</div>


=== Special Damage Types ===  
=== Special Damage Types ===  
Line 117: Line 100:
=== Mental In-Game Calculation ===
=== Mental In-Game Calculation ===


A soldier with a 3 damage assault carbine and ranger (+1 damage) fires at a drone who has 37% DR.   
A soldier with a 3 damage Assault Carbine and Ranger (+1 damage) fires at a drone who has 45% DR.   


You'd expect it to do 4 damage (range 3-5), minus 37% DR down to 2 damage.
You'd expect it to do 4 damage (range 3-5), minus ~50% DR down to 2 damage.


=== Detailed Calculation ===
=== Detailed Calculation ===
Line 127: Line 110:
The '''Assault Rifle''' has 4 '''Weapon Damage''', receives +1 damage as a '''Barrel Modifier''' from '''Ranger''', and has no innate '''Penetration'''.
The '''Assault Rifle''' has 4 '''Weapon Damage''', receives +1 damage as a '''Barrel Modifier''' from '''Ranger''', and has no innate '''Penetration'''.


The '''Drone''' is '''Hardened''' (30 '''Percent DR''') and has 10 '''base DR''' for a total of 37% DR.
The '''Drone''' is '''Hardened''' (35% DR) and has 10 '''base DR'''. The Total DR is 35 + 10 = 45%.


The '''Drone''' is not '''Shredded''' and does not have '''Distortion'''. The soldier does not have '''CST''' and the shot does not graze, so there are no '''Target Modifiers''' to the damage.
There are no '''Target Modifiers''' to the damage.


The shot does not 'Crit' so '''Crit Dmg''' is 1.0 and the Randomization does not change the value.
The shot does not 'Crit' so '''Crit Dmg''' is 1.0 and the Randomization does not change the value.


<code>'''Damage Dealt''' = ([(('''Weapon Damage''' + '''Barrel Modifiers''') <-- Randomization ) * '''Target Modifiers'''] * (1 - '''Percent DR''') + '''Penetration''')</code>
<code>'''Damage Dealt''' = [(('''Weapon Damage''' + '''Barrel Modifiers''') <-- Randomization ) * '''Target Modifiers'''] * (1 - ('''Total DR''' - '''Penetration''') / 100)</code>


<code>'''Damage Dealt''' = ((((4 + 1) + 0) * 1.0) * (1 - 0.37) + 0) = 3.2 = 3 '''Damage Taken'''</code>
<code>'''Damage Dealt''' = [((4 + 1) + 0) * 1.0] * (1 - (45 - 0) / 100) = 2.75 = 2 '''Damage Taken'''</code>


== Environmental Damage ==
== Environmental Damage ==
Line 153: Line 136:
|}
|}


Environmental damage is mostly unaffected by perks and abilities and just considers the weapon's specific environmental damage. However, there are 2 exceptions: Explosives do tapper their environmental damage down to 35% at their periphery (and '''Tandem Warheads''' does prevent this tapper) and '''Sapper''' increases environmental damage.
Environmental damage is mostly unaffected by perks and abilities and just considers the weapon's specific environmental damage. However, there are 2 exceptions: Explosives do tapper their environmental damage down to 50% at their periphery (and '''Tandem Warheads''' does prevent this tapper) and '''Sapper''' increases environmental damage.


Fire will also cause a lot of environmental damage and can spread. '''Be careful taking cover behind objects that are on fire!'''
Fire will also cause a lot of environmental damage and can spread. '''Be careful taking cover behind objects that are on fire!'''

Latest revision as of 21:18, 28 October 2025

Back To Main Page

Damage Calculation

Complete Damage Formula

Damage Taken = [((Weapon Damage + Barrel Modifiers) <-- Randomization ) * Target Modifiers] * [1 - Clamp((DR - Penetration) / 100, 0, 0.8)]

This can be broken down into 5 steps:

1) Weapon Damage = Weapon Damage
2) Barrel Damage = Weapon Damage + Barrel Modifiers
3) Travel Damage = Barrel Damage is Randomized (and for explosives fall off is then calculated)
4) Damage Dealt = Travel Damage * Target Modifiers
5) Damage Taken = Damage Dealt * [1 - Clamp((DR - Penetration) / 100, 0, 0.8)]

Each category represents a section of the damage calculation (as explained below).

Weapon Damage

This is simply the listed damage of each weapon (for XCOM) or base damage (for aliens). Alien weapon damage increases with alien level and leader upgrades.

Barrel Damage

Damage from the barrel is: Weapon Damage + Barrel Modifiers (e.g. Ranger, Alloy Enhanced Rounds, ...). It is truncated after each calculation. Some Barrel Modifiers give straight damage (e.g. +1 damage) and others give damage based on the weapon damage (e.g. +50% weapon damage). These are all summed together. For example, a sniper with Ranger (+1 damage), Magnum (+50% weapon damage), and a Sniper Rifle (6 weapon damage) would have a barrel damage of 6 + 1 + 3 = 10.

Almost anything that modifies Weapon Damage (e.g. +50% weapon damage) is added as a Barrel Modifier.

Barrel Damage can be viewed in-game by pressing F1.

Travel Damage

Travel Damage is basically the Barrel Damage that is modified by Randomization.

For all damage 1-9, the damage is randomized from -1 to +1, with an even chance of being -1, 0, or +1 (the minimum damage is always at least 1). For all damage 10-19, the damage is randomized from -2 to +2, with an even chance of being -2, -1, 0, +1, or +2. The same occurs for damage of 20-29, 30-39, etc.

The actual formula is: Randomized Damage = Max(1, Damage + Rand[1 + (2 * (1 + Damage / 10))] - (1 + Damage / 10)). The randomization works in integer values so all values are constantly truncated (e.g. If x is 6 then x/10 = 0).

If this is a critical hit (from an explosive or a shot), any damage that would be randomized lower than the Barrel Damage is instead set to the Barrel Damage.

Randomization can occur twice or not at all if certain second wave options are enabled.

Damage Dealt

Once it reaches the targets, Target Modifiers are applied. The first target modifier applied is critical damage. If the shot or explosive rolled a critical hit, the damage is increased by 50%. Other target modifiers also applied include: Shred, VPT, CST, Graze, Distortion, TK Field. After each calculation the damage is truncated to an integer.

Critical Damage has a base of 150% (so it adds 50% to the damage dealt). However, many abilities can increase this to higher levels.

Damage Dealt cannot be lower than 1.

Damage Taken

Damage Taken = Damage Dealt * (1 - (DR - Pen) / 100))

This step takes the Damage Dealt and mitigates it by considering the target's DR and the damage dealer's Pen.

DR (Damage Resistance) is calculated by summing the unit's DR sources.

Pen (Penetration) is calculated by summing the unit's Pen sources.

Once you have the target's DR and the damage dealer's Pen you can calculate the amount of mitigation on the Damage Dealt to end up with the Damage Taken. This is done by simply subtracting Pen from DR. However, the result from the (DR - Pen) step is clamped between the Impenetrable Cover value and 80 (a Mitigation Ceiling). The Impenetrable Cover value is 30 for units' in partial cover and 50 for unit's in full cover, but is halved by both reaction fire and steadied shots. The Mitigation Ceiling is always 80 which means that shots can always get at least 20% of their damage in. Do note that extra effective DR (above 80) can still be useful for counteracting pen while remaining at 80% mitigation.

The Damage Taken is truncated only after all DR has been removed from the Damage Dealt. Damage Dealt cannot be reduced below 1 by Damage Resistance. Penetration cannot reduce DR below 0.

Exceptions

Mins and Maxes

The Damage Taken cannot be reduced below 1 by Damage Resistance.

Randomization will never set the damage below 1.

Truncation

All damage is stored in an integer form, thus it is always being truncated during each step. This means 5.6 becomes 5, 9.1 becomes 9, and 9.9 becomes 9.

The exception to this is that Damage Resistance is not truncated and is removed from damage after calculation.

So Damage Dealt is truncated only after all DR is removed.

This is important, because having DR NOT truncated until it's removed from the Damage Dealt means that you can have small amounts of DR (i.e. 2% DR) be effective.

Explosive Damage

Each unit damaged by explosive damage has the Travel Damage reduced based on distance from the center after it is randomized. Damage falls off linearly to 50% at the periphery. The exception to this is that damage within 1 tile of the center has no fall-off.

Note: +0.5 damage is added on explosive fall-off to accommodate for truncation.

Special Damage Types

Psi Damage have their own methods of determine damage and are not affected by Target Modifiers or Damage Resistance.

Example Calculations

Mental In-Game Calculation

A soldier with a 3 damage Assault Carbine and Ranger (+1 damage) fires at a drone who has 45% DR.

You'd expect it to do 4 damage (range 3-5), minus ~50% DR down to 2 damage.

Detailed Calculation

A soldier with an Assault Rifle and the Ranger perk fires at a Drone

The Assault Rifle has 4 Weapon Damage, receives +1 damage as a Barrel Modifier from Ranger, and has no innate Penetration.

The Drone is Hardened (35% DR) and has 10 base DR. The Total DR is 35 + 10 = 45%.

There are no Target Modifiers to the damage.

The shot does not 'Crit' so Crit Dmg is 1.0 and the Randomization does not change the value.

Damage Dealt = [((Weapon Damage + Barrel Modifiers) <-- Randomization ) * Target Modifiers] * (1 - (Total DR - Penetration) / 100)

Damage Dealt = [((4 + 1) + 0) * 1.0] * (1 - (45 - 0) / 100) = 2.75 = 2 Damage Taken

Environmental Damage

Environmental damage is the damage done to objects and structures around the battlefield (like walls, chairs, cars, etc.).

Each weapon has a specific environmental damage based on its size and type:

Weapon Type Environmental Damage
Shots 15
Explosives 35

Environmental damage is mostly unaffected by perks and abilities and just considers the weapon's specific environmental damage. However, there are 2 exceptions: Explosives do tapper their environmental damage down to 50% at their periphery (and Tandem Warheads does prevent this tapper) and Sapper increases environmental damage.

Fire will also cause a lot of environmental damage and can spread. Be careful taking cover behind objects that are on fire!

All objects have a certain amount of HP. The less sturdy the object the less HP it will have. When an object's HP is reduced to 0 or less it will crumple.

Most cover has between 30 and 90 HP, based on what they are made of -- stone is tougher than wood, for example. Some map elements are entirely invulnerable and non-cover objects usually have less than 30 HP. Meld Canisters have 3 HP. Vehicles take 250 before catching on fire and 500 will cause them to explode immediately. Examples of the HP of objects can be found in the pictures below.