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

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 Total            See How Primary Stats are calculated above
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.

BlizzCon 2016

Datamining