While I think people mostly understand now the major points of how the game calculates damage, I think it’d be useful to have a central reference for this. First, to encourage discussion on the things I may have gotten wrong, obviously, and second so that you don’t have to search the boards for an hour to find the tiniest bit of accurate information. Comments in orange are those that I still have to test whenever I get a minute, which might not be for the next few days.
Before we start crunching numbers, there are a few rules that one should understand about how damage works:
1) Virtually all bonus damage is additive. If you find an item with +20% melee damage, for instance, or +10% all damage, it’s not going to multiply your current damage output by 1.2 or 1.1, respectively. The damage bonus will add to all the other bonus sources you may have, and only then will the resulting total be applied to your base damage.
2) Fumbles only happen on auto-attacks, not on skills.
3) Fumbles never crit.
4) DoTs don’t crit. Nope.
5) Weapon-based critical hits always deal maximum damage. Surprisingly, I haven’t seen anyone mention this here yet though it’s both rather huge in terms of optimization, and pretty glaring when you look at the combat log. This holds true for auto-attacks and all skills wased on weapon DPS.
6) There are hard caps you can’t go over, no matter how much stuff you stack:
- Fumble chance: minimum of 0% (duh)
- Fumble damage recovery: maximum of -0% (duh again)
- Execute chance: maximum of 100% (you don’t say?)
- Critical chance: maximum of 100% (yes, this is Captain Obvious speaking)
- Critical damage: maximum of 500%
- Dodge chance: maximum of 75%
- Block chance: maximum of 75%
The Fake Formula
The formula below describes how damage works, but incorrectly. I want to make that very clear. However, it’s simple enough to give you a basic understanding of how things work, and then I’ll go on to post the actual full formula.
- Code: Select all
DPS = base_dps * (1+bonus_damage) * (1+speed_bonus) * (1+crit%*crit_dmg) * (1+u*fumble%*fumble_dmg)
1) The bonus damage is, like I mentioned above, the sum of all sources of applicable bonus damage. This includes:
- strength bonus for weapons (equal to Str/2 and uncapped)
- focus bonus for elemental damage (equal to Foc/2 and also uncapped)
- sources of direct applicable bonuses like +10% all damage, +35% fire damage, +20% ranged weapon damage, etc.
In very few cases, a source of bonus damage will apply directly to the base damage (instead of being added to all the others), thus making it extremely valuable. This is the case, for example, with Prismatic Bolt’s tier bonuses.
2) The speed bonus is either attack speed bonus (if it’s a weapon attack) or a cast speed bonus (if it’s a skill). Some skills have a cooldown, and as far as I know they never benefit from casting speed bonuses in terms of damage per second. Others are channeled (their mana cost is expressed in mana per second): some of them do benefit (Arc Beam, Shocking Burst for instance) from cast speed bonuses, but others don't (Magma Spear); at this point I'm not sure why, and I don't have a full list. In all cases, however, cast speed does accelerate the wind-up animation, so the spells do come out a bit quicker. Attack speed does benefit skills based on weapon DPS indirectly, in that increasing attack speed increases weapon DPS.
3) Critical hit chance for skills is actually often not the one you see in the Arcane Statistics panel. For skills dealing a percentage of weapon DPS, it is usually your normal crit chance multiplied by this factor. For other skills it's a different hidden value that needs to be figured out (or fished from game data files). For instance, each pillar of Ice Prison has a ~75% adjustment to its crit chance when shattering.
4) The next expression is the increased damage from critical hits, assuming critical hits are based off the normal base damage range. Since weapon-based crits always deal max damage, this expression is in fact wrong for thos type of attacks but it's just simpler to visualize like this anyway.
5) The last expression is fumbles. Fumbles only happen on auto-attacks, so u is a special variable equal to 1 for auto-attacks, and equal to 0 with skills. Since fumbles and crits are separate events, this expression is technically wrong too - again, it's simpler to explain the concepts this way.
6) Base dps here can be a great many things.
- With auto-attacks, your base dps is your weapon DPS. But wait! That’s straightforward enough with one-handed and shield or with two-handed weapons, but with dual weapons it becomes more complicated.
- Dual weapons alternate their attacks depending on their speed, which works out to a sort of averaging of their DPS values. That’s lame, because it makes them strictly inferior to one-handed weapons. Their saving grace is Execute. Execute means both fire at once, so your damage is the sum of the two.
The DPS formula for dual wield has been found to be the following (I take no credit for that one – in fact I haven’t even tested it, so take that with a pinch of salt):
- Code: Select all
Base_dps = (A+B)/(a+b) * (1+execute%)
A and B are the average damage per hit values of the two weapons, a and b are their respective speeds.
- With skills based on weapon damage (those that say “X% of weapon DPS”) in the tooltip, the base dps is:
- Code: Select all
Base_dps = WDPS * X% / CS
where X% is the skill’s damage multiplier and CS is the cycle speed of the skill, i.e. the time between two consecutive castings of the skill.
Cycle speed isn't listed anywhere and must be figured out for each skill (though it is equal to the cooldown on skills that have those). It is only relevant if you want an absolute measure of DPS, or want to compare two skills in terms of damage over time. If you're just figuring out the optimal gear/stats for one skill, then you can actually do your comparisons without this variable.
Do note that when dual-wielding, skill damage is always, and only, based on the weapon in your right hand (i.e. the one in the box on the left side of the inventory screen) (edit: except Arc Beam, apparently - credit to Baron).
If the skill deals elemental damage (“X% of weapon DPS as Fire,” for instance) then you get to add both Strength and Focus as sources of bonus damage in (1).
- With skills based on flat damage values, such as say Hailstorm, the base dps is the damage range listed in the tooltip divided by the cycle speed. Easy. For those skills, Strength does not factor at all and it’s all about the Focus.
The Actual Formula
Now that we understand the basics, let’s dig into the details. The actual accurate formula is the following (hang on, it’s a bit long):
- Code: Select all
DPS = (1+bonus_damage) * (1+speed_bonus) * [(1- u * fumble%) * [(1-crit%) * base_dps + crit% * crit_dmg * crit_dps] + u * fumble% * fumble_dmg * base_dps]
Yay for science. Pay attention to the nested parentheses, it’s a bit hard to read on screen.
Crit_dps is basically the same as base_dps for flat-damage skills (e.g. Hailstorm), and is the maximum damage in the range for weapon-based skills (e.g. Flame Hammer) and auto-attacks.
The idea is basically that:
- if you fumble, you deal your fumble damage (if it’s an auto-attack, obviously)
- if you don’t, you have a chance to crit and deal crit damage (plus your crit damage bonus)
- otherwise you deal normal damage
- whatever happens, it’s all augmented by bonus damage and the appropriate speed bonuses
But it gets worse, because sometimes base_dps is actually made of different things: physical and elemental damage. In this case, I won’t type out the whole equation but basically you need to split the physical and elemental damage, calculate DPS separately, then add them up again, all because elemental damage is increased by Focus (and some specific bonus sources, like +15% ice damage) while physical isn’t.
Gear: As If It Weren’t Confusing Enough
There are many affixes on gear that can impact the equation above (poetically named “(2)”).
- increases to attack or cast speed add to the speed_bonus variable
- damage increases, when relevant (and including Strength and Focus, or Melee/Ranged bonuses), add to the damage_bonus variable
- affixes modifying crit chance, crit damage, fumble chance and fumble recovery add to their respective variables
- here’s where it gets neat: what happens with stuff that adds fixed damage?
Well, thanks for asking. It depends on whether it’s a weapon socketable (or a weapon enchantment) or not. If it is, the added damage value gets added to the base weapon damage per hit. This is huge, because if you add a Skull of Vellinque (+199 physical damage) to a weapon that deals 100 damage per hit, you’re essentially tripling the total DPS (give or take). Bear in mind that if you add elemental damage such as from Embers, it gets bonus damage from Strength AND Focus (and all other applicable bonus sources). The flip side is that if you’re using a flat-damage skill, your weapon is irrelevant and so is this socketable.
If it’s not a weapon socketable/enchantment, then it sucks. Not that I’m judging. The fact is, it gets no bonus damage whatsoever. That +173 ice damage necklace basically adds 173 ice damage to your final damage number before fumbles and crits, but that’s it. You could have 2000 Focus and you’d still only get +173 ice damage, even with skills. Note that the bonus damage from Sword and Board works like this too, making it IMO the most useless skill in the game.
Adding to the confusion is how the game calculates it: all elemental damages are actually calculated and applied separately, which means that enemy armor will apply separately to each of them. In addition, when socketing a physical damage gem (or enchant, etc.) in a weapon dealing physical damage, the game will count it separately. In other words, any addition of physical damage applies separately from the weapon's base physical damage. Yes, it's a bit confusing so here's a screenshot:
Weapon affixes and skills
(largely copied from my Embermage Handbook but has general applications)
There's a lot of confusion around which skill applies which weapon affix. Like I said above, skills based on weapon DPS transmit some effects, but not all of them. Let me refine that a bit.
1) Skills that are NOT based on weapon DPS do not transmit any active effect (i.e. DoTs, % chance to cast spells, armor debuffs, etc.).
2) Skills based on weapon DPS may transmit some, but it depends on the effect and on the skill.
DoTs from skills never stack with themselves: you can cast Magma Spear as many times as you like, but the target isn't going to get more damage per second (however, the duration will be refreshed each time). Do note that the number in the icon that tells you how much damage the target is taking does change for some skills, as some DoTs have a damage range and a new application can roll a different number in that range. DoTs from skills usually scale with focus and the appropriate +% damage modifiers.
DoTs from weapons (as a native affix, not as a socket - enchantments not tested at this time) DO stack with themselves [edit: apparently so do DoTs from enchantments - thanks lminith]. Two hits from Endgame will result in the target taking twice the damage over time, with the game keeping track of each duration separately (the icon will only show the longest time remaining). In addition, those DoTs scale with your character's Focus, but not his strength (even though technically they're physical damage - go figure). In other words, they can be a source of massive damage if you have a fast-attacking weapon or a fast-casting skill, and lots of Focus.
DoTs from socketables stack with themselves too, both from multiple weapon hits or from having multiple socketables in one weapon. However, they don't scale with Focus (nor Strength), so their damage ends up rather piddly. Not worth the socket IMO. (edit: apparently fixed to scale with Focus in 1.22 - according to patch notes - but I haven't tested it)
Also, as a miscellaneous bit of information: DoTs don't build charge, whether from a skill, weapon or socketable.
Armor debuffs from weapons or socketables do stack with themselves too. More interestingly, the "% chance to flee" debuff (which I assume works like other "chance to inflict X" affixes) seems to stack too, though I have no idea how that works: if you hit the dummy with a "10% chance to flee" weapon, once every few hits it'll get a little icon that says "10% chance to flee". If it gets that effect applied again, the icon will be upgraded to 20%, then 30, etc. At face value it's like you have a chance to inflict a debuff that has a chance to cause the target to flee; my guess is that the game is just acting up a bit and the 20/30/40% chances just mean the "fleeing" debuff was applied while it was still active from a previous hit.
What About Attributes?
Attributes define a lot of the damage variables. What often happens is you take an attribute, derive the base value of, say, crit chance, and then add to that all the fixed bonuses you have (usually from gear).
Crit% = Dex * (0.2002 – 0.0002 * Dex), capped at 50.1% at 500 Dex (Dodge also follows this relationship)
Crit_dmg = 50 + Str * 0.4, capped at 450% (technically 449.6%; basically Str above 999 doesn’t give you anything. Total crit damage from all sources caps at 500% in the Arcane Statistics screen though)
Fumble% = 21%, and no amount of stats will change that number, only gear will improve it
Fumble_dmg = 25 + Dex * (0.3003 – 0.0003 * Dex), capped at 100% at 476 Dex
Execute% = 9.8 + Foc * (0.2002 – 0.0002 * Foc), capped at 60% at 500 Focus (technically 498)
Block% = Vit * (0.2002 - 0.0002 * Vit), capped at 50.1% at 500 Vit
How the Character and Arcane Statistics panels report things
Have you ever wondered what the Character and AS panels reported exactly? I know I have. Let’s find out with Serguei, my trusty consoled character.
Serguei's equipped with two Corbucci's rings, a pair of Steam-Tech Nines, and 6 pieces of the Labarinto set (which is, incidentally, ugly as hell).
Let's take a look at some numbers:
1) Physical Damage: 531-1069
The Steam-Tech Nine (which I'll call Tec9 as it's shorter) deals 79-159 physical damage. Serguei has 1000 Str, and his gears give him +72% ranged weapon damage. 79 * (1+1000/200+72/100) = 530.88; 159 * (1+1000/200+72/100) = 1068.48
2) Elemental damages: 1077 ice and poison
This field only seems to report the maximum value, not the average. The Tec9 deals 80-159 ice and poison damage. Serguei has 1000 Str and 10 Focus, and his gear gives him +72% ranged weapon damage. 159 * (1+1000/200+10/200) = 1076.43
3) Critical Damage: 19338
Serguei has +500% critical hit damage. Adding up the maximum physical, ice and poison damages above and boosting them by +500% gives (1069+1077+1077)*(1+500%) = 19338
4) Damage per second: 3995
The Tec9 deals 119 average physical damage, 119.5 average ice and poison damage, and has an attack speed of 0.64. Serguei has 6% increased attack speed.
DPS(physical) = 119/0.64 * (1+6%) * (1+1000/200+72/100) = 1324.47
DPS(ice) = 119.5/0.64 * (1+6%) * (1+1000/200+10/200+72/100) = 1339.93
DPS(poison) = 119.5/0.64 * (1+6%) * (1+1000/200+10/200+72/100) = 1339.93
DPS(total) = 1324.47+1339.93+1339.93 = 4004.33
That's an extra 10 points compared to the stats screen, which I'm attributing to rounding error. Note that this number doesn't take crits into account, and further testing shows it doesn't take fumbles into account either.
5) Magic Damage (from character screen): 1070-2154
2154 is simply twice (ice + poison) the 1077 number we've seen above. Repeating that calculation with the minimum damage of 80 gives you 541.6 minimum ice and poison damage, or 1081.2 total. I'm going to call rounding error again, but I can't help but notice that if you use 79 instead of 80 as the minimum elemental damage, all the calculations end up yielding exactly the reported numbers. I'm guessing the minimum damage is misreported in the tooltip.
6. Weapon Damage: 1601-3223
Easy enough: 531-1069 physical, 541-1077 ice and poison, total 1613-3223. Again this weird thing with the minimum value, see above.
7. Further testing reveals that none of the numbers above, including DPS, take fumbles into account.
So we now know what the reported numbers correspond to.
So we know that armor is basically a direct reduction to damage taken, and that a random amount between 50 and 100% of the armor value is applied to each hit. Beyond that not much has been done to figure out how armor works, which is why Chthon's work was so interesting. Lifted straight from his post a couple pages down:
Chthon wrote:A brief report on how monster armor works:
1. Testing methodology
Testing monster armor is a flying pain the ass for a couple of reasons. First, there's a range of damage reduction, so instead of straight numbers, you've got to deal with averages and mins and maxes that you're never sure you've hit yet. Second, the practice dummy has such absurdly high armor values that testing against it often results in damage being reduced to zero (for which the game gives you a consolation prize of 1 damage).
The best method I could come up with was this: I started a new character a made my way to the path of the honored dead where monsters are level 4 (at least for me). The low level results in a low armor, which in turn results in a narrow range of damage reduction, which allows testing to proceed without requiring a huge number of samples. Console "levelup 99" to get access to any skill I want to mess with and to equip any item. Console "aifreeze" to make the monsters hold still. Console "unit bandit_assassin" to spawn a bandit assassin to spawn an unlimited supply of guys to hit. I picked the assassin because he's supposed to have flat 100% armor across all types. Use console to spawn weapons as desired. Axes are preferred because they have no damage range to muddy up the picture. Start with a plain no-mods physical axe, then work up to more complicated weapons. For each sample, look at the combat log and subtract the "post" value from the (bonus modified) damage roll (the number on the right of the arrow).
2. Getting from .dat to actual damage reduction.
This one is a bit of a head-scratcher. ARMOR_MONSTER_BYLEVEL_VERYHARD.DAT says that level 4 monsters are supposed to have 15.14 armor. BANDIT_ASSASSIN.DAT says that bandit assassins are supposed to have 100% normal armor for all armor types. The observed range of damage reduction against the plain axe was 9-17. I don't really have a good theory for this discrepancy. (Uh... the monsters are really level 4.5?) If anyone is able to figure out where that extra 2 points of armor came from, please let me know.
3. Really unexpected result: Monster armor scales with skill WDPS!
For weapon-DPS-based skills that do less than 100% weapon DPS, monster armor is scaled by the same percentage. To replicate: While equipped with your plain axe, use a skill with really low WDPS at early ranks (rank 1 Chain Snare is a good example) and compare the average damage reduction to the average reduction from normal hits with the plain axe.
This is BIG NEWS since it means that a lot of skills everyone thought would get absolutely clobbered by armor to the point of uselessness are actually viable. (And Ravage fans should be doing a happy dance.)
4. Another unexpected result: Monster armor scales on secondary targets.
The armor on monsters taking splash damage from non-claw melee weapons (i.e., secondary targets) is getting scaled down by something -- presumably your damage-to-secondary-targets percentage. To replicate: Spawn two bandit assassins on top of each other; whack with plain axe.
5. Multi-type damage gets pro-rated... with one major anomaly
When you hit with a weapon that does multiple damage types, the monster's armor gets pro rated across the various damage sources. The pro rating is done in proportion to the post-roll, fully modified damage for each type (rather than the pre-modifier roll, or the pre-roll min/max/avg).
To replicate: This is best tested by using wands/staves with equal bases for all four elements. Each element will be reduced by 1/4 as much as your plain axe hits were. The Beast with a Million Eyes demonstrates that the base physical damage is also subject to pro rating (but see below). Adding items like 2x Ratchet Ring to boost one particular element will show that the pro rating cares about the final, post modifier roll.
Now for the anomaly:
If the weapon does base physical damage, this gets reduced by more than it should. To be precise, it looks like double. This appears to result in more than 100% of the monster's armor getting applied.
Example: A Four-Bearded Axe socketed with 3x Iron Ember Chip does 114 base physical and 105 +physical (yes, they get separate lines in the console even though they're both physical). That was as close as I could get to what should be a 50/50 pro rating. It's not. The base physical is subject to the exact same reduction range as the the plain axe (double what was expected), while the reduction applied to the +dmg from the socketables is about half what the plain axe had (as expected). The sum result is that ~150% of the monster's armor gets applied!
Another example: Mountain of the Cannibal God. One would expect the reduction applied to the poison to be ~1.5x bigger than the reduction to the base physical, but the reduction to the base physical is actually slightly larger. Adding points to focus and/or poison_dmg% gear can eventually flip this over, but the reduction applied to the base physical stays higher than the ratio between the damage types would indicate.
My best theory to explain this is that it's a BUG.
6. Degrading Armor
These effects stack with each other and themselves. Unless otherwise stated, they have a 5 sec duration. They are not scaled down (or up) by WDPS% on skills (at least not for the skills I tested with). Ordinarily, these effects apply after the hit does its damage. One exception I saw was Ravage, where each hit does its armor degrade effect before it does its damage (degrade, hit, degrade, hit, degrade, hit). (Yet another reason for Ravage fans to do a happy dance.)
7. "Monsters takes X% more damage" effects (like Howl)
These effects are applied after the monster's armor is applied.
8. Frost Breath
Applies its "monsters takes X% more damage" effect before it does its damage.
9. Multi-component skills (like Wolfpack)
I only tested Wolfpack, but I assume the others (like Emberquake) work the same. It's hard to tell because the console reports poorly on flat damage skills, but it looks like the two components are treated as separate hits that are each subject to the monster's full armor. Also, if the flat component (against, just tested Wolfpack) is sufficient to kill a monster, the WDPS component doesn't happen at all.