Difference between revisions of "Damage (LWR)"

From UFOpaedia
Jump to navigation Jump to search
 
(196 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[Long_War_Rebalance|Back To Main Page]]
 
[[Long_War_Rebalance|Back To Main Page]]
== Terms ==
+
== Damage Calculation ==  
 +
 
 +
=== Complete Damage Formula ===
 +
 
 +
<code>'''Damage Taken''' = ([(('''Weapon Damage''' + '''Barrel Modifiers''') <-- Randomization ) * '''Target Modifiers'''] * (1 - '''Percent DR''') + '''Penetration''')</code>
 +
 
 +
This can be broken down into 5 categories:
  
'''Weapon Damage''': This is each weapon damage stat configurable in DefaultGameCore.ini file. The weapon ranges shown in game in barracks are computed from this stat based on the randomization process, with an algorithm.
+
'''1) Weapon Damage''' = Weapon Damage
  
'''Barrel Modifiers''': These are effects that modifies damage as it leaves the barrel of the weapon.
+
'''2) Barrel Damage''' = Weapon Damage + Barrel Modifiers
  
'''Crit Dmg (or Critical Damage)''': This is how much the '''Weapon Damage''', after being affected by '''Barrel Modifiers''', is increased during a critical hit. The base value is 1.5, and a non-crit is 1.0.
+
'''3) Travel Damage''' = Barrel Damage is Randomized (and for explosives fall off is then calculated)
  
'''Barrel Damage''': This is the '''Weapon Damage''' modified by '''Barrel Modifiers''' with '''Crit Dmg''' and randomization applied.
+
'''4) Damage Dealt''' = Travel Damage * Target Modifiers (include crit)
  
'''Target Modifiers''': These are effects that modify the damage when it hits the target.
+
'''5) Damage Taken/Received ''' = Damage Dealt * (1 - DR/100) + Penetration
  
'''Damage Dealt''': This is the damage that a target receives from a damage dealer. It is '''Barrel Damage''' modified by '''Target Modifiers'''.
+
Each category represents a section of the damage calculation (as explained below).
  
'''DR (or Damage Resistance)''': This is how much of the damage received is resisted. It involves '''Flat Damage Resistance''', '''Percent Damage Resistance''', and '''Penetration'''.
+
=== Weapon Damage ===
  
'''Damage Taken''': This is how much damage the unit actually takes. It is the '''Damage Dealt''' minus the '''Damage Resistance'''.
+
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. Weapon Damage can be viewed in-game by pressing F1.
  
== Damage Calculation ==  
+
=== Barrel Damage ===
 +
 
 +
<code>'''Barrel Damage''' = (('''Weapon Damage''' + '''Barrel Modifiers''')</code>
 +
 
 +
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 (+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'''.
 +
 
 +
'''Critical Damage''' flat bonuses (e.g. +1 crit damage) are added as barrel damage, but only if the shot is a critical hit.
 +
 
 +
=== Travel Damage ===
 +
 
 +
<code>'''Travel Damage''' = '''Barrel Damage''' is Randomized</code>
 +
 
 +
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.
  
<br/>The complete damage formula is:
+
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.
  
'''Damage Taken''' = (([((('''Weapon Damage''' + '''Barrel Modifiers''') * '''Crit Dmg''') * Randomization ) + '''Target Modifiers'''] - '''Flat DR''') * (1 - '''Percent DR''') + '''Penetration''')
+
The same occurs for damage of 20-29, 30-39, etc.
  
 +
The minimum damage is always at least 1.
  
=== Barrel Damage ===
+
The actual formula is:
 +
<code>Randomized Damage = Max(1, Damage + Rand[1 + (2 * (1 + Damage / 10))] - (1 + Damage / 10))</code>
  
Damage from the barrel is: '''Weapon Damage''' + '''Barrel Modifiers''' (e.g. ranger, alloy-jacketed rounds, holo, etc.).
+
The randomization works in integer values so all values are constantly truncated (e.g. If x is 6 then x/10 = 0).
  
After it leaves the barrel critical damage is applied (anywhere from 1.0x to 2.0x damage) and the damage is randomized +/- 25%.
+
Randomization can occur twice or not at all if certain second wave options are enabled.
  
''Barrel Damage''' = ((('''Weapon Damage''' + '''Barrel Modifiers''') * '''Crit Dmg''') * Randomization
+
==== 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 (AKA Damage Received) ===
  
=== Damage Dealt ===
+
<code>'''Damage Dealt''' = '''Travel Damage''' * '''Target Modifiers'''</code>
  
One it reaches the targets, '''Target Modifiers''' are applied (In this order: Shredder-> VPT -> CST -> Fragmentation -> Distortion).
+
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.
  
'''Damage Dealt''' = ((('''Weapon Damage''' + '''Barrel Modifiers''') * '''Crit Dmg''') * Randomization + '''Target Modifiers'''
+
This can also be termed '''Damage Received''' (as opposed to Damage Dealt) if being considered from the target's point of view.
  
 +
'''Damage Dealt''' cannot be lower than 1.
  
 
=== Damage Taken ===
 
=== Damage Taken ===
  
Then '''Damage Resistance (DR)''' is calculated.
+
<code>'''Damage Taken''' = '''Damage Dealt''' * (1 - '''DR/100''') + '''Penetration'''</code>
 +
 
 +
'''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.
 +
 
 +
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.
 +
 
 +
After all penetration is calculated, it is reduced by any penetration resistance.
 +
 
 +
To calculate total %DR:
 +
 
 +
Total %DR = 1 - [(1 - DR) * (1 - DR) * (1 - DR) * (1 - DR) * etc. etc.]
 +
 
 +
Example of 30% DR and 50% DR and 20% DR:
 +
 
 +
Total %DR = 1 - [(1 - 0.3) * (1 - 0.5) * (1 - 0.2)] = 0.72 = 72% DR
 +
 
 +
Or you can just apply the DRs to damage sequentially.
 +
 
 +
Example: 100 damage shot against someone with 30% DR, 50% DR and 20% DR:
  
'''Flat DR''' is applied first, then '''Percent DR''', then '''Penetration'''.
+
100 damage with 30% reduced = 70 damage
 +
70 damage with 50% reduced = 35 damage
 +
35 damage with 20% reduced = 28 damage (overall 72% DR)
  
'''Damage Taken''' = (('''Damage Dealt''' - '''Flat DR''') * (1 - '''Percent DR''') + '''Penetration''')
+
== Exceptions ==
  
 +
=== Mins and Maxes ===
  
=== Other Modifications ===
+
The '''Damage Taken''' cannot be reduced below 1 by '''Damage Resistance'''.
  
The Damage Taken cannot be reduced below 1 by '''Damage Resistance (DR)''' and the '''Damage Taken''' can never go above the '''Damage Dealt'''.
+
The '''Damage Taken''' can never go higher than the '''Damage Dealt'''.
  
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. Note that '''Damage Resistance''' is not truncated, but the '''Damage Dealt''' is truncated after '''DR''' is removed.
+
For example, someone with a high amount of penetration could calculate final '''Damage Taken''' numbers higher than '''Damage Dealt''', but this would be capped at the initial '''Damage Dealt'''.
  
 +
'''Randomization''' will never set the damage below 1.
  
=== An Example ===
+
=== Truncation ===
  
A soldier with an '''Assault Carbine''' and the '''Ranger''' perk fires at a '''Drone'''
+
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 '''Assault Carbine''' has 4 '''Weapon Damage''', receives +1 damage as a '''Barrel Modifier''' from '''Ranger''', and has no innate '''Penetration'''.
+
The exception to this is that '''Damage Resistance''' is not truncated and is removed from damage after calculation.  
  
The '''Drone''' has 1 '''Flat DR''' and is '''Hardened''' (30 '''Percent DR''').
+
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 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.
 +
 
 +
Note: The 0.5 damage is added on explosive fall-off to accommodate for truncation.
 +
 
 +
<div style="max-width: 1000px;">
 +
Explosive Travel Damage = 0.50 + Travel Damage * (1.0 - FMin[0.50, 0.50 * Distance_to_Target/Radius_of_Explosive])
 +
</div>
 +
 
 +
=== Special Damage Types ===
 +
 
 +
Both '''Psi Damage''' and '''Neutrino 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 42% DR. 
 +
 
 +
You'd expect it to do 4 damage (range 3-5), minus 42% 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 '''Percent DR''') and has 10 '''base DR''' for a total of 42% DR.
  
 
The '''Drone''' is not '''Shredded''' and does not have '''Distortion'''. The soldier does not have '''VPT''' or '''CST''', and '''Fragmentation''' does not apply to rifles, so there are no '''Target Modifiers''' to the damage.
 
The '''Drone''' is not '''Shredded''' and does not have '''Distortion'''. The soldier does not have '''VPT''' or '''CST''', and '''Fragmentation''' does not apply to rifles, so there are no '''Target Modifiers''' to the damage.
  
The shot does not 'Crit' so '''Crit Dmg''' is 1.0 and the Randomization is 1.0.
+
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''' = (((((4 + 1) * 1.0) + 0) * (1 - 0.42) + 0) = 2.3 = 2 '''Damage Taken'''</code>
  
'''Damage Dealt''' = (([((('''Weapon Damage + '''Barrel Modifiers''') * '''Crit Dmg''') * Randomization ) + '''Target Modifiers'''] - '''Flat DR''') * (1 - '''Percent DR''') + '''Penetration''')
+
== Environmental Damage ==
  
'''Damage Dealt''' = ((((((4 + 1) * 1.0) * 1.0) + 0 - 1) * (1 - 0.3) + 0) = 2.8 = 2 '''Damage Taken'''
+
Environmental damage is the damage done to objects and structures around the battlefield (like walls, chairs, cars, etc.).
  
== Damage Randomization==
+
Each weapon has a specific environmental damage based on its size and type:
  
The purpose of the randomization is to pick a integer value between roughly 0.75 and 1.25 of the '''Weapon Damage'' with '''Barrel Modifiers''' and '''Crit Dmg''' applied. 
+
{| class="wikitable" style="max-width: 600px; text-align:center;"
 +
|+
 +
! style="width: 75%;" | Weapon Type
 +
! style="width: 25%; padding: 10px 8px 8px 8px;" | Environmental Damage
 +
|-
 +
| style="padding: 5px;" | '''Shots''' || 15
 +
|-
 +
| style="padding: 5px;" | '''Explosives''' || 35
 +
|}
  
The randomization works in integer values only. A die of size 2 * '''PreRNG Damage''' + 2 is rolled, where each integer point of '''PreRNG Damage''' is assigned up to four possible results on that die (except for the highest and lowest values, which may be assigned less).  The weighted average of all possible results equals the '''PreRNG Damage'''.  For a better understanding, reference the charts, below.
+
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.
  
=== Randomization Table ===
+
Fire will also cause a lot of environmental damage and can spread. '''Be careful taking cover behind objects that are on fire!'''
  
[[File:LR_MWD_randomisation_noncrit.jpg|center|800x357px]]
+
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.
  
The Y axis has '''PreRNG Damage''' values. Row values are possible randomization results for that particular '''PreRNG Damage'''. The rightmost column has the RNG range (min, max). The probability to roll a particular value given a particular '''PreRNG Damage''' is (number of times value appears in the row) / (total number of values in the row).
+
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. You can find the HP of an object by pressing "L" when the mouse is hovered on top of an object.
  
== Explosive Damage ==
+
[[File:Coverhp.png]]
  
Each unit damaged by explosive damage has the '''Weapon Damage''' after '''Barrel Modifiers''' reduced based on distance from the center. Damage falls as the square of the radius, down to 50% at the edge. <br>
+
[[File:Coverhp2.png]]
  
 
[[Category: Long War Rebalance]]
 
[[Category: Long War Rebalance]]

Latest revision as of 18:28, 26 September 2023

Back To Main Page

Damage Calculation

Complete Damage Formula

Damage Taken = ([((Weapon Damage + Barrel Modifiers) <-- Randomization ) * Target Modifiers] * (1 - Percent DR) + Penetration)

This can be broken down into 5 categories:

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 (include crit)
5) Damage Taken/Received  = Damage Dealt * (1 - DR/100) + Penetration

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. Weapon Damage can be viewed in-game by pressing F1.

Barrel Damage

Barrel Damage = ((Weapon Damage + Barrel Modifiers)

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 (+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.

Critical Damage flat bonuses (e.g. +1 crit damage) are added as barrel damage, but only if the shot is a critical hit.

Travel Damage

Travel Damage = Barrel Damage is Randomized

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.

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: 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).

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 (AKA Damage Received)

Damage Dealt = Travel Damage * Target Modifiers

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.

This can also be termed Damage Received (as opposed to Damage Dealt) if being considered from the target's point of view.

Damage Dealt cannot be lower than 1.

Damage Taken

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

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.

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.

After all penetration is calculated, it is reduced by any penetration resistance.

To calculate total %DR:

Total %DR = 1 - [(1 - DR) * (1 - DR) * (1 - DR) * (1 - DR) * etc. etc.]

Example of 30% DR and 50% DR and 20% DR:

Total %DR = 1 - [(1 - 0.3) * (1 - 0.5) * (1 - 0.2)] = 0.72 = 72% DR

Or you can just apply the DRs to damage sequentially.

Example: 100 damage shot against someone with 30% DR, 50% DR and 20% DR:
100 damage with 30% reduced = 70 damage
70 damage with 50% reduced = 35 damage
35 damage with 20% reduced = 28 damage (overall 72% DR)

Exceptions

Mins and Maxes

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

The Damage Taken can never go higher than the Damage Dealt.

For example, someone with a high amount of penetration could calculate final Damage Taken numbers higher than Damage Dealt, but this would be capped at the initial Damage Dealt.

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 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.

Note: The 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])

Special Damage Types

Both Psi Damage and Neutrino 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 42% DR.

You'd expect it to do 4 damage (range 3-5), minus 42% 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 Percent DR) and has 10 base DR for a total of 42% DR.

The Drone is not Shredded and does not have Distortion. The soldier does not have VPT or CST, and Fragmentation does not apply to rifles, so 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 - Percent DR) + Penetration)

Damage Dealt = (((((4 + 1) * 1.0) + 0) * (1 - 0.42) + 0) = 2.3 = 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. You can find the HP of an object by pressing "L" when the mouse is hovered on top of an object.

Coverhp.png

Coverhp2.png