How Stuff is Calculated in Diablo 3

Posted By: July 2, 2012

A rather monster undertaking is afoot in the Theorycrafting forums. As a result of his work on DiabloNut Database Dorjan gets lots of queries about formulae used in calculating all manner of things in Diablo 3 – damage, casting speeds, armor, resistances etc.

He’s decided his latest project therefore (in addition to continuing work on the dbase) is to detail all that nitty gritty in a way that as easy to digest as possible.

In the latest update to the thread he has outlined the way in which Weapon Damage is calculated, Primary Stats, Armor, Resistance , Casting Speed and Attacks Per Second is calculated.

How weapon damage is calculated (basic)

Ever seen +10-22 damage (or now +10 Min and +12 Max) and been a little confused at how they change your weapon? Well I’m going to try to explain how weapon damages are calculated, there’ll be more to this soon but the basics shall be first.

+12 Max is actually a bonus to something called Damage Delta which is added onto Damage Min for Damage Max.

So a bonus to min/max would actually roll like this:

Min damage + Min damage bonus

Delta Damage + Delta Damage Bonus

Max damage = Min Damage + Delta damage

So the min AND max bonus are added to the max.

Examples:

A 10-22 damage stat on a ring is actually +10 min damage, +12 max damage, so it would change a 200-500 damage weapon into a 210-522 damage weapon.

Stats All Bonus – If you’ve got +x to all stats, this is what’s changed

Dexterity Bonus – Any + bonuses from affixes

Dexterity Item – Not really used any more

Core Attributes From Item Bonus Multiplier – Not really used any more

Dexterity Bonus Percent

Dexterity Reduction Percent

As you can see, all the bonuses are tallied before the percent bonus, followed by the reduction! So any primary stat reduction will be very hard hitting.

How Armor is calculated:

When the Diablo 3 engine asks for the Armor Item Total it first checks to see if the item has an armor value above zero. If the item does not then the engine checks the subtotal, if the item does then the engine checks the total but also checking that the value is not be below 1.

The Armor Item SubTotal is a FLOORed value. This means that no matter the decimal it will always be round down.

EXAMPLE: Your Leg Armor of awesomeness has +2% armor and a base of 20. In the engine it would look like this:

What is the difference between Armor and Armor Item Total I hear you ask? Well that is a very interesting question. I think back in Beta Patch #14 there was an item called “?????” that had a bonus to this value but apart from that it seems to do nothing. We know Armor doesn’t hold any value from an item and if it was a global bonus (like from a skill) then the value would be added to every single item. We can only assume this is a relic no longer used but is defaulted to 0.

Armor Bonus Percent is done per item, not on a total. So if you have a bonus to armor this is where it happens, on the actual item. A 40% bonus to armor is actually Armor Bonus Percent = 0.40

Interesting to note that only Armor Item has any defined default value, which is 0. The others seem to have nothing set to them as they are initialised. That means they have something else happening to them prior to being used in the formulas, like being assigned the current item or subtotally Mods (affixes/set bonuses etc) applied to the item.

I don’t think any more depth to this topic will help any so I will end it there.

How Resistance is calculated:

Resistances are calculated individually for each element, adding to this value is the Intelligence bonus and multiplied by any bonuses for that element. The #NONE is just a default but is replaced by each element by the engine.

How Casting Speed is calculated:

Casting speed is not really calculated at the moment. Although a huge feature in Diablo 2 it currently isn’t seeing much love from Blizzard in Diablo 3. What this does show however is that the minimum Casting Speed Percent is 0.1.

How Attacks Per Second is calculated:

Attacks per second is calculated in many stages. First the Attacks Per Second Total is asked for by the engine. This checks to see if the current hands weapon has an APS greater than 0. If it does then it uses it and assigns it to the Attacks Per Seocnd, if it does not then it uses whatever the current Attacks Per Second is. Added to this number will be any bonuses and multiplied by the percent in the usual fashion. Again with percents like this the minimum value is 0.1.

This resulting number cannot be below 0.01 though after the multiplication.

Variables used in Attacks Per Second Calculation:

Attacks Per Second Item Attacks Per Second Item Percent Attacks Per Second Item Subtotal Attacks Per Second Item * (1 + Attacks Per Second Item Percent) Attacks Per Second Item Bonus Attacks Per Second Item Total (Attacks Per Second Item Subtotal + Attacks Per Second Item Bonus) Attacks Per Second Attacks Per Second Bonus Attacks Per Second Total Max(0.01, (((Attacks Per Second Item CurrentHand > 0.0) ? Attacks Per Second Item CurrentHand : Attacks Per Second) + Attacks Per Second Bonus + Attacks Per Second Item Bonus) * Max(0.1, (1 + Attacks Per Second Percent))) Attacks Per Second Percent

Effectively it DOES though really when you think about it. +8-16 damage and the MIN is +8 and the MAX is +16 so it IS +8-16 damage total. I understand why some people are confused though but I actually think the new +8 +8 is more confusing.

The Reason for the discrepancy that you mention is that Blizzard’s calculations are quite convoluted.

what actually happens is the following:

1. The game takes the crossbows minimum damage (23), and adds the bonus (8), for a total of 31. 2. The game then substracts the bonus (8) from the max (28) giving 20. This might seems quite strange, but the reason is that max dam is calculated as “min dam + delta dam = max dam”, so since max dam is derived partly from min dam, bonusses to min dam would also affect max dam, if it wasn’t for this correction. 3. Step 2 has the side effect of making the max dam less than the min dam (20 versus 31), and if this happens (also if they are even), max dam is changed to min dam +1 (31 + 1 = 32) 4. After step 3 the bonus to max dam is then added (32 + 8 ) for a total of 40.

BlueTemplar mentions attack speed, this doesn’t actually matter, the reason it might seem so is that slow weapons tend to have a smaller difference between min and max dam, and you therefore get a bigger “free” correction in step 3.

Well in game for me a +8-16 ruby which basic math and convention tells us should be +8 minimum and +16 maximum damage after all that what every other x-y damage number is in ever single game we ever played.

So finding when used it add +8 minimum +8 max don’t make sense to any of us, and it should be simplified to just +8 damage. BTW the web page always showen rubies as +X min & +X max damage where X is say 8.

All I gotta say is I hate math….. Its still very confusing, so how do you figure out the armor part?????

So the # on the item doesn’t matter, its the % bonus that you rarely ever see on items that matters??? I mean what the crap is the point of putting the larger # items on……. Just so stupid, I miss the old system…

Hmm Blizzard fails basic logic and simplification/clarity tests with that damage listing as +10-20 damage should be +10 min and +20 max to what ever you damage was before hand, not +10 min and +10 max.

As for the rest umm, only thing I can see that useful is the STATS & IAS bit. The Armour bit is a lot of work to say nothing more than the armour is always rounded down IE 20 to 20.99999 armour is all 20 armour. To evolutionist it just this armour total = sum of all armour parts including strength*(1+% amour boost, IE from skills) and then round this down. Any other stuff can be ignored (IE +% armour/+x armour on items) as it already been done in the item armour display (well unless there’s a +% global armour boost on a item). The resist well what the **** does that say that we didn’t already know its sum of all resist X *(1+%resist X) = ((INT/10)+resist all +resist X)*(1+%resist X).

Casting Speed seems to be a relic left over from an earlier build as this seems to be = to attack speed in game.