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.

200 min damage + 10 = 210

300 delta damage + 12 = 312

This results in the end:

210 Min

522 Max

So 210-522 would be the result from a 10-22 bonus 😉

Evidence to back up what I say I hear? Well let’s look at the game engine:

Damage Weapon Min Total = (Damage Weapon Min + Damage Weapon Bonus Min) * (1 + Damage Weapon Percent Total)

Damage Weapon Delta Total = Max((Damage Weapon Delta SubTotal + Damage Weapon Bonus Delta) * (1 + Damage Weapon Percent Total), 0)

Damage Weapon Max Total = (Damage Weapon Min Total + Damage Weapon Delta Total)

After the break are your **Primary Stats**, **Armor**, **Resistances**, **Casting Speed** and **APS**.

# How Primary Stats are calculated:

Dexterity Total = ((Dexterity + Stats All Bonus + Dexterity Bonus + (Dexterity Item * Core Attributes From Item Bonus Multiplier)) * (1 + Dexterity Bonus Percent)) * (1 – Dexterity Reduction Percent)

Each primary stat is calculated using the following stats:

- Dexterity – Your core stat
- 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 **FLOOR**ed 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:

FLOOR((20 + 0) * (0.02 + 1)) = FLOOR( 20 * 1.02 ) = FLOOR( 20.4 ) = 20

So 20 with a bonus of 2% gives no bonus as far as the SubTotal cares.

With the subtotal calculated the game engine then moves onto the **Armor Total** as follows:

FLOOR((Armor + Armor Item Total + Strength Total) * (Armor Bonus Percent + 1))

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.

Variables used in Armor Calculation:

Armor

Armor Bonus Percent

Armor Item 0

Armor Bonus Item

Armor Item Percent

Armor Item SubTotal FLOOR((Armor Item + Armor Bonus Item) * (Armor Item Percent + 1))

Armor Item Total (Armor Item > 0)?(Max(Armor Item SubTotal, 1)):Armor Item SubTotal

Strength TotalSeeHow Primary Stats are calculatedabove

Armor Total FLOOR((Armor + Armor Item Total + Strength Total) * (Armor Bonus Percent + 1))

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

**Variables used in Resistance Calculation:**

Resistance

Resistance Percent

Resistance Percent All

Resistance Total (Resistance + Resistance All#NONE + Resistance From Intelligence#NONE) * ((Resistance Percent All#NONE + Resistance Percent + 1))

Resistance All

Resistance From Intelligence (Intelligence Total * 0.1)

Intelligence Total See How Primary Stats are calculated above

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

Variables used in Casting Speed Calculation:

Casting Speed

Casting Speed Bonus

Casting Speed Total (Casting Speed + Casting Speed Bonus) * Max(0.1, 1 + Casting Speed Percent)

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

His thread is stickied in the Theorycrafting forum for future reference and he will be adding to it over the coming days.

**Related to this article**

yeah, I asked about rubies in weapons awhile ago

details and numbers in this post (image at bottom)

http://diablo.incgamers.com/forums/showthread.php?831896-Rubies-in-Weapons-Does-anybody-get-how-it-works&p=8362947&viewfull=1#post8362947

Piousflea had explained rubies and delta earlier in the same thread, but

it made no sense to me at first

that’s why I kept bugging for an alternate explanation, but I finally realized he was correct

I understand it now but its just dumb

a +8-16 ruby should give you +8-16

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.

But that’s just me

Compared to Diablo 2 and Diablo 1, they’ve completely changed how it operates, therefore it is confusing.

In D1/D2, +10-20 meant +10 minimum and +20 maximum, that’s it.

But in Diablo 3, the maximum damage is now dependent on the minimum damage (the ‘delta’ stuff) so +10-20 no longer simply means +10-20, it could end up being +10-30.

Even more confusing, they retain the old D1/D2 operations for things like elemental damage, but physical damage works differently.

yeah, its just weird

from the thread

I have a crossbow that does 23-28 damage

putting a +8-16 ruby in the crossbow gives us a max damage of 40

so if we think we’re getting +16 extra damage we’re wrong

28 + 16 = 44

and if we think we’re getting +8 to max we’re also wrong

28 + 8 = 36

why do they do it this way ?

why say +8 to max when that is totally not what it does ? 😕

Yeah if it says +x-y damage it should increase your minimum damage by X and max by Y if it don’t then well done Blizzard you just made everything confusing.

Because, from what I’ve heard, the bonus damage given by rubies actually depends on the weapon attack speed it’s inserted into : faster weapons get a lower +max damage bonus…

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.

Thank you. I’m not sure I am smart enough to digest all this, but I wanted you to know your efforts are appreciated.

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.