Damage (Long War)

From UFOpaedia
Revision as of 20:19, 5 September 2015 by Bingo12345 (talk | contribs)
Jump to navigation Jump to search
This page may be outdated. It is up-to-date for version b15. The latest version is 1.0.




Weapon Damage Calculation

Disclaimer: information bellow is compiled from various dev posts, dev PMs, etc (therefore very likely NOT 100% accurate - we'll hopefully add the missing bits // correct mistakes in the future ) .. It does not paint the complete picture, but it is the best we've got ..

Terms: base_weapon_damage (BWD) - this is each weapon damage stat configurable in DGG.ini . The weapon ranges shown in game in barracks are computed (randomization process) based on this 1 stat with an algorithm designed by Amineri for long war.

Stated design goal (Amineri) " ..Damage variance in general is approximately uniform, but scales linearly with the base damage... WHY I went through the trouble to scale the damage randomization with base damage ? ..ultimately, the motivator for reworking damage variance was part of the effort to change the difficulty curve to make early game easier and late game harder. "

Should be much clearer when we get to examine the randomization process and some nice colored tables .. (Madlaxstreams's idea)


Big steps for calculating damage inflicted by weapon fire

a. Roll for hit. Roll for crit.
b. Multiplicative skills cut the MWD (flush, perhaps Disabling shot )
c. Weapon_Modified_Damage (MWD) is computed (sum of WBD and all the +X to weapon damage from equipped items and relevant perks)
d. Randomisation Process. Roll for damage value in damage range (+- 25 %) (same process for crit and-not crit shots) ..
e. Run target DR gauntlet (multiple steps)
f. Explosive damage extra RNG layer
g. Apply shredder bonus to any remaining damage past target DR
h. Add HeatAmmo bonus damage to robots

Details

b. Not sure about this (no source) %perk modifier

This is probably where %penalty for some skills is applied (flush / disabling shot)

test info seems to indicate BWD*=0.5 for Flush.. (rounded down) Which means flush damage range increases by going up to even BWD number for the weapon..Upping weapon tech to odd BWD will not increase flush damage (due to rounding down)..

Flush damage table range (will include one later).. Keep in mind +X damage perks do add after flush - this would be just the flush damage without the +X damage perks ..

Disabling shot works the same ..

Shredder rocket seems to work similar to flush .. BWD *0.6 rounded down and then +X added ..

c. Modified_Weapon_Damage (MWD) is computed

(sum of BWD and all the +X to weapon damage from equipped items and relevant perks)

Ex:
- ranger adds +1 to primary weapons, rocket launchers, MEC secondary weapons and sidearms
- VPT adds +2 to primary weapon and +1 to secondary vs relevant targets
- sapper +1 to HE and AP grenades; +2 to alien grenades
- foundry project +1 damage for sidearms (Reflex Pistols )
- foundry project +2 damage for AP grenades (Alien Grenades)
- foundry project- plasma research gives +1 to all plasma weapons
- One of the various damage-increasing plasma weapon tech specials +1
- damage items (Alloy-Jacketed Rounds , Enhanced Beam Optics , Plasma Stellerator) add +1 to relevant weapons (INCLUDING SIDEARMS)
- Mayhem adds +2 damage for most explosive grenades, proximity mines and rocket launcher ammo. Confers +2 damage for SAW- and LMG- series weapons (+1 when using Flush), Recoilless Rifle and Blaster Launcher ammo, and alien grenades. Confers +4 damage for sniper and long rifles, marksman's, strike and reflex rifles.
- Precision shot adds (based on weapon tech) for crits (+2 for ballistic, laser and gauss SR ; +3 for pulse ; +4 for plasma)
- Bring'em On on adds 1-2 enemies => +1 damage 3-4 enemies => +2 damage 5-6 enemies => +3 damage 7 or more enemies => +4 damage (side arms too)
- Killer instinct adds extra BWD * 0.334 (rounded up) in case of crit (because 1.334 * 1.5 = 2.001). KI description is only true (+50% damage) if there are no other bonuses in play .. Typically in actual play the bonus provided by KI is lower than +50% .. Skill description should probably state +33.4% of BWD rounded up but since they don't ever show BWD in game .. check bellow for possible values
2 (Assault Rifle, Laser Rifle, Battle Rifle);3 (shotgun, heavy laser rifle, scatter laser, gauss rifle, heavy gauss rifle, alloy cannon, pulse rifle , heavy pulse rifle, plasma rifle); 4 (scatter blaster , heavy plasma rifle , reflex cannon) . Works with side arms too but since side arms have lower BWD - gain will be less ..

- ..

d. The randomization roll .

The purpose of the randomisation is to pick a integer value in roughly [MWD*0.75, MWD*1.25] interval (centered on/average value is MWD ) for non-crits and same length interval approximately shifted + 0.5 * MWD for critical hits (thus centered on MWD*1.5)

Amineri
" The way it's computed is that a die of size 2 x damage (WMD) + 2 is rolled. Each integer point of final damage gets 4 possible results.
Examples:
1) 5 base damage -- a 12 sided die is rolled, with 4 chances each for 4, 5, or 6 damage on a non-critical hit. A critical hit is centered at 7.5 damage, so 4 results each map to 7 and 8, and 2 results each map to 6 and 9.
Results : 33.3% chance of 4, 5 or 6 damage on non-crit, and 16.7% chance of 6 or 9 and 33.3% chance of 7 or 8 damage on a crit.
2) 3 base damage - an 8 sided die is rolled. 4 results map to 3 damage, and 2 results each map to 2 and 4 damage.
Results : 25% chance of 2 or 4 damage, 50% chance of 3 damage
3) 8 base damage - an 18 sided die is rolled. 4 results each map to 7, 8 and 9, and 3 results each map to 6 and 10.
Results : 16.7% chance of 6 or 10, and 22.2% chance of 7, 8, or 9 damage."

Images below should make this much clearer

Damage Roulette SW option: Regular hits range from MWD*0.5 to MWD*1.5, and crits range from MWD*1.5 to MWD*2.5. Note that critical hits then average at MWD*2 instead of MWD*1.5.

LR MWD randomization for non-crits

LR MWD randomisation noncrit.jpg

Y axis has MWD values. Numbers on a Rows are possible Randomisation results for that particular MWD .. The average value of the interval is always the MWD..(red columns in the middle ). Rightmost column has weapon's damage range (min,max) for MWD. Table goes up to MWD 31 (not sure if that it can be currently reached even during endgame) ...

Calculating the probability for a particular value to come up is easy: sum(nr of times value appears on row) / sum(nr total values on row)

So for MWD 10 scoring 7 or 13 damage has 1/22 probability while scoring a 8,9,10 or 11 have 4/22 probability ..

For each MWD level probabilities for each possible values are not the same (sometimes edge values (maximum deviation from average) can have lower probabilities) . (I'm NOT talking chance of combined events (or) - I'm talking chance for each event separately )

-going up a MWD level doesn't always guarantee increase of minimum possible damage.
-pumping MWD increases weapon's average damage linearly but also its variance (less dependable) ..Could overkill in a turn and do significantly less damage the next turn ..

Ballistic shotgun and LMG BWD 6 have 1/14 chances to do only 4 damage on a non crit..
Ballistic Shiv autocannon BWD 7 has 2/16 chance to do only 5 damage on non-crit

LR WMD randomisation for crits

LR MWD randomisation crits.jpg

Y axis has MWD values. Numbers on a Rows are possible Randomisation results for that particular MWD .. The average value of the interval is the MWD * 1.5 where possible (even MWD) ... For odd MWD values [MWD *1.5] and [MWD* 1.5 +1] (integer part) are used ... Rightmost column has weapon's critical damage range (min,max) for MWD.

Calculating the probability for a particular value to come up is easy: sum(nr of times value appears on row) / sum(nr total values on row)

-going up a MWD always increases minimum critical damage possible (sometimes even by 2)
-as game progresses and alien MWD goes up it gets very difficult to protect your soldiers from 1 hit kills

Ballistic pistol: BWD 2 has 1/6 chances to do 4 on a crit and 5/6 to do 3
Ballistic sniper/marksman rifle: BWD 5 have 2/12 to score only 6 damage on crit
Gunslinger Laser Pistol: MWD (3+1) has 5-7 crit damage range
Battle Rifle with Ranger MWD (5+1) has 8-11 crit range (1 shot most early game sectoids/thinmen or exalts)
Heavy Laser Rifle with Ranger and Enhanced Beam Optics: MWD (6+1+1) has 10-14 crit range
Heavy Pulse Rifle with Ranger and Enhanced Beam Optics and VPT: MWD (8+1+1+2) has 15-21 crit range

e. Subtract damage lost to target DR.

Long War adds a new mechanic called Damage Reduction. When a unit takes damage, it is reduced by the damage reduction value. It can be seen in game as a blue shield indication next to the normal red damage indication.

Damage reduction is gained in various ways:

  • Low cover gives 0.66 damage reduction.
  • High cover gives 1.0 damage reduction.
  • Several perks grant damage reduction.
  • Mechanized units commonly have built in damage reduction of varying amounts.

Hunker Down doubles the damage reduction effect of cover, as well as the normal effect of doubling the defense it gives.

If the damage reduction a unit has is not a whole number, the damage is reduced by one of the two nearest whole numbers, with probability based on the fraction. For example, a unit with 1.66 damage reduction has a 66% chance of the damage being reduced by 2 and a 34% chance of the damage being reduced by 1.

Damage reduction can have several interesting effects on game play. One is that a shot against a unit may do 0 damage if the damage inflicted is reduced to 0, which can be a nasty surprise if trying to finish off a 1 HP enemy with a pistol. Once you come up against more advanced units, particularly mechanized ones, you may find yourself completely unable to damage them with lighter weapons such as carbines.

In Detail

The steps in AbsorbDamage are:

  1. Non-cover, flat DR is applied:
    1. General damage reduction stat (including MEC suits, armors, small items, and Iron Skin).
    2. Damage Control reduces damage by 1.5.
    3. Mind Merge on an XCOM soldier reduces damage by Will/50.
    4. One for All active reduces damage to MEC by 1.
    5. Each Ethereal still alive in the final Temple Ship room reduces damage to Uber Ethereal by 15.
  2. All percentage DR is applied (multiplicatively):
    1. Combat Stims active multiplies damage by 0.6 if soldier is in cover and not flanked.
    2. Impact Vest and chryssalids multiply melee and Kinetic Strike damage by 0.6.
    3. Mechtoid with psi shield multiplies damage by 0.5
    4. Shock-Absorbent Armor multiplies damage by 0.667 if source is within 4 tiles.
    5. Absorption Fields multiplies any damage beyond 2 points by 0.6 (ex: 12 damage -> 2 + 0.6 * 10 = 8 damage).
  3. Acid negates the higher of 50% or 3 points of the above DR.
  4. Flat DR from cover is applied if unit is not flanked, and weapon is not an AP Grenade:
    1. Low Cover reduces damage by 0.667, Full Cover reduces damage by 1.0.
    2. Hunkering down reduces damage by a further 0.667 or 1.0.
    3. Will to Survive reduces damage by 1.5.
    4. Fortiores Una reduces damage by a further 0.667 or 1.0.
  5. Effects that negate DR (except acid) are applied:
    1. Combined Arms increases damage by 1.0.
    2. Armor-piercing ammo increases damage by 2.0.
    3. Gauss weapons increase damage by 0.33, or 0.667 with Quenchguns researched.
    4. Final damage is capped at pre-DR damage.
  6. If there is any net DR from the above steps, it is multiplied by 1.5 if damage source is a shotgun without breaching ammo.

CHANGELOG Reworked DR calculation formula so additive modifiers are calculated before multiplicative ones, with the exception of cover DR. This reduces the effect of Absorption Fields and Shock Absorbent Armor.

f. Explosive extra RNG layer

Each unit has the damage reduced based on distance from the center. Damage falls off as the square of the radius. 
For each target hit by explosive blast roll for -1,0,1 to damage (that's why explosive damage ranges are wider than gun damage ranges they get -1 to min and +1 to max)

".. explosive-specific damage effects happen before shredding is applied.." Amineri .

g. Add shredding bonus damage .

What's left after DR (if any) *1.4 if target is shredded ..

if(iDamage > 0) 

{

   iDamage += Max((iDamage * 4) / 10, 1); 

}


Shredding debuff can be completely negated by high DR. But if any sliver of damage makes it past DR, shredding will always add at least 1 extra damage point.. Sapping target DR (removing cover, breaching ammo, acid debuff) can help mitigate to an extent the negative effect high DR can have on shredding effect ..

h. Add HeatAmmo bonus damage to robots

" iDamage += Max(1, (XGWeapon(kItem).GetDamageStat()) / 2);"

BWD * 1/2 truncated down .. Constant value - no RNG involved .. Bypasses all DR mechanics (guard your mechs & SHIV) and does NOT benefit from debuffs (acid/shred) or crit roll

Heat Ammo Bonus Damage added by weapon

SAW 2 LMG 3 Autocannon 3 Minigun 3 -
Autolaser 3 Gatling Laser 3 SuperHeavy Laser 4 Laser Lance 4 -
Gauss Autorifle 3 Gauss Machine Gun 4 Sentry Gun 4 Railgun 4 Gauss Long Rifle 3
Pulse Autoblaster 4 Gatling Pulser 4 Super Pulser 5 Pulse Lance 5 -
Plasma Novagun 4 Plasma Dragon 5 SuperHeavy Plasma 5 Particle cannon 5 -

Heat Warheads bonus damage vs robots

HE 2 AP 2 Alien Grenade 2 Rocket Launcher 3 Recoiless Rifle 4 Blaster Launcher 6


Strategic advice: Since it ignores so many of the regular weapon damage process - sometimes it makes sense to apply the bonus heat ammo damage using abilities that are easy to hit with but don't do otherwise do much damage ... Flush, Suppression/Mayhem and Collateral Damage all make great methods of delivery ..

i. Kinetic strike is as primary weapon

Heat ammo, Ranger and Vital point targeting applied to kinetic strike.