Difference between revisions of "Damage (Long War)"

From UFOpaedia
Jump to navigation Jump to search
Line 44: Line 44:
 
- damage items (Alloy-Jacketed Rounds , Enhanced Beam Optics , Plasma Stellerator) add +1 to relevant weapons (INCLUDING SIDEARMS) <br>
 
- damage items (Alloy-Jacketed Rounds , Enhanced Beam Optics , Plasma Stellerator) add +1 to relevant weapons (INCLUDING SIDEARMS) <br>
 
- Mayhem adds +1 damage for most explosive grenades, proximity mines and rocket launcher ammo. Confers +2 damage for SAW- and LMG- series weapons, Recoilless Rifle and Blaster Launcher ammo, and alien grenades. Confers +4 damage for sniper and long rifles, marksman's, strike and reflex rifles. <br>
 
- Mayhem adds +1 damage for most explosive grenades, proximity mines and rocket launcher ammo. Confers +2 damage for SAW- and LMG- series weapons, Recoilless Rifle and Blaster Launcher ammo, and alien grenades. Confers +4 damage for sniper and long rifles, marksman's, strike and reflex rifles. <br>
- Precision shot adds (?) (based on weapon tech) for crits  (+2 for ballistic, laser and gauss SR ) <br>
+
- Precision shot adds (based on weapon tech) for crits  (+2 for ballistic, laser and gauss SR ; +3 for pulse ; +4 for plasma) <br>
 
- Bring'em On on adds  1 enemy => +1 damage    2-3 enemies => +2 damage 4-5 enemies => +3 damage 6 or more enemies => +4 damage  (side arms too ? works squad sight ?)<br>
 
- Bring'em On on adds  1 enemy => +1 damage    2-3 enemies => +2 damage 4-5 enemies => +3 damage 6 or more enemies => +4 damage  (side arms too ? works squad sight ?)<br>
 
- KI 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 <br>
 
- KI 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 <br>

Revision as of 04:38, 11 December 2014

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. Explosive damage extra RNG layer
f. Run target DR gauntlet (multiple steps)
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)

This is probably where %penalty for some skills is applied (flush / disabling shot) Or maybe those work like KI but that would mean you could buff disabling shot/flush damage with ranger/items/vpt and I don't think that happens .. Maybe Disabling Shot just sets MWD to 1 in long war ..

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

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 weapon
- gunslinger +1 to side arms
- VPT adds +2 to primary weapon and +1 to secondary vs relevant targets
- plasma research gives +1 to all plasma weapons
- sapper +1 to HE and AP grenades; +2 to alien grenades
- foundry project +1 damage for sidearms (reflex pistols ) - damage items (Alloy-Jacketed Rounds , Enhanced Beam Optics , Plasma Stellerator) add +1 to relevant weapons (INCLUDING SIDEARMS)
- Mayhem adds +1 damage for most explosive grenades, proximity mines and rocket launcher ammo. Confers +2 damage for SAW- and LMG- series weapons, 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 enemy => +1 damage 2-3 enemies => +2 damage 4-5 enemies => +3 damage 6 or more enemies => +4 damage (side arms too ? works squad sight ?)
- KI 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 should make this much clearer

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. Explosive extra RNG layer

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) and then subtract damage lost to distance from explosion center

f. 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. Unit with ShieldHP>0 (i.e. Mechtoids) has damage reduced by 50%
  2. Unit with ShockAbsorbantArmor perk has damage reduced by 33% if damage-dealing unit is within 4 tiles distance
  3. Unit with AbsorptionFields perk reduced damage based on formula fReturnDamage = fReturnDamage * (0.6 + 0.4 * Min(1, 2/fReturnDamage))
  4. Unit with general damage reduction stat set in DGC.ini BalanceMods has damage reduced by that amount
  5. Unit with IronSkin perk has damage reduced by 1.0
  6. Unit with HardTarget perk has damage reduced by 1.0
  7. Unit with DamageControl perk active has damage reduced by 1.5
  8. Unit with CombatStims active has damage reduced by 40%
  9. Units wearing Chyrssalid plating (or Chryssalids) get Melee/KSM damage reduced by 40%
  10. SHIVs get damage reduced based on type -- basic: 1.5, alloy, 2.5, Hover, 2.0
  11. MECs get damage reduced by 1.0
  12. If unit is poisoned, then 50% of reduced damage is restored
  13. Cover DR is applied:
    1. Only applies if unit is not flanked by attacker, unless weapon is a Needle Grenade
    2. Low Cover damage reduced by 0.667, OR Full Cover damage reduced by 1.0
    3. If Hunkered Down, then if in Low Cover damage reduced by -0.667 OR Full Cover damage reduced by 1.0
    4. If unit has WillToSurvive perk, damage reduced by 1.5
    5. If Unit has FortioresUna perk, damage reduced by 0.5
    6. If attacking unit has Combined Arms perk, damage increased by 1.0 -- this cannot do more than negate damage reduction from cover
  14. If attacking unit has armor-piercing ammo, damage increased by 1.0 -- this cannot do more than negate damage reduction from all sources above
  15. Any fractional damage is randomized using if(FRand() < (fReturnDamage - float(FFloor(fReturnDamage)))
  1. Shotguns suffer an extra 50% DR from anything with DR What step ?
  2. Gauss DR ignore What step ?

g. Add shredding bonus damage .

What's left after DR (if any) *0.4 if target is shredded (min +1 damage) ..

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

Shredding debuff can be almost completely negated by high DR but it should 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, (3 * XGWeapon(kItem).GetDamageStat()) / 4);"

BWD * 3/4 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 3 LMG 4 Autocannon 5 Minigun 6 -
Autolaser 4 Gatling Laser 5 SuperHeavy Laser 6 Laser Lance 6 -
Gauss Autorifle 5 Gauss Machine Gun 6 Sentry Gun 6 Railgun 7 Gauss Long Rifle 5
Pulse Autoblaster 6 Gatling Pulser 6 Super Pulser 7 Pulse Lance 7 -
Plasma Novagun 6 Plasma Dragon 7 SuperHeavy Plasma 8 Particle cannon 8 -

Heat Warheads bonus damage vs robots

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


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