Latest Diablo 3 News

# Thread: How things are calculated in Diablo 3

1. ## How things are calculated in Diablo 3

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:

Code:
```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 lets look at the game engine and have a look:

Code:
```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)```

How Primary Stats are calculated:

Code:
`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:
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 anymore
Core Attributes From Item Bonus Multiplier - Not really used anymore
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:

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

Code:
`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:
Code:
```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:
Code:
```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                [i]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:
Code:
```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:
Code:
```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```
[More to come]

2. ## Re: How things are calculated in Diablo 3

So we can summarize that +mindmg is applied to maxdmg as well, at least when it comes together with a +maxdmg bonus. How odd.

3. ## Re: How things are calculated in Diablo 3

Many games I delved into don't seem to use a min - max range directly. Rather, they seem to calculate damage as min + variable (called delta in the OP). Or in pseudo-math, not rand(min, max) but rand(0, delta) + min, where delta equals original_max - original_min. I find damage calculation a lot more intuitive once you start thinking in these terms.

4. ## Re: How things are calculated in Diablo 3

How does "Increases <specific spell> damage by X%" work?
For example a chest with +5% bonus damage to evasive fire (DH only).

Assume evasive fire is the only thing on your hotbar, how does that compare to straight dex? How does it work with the covering fire rune? (3 shots per activate).

A prime stat is a straight 1% increase in dmg per point according to the char sheet mouseover. 1500 dex = increases all dmg by 1500%.
So does that mean that 5% bonus to evasive fire is the same as 5 points of dex? It sounds like it does but that can't be right. To make it do anything at all would be a lot of man hours of extra coding for something that just doesn't matter that much.

Anyone know how it works? Got a link?

5. ## Re: How things are calculated in Diablo 3

Originally Posted by Tautology
How does "Increases <specific spell> damage by X%" work?
For example a chest with +5% bonus damage to evasive fire (DH only).

Assume evasive fire is the only thing on your hotbar, how does that compare to straight dex? How does it work with the covering fire rune? (3 shots per activate).

A prime stat is a straight 1% increase in dmg per point according to the char sheet mouseover. 1500 dex = increases all dmg by 1500%.
So does that mean that 5% bonus to evasive fire is the same as 5 points of dex? It sounds like it does but that can't be right. To make it do anything at all would be a lot of man hours of extra coding for something that just doesn't matter that much.

Anyone know how it works? Got a link?
As far as I know (from spreadsheets, assumptions, any and all other information I've seen) these bonuses are multiplicative with str/dex/int damage increases. 5% increase in damage with a skill means a literal 5% increase in damage with that skill. IE, total damage without the skill bonus being 100, you would do 105 damage with the bonus included.

6. ## Re: How things are calculated in Diablo 3

Assuming you do 10000 dmg per hit of Foo: If you get 5 more prime stat you will do 10500 dmg per hit with Foo. If you get gear with a 5% bonus to spell Foo and it then does 10500 dmg per hit... ...that would be exactly the same thing, but with =a lot= more work. I've got to be missing something here because that can't be correct. It's too retarded. I can't believe that it could be programmed that way.

7. ## Re: How things are calculated in Diablo 3

Originally Posted by Tautology
Assuming you do 10000 dmg per hit of Foo: If you get 5 more prime stat you will do 10500 dmg per hit with Foo. If you get gear with a 5% bonus to spell Foo and it then does 10500 dmg per hit... ...that would be exactly the same thing, but with =a lot= more work. I've got to be missing something here because that can't be correct. It's too retarded. I can't believe that it could be programmed that way.
A 5 point stat increase is only equal to an overall 5% damage increase when you have 0 stat points to start with (IE str = 0).

Let's assume you have a weapon that does 100 damage every hit, and you have 1000 strength (1000% damage bonus), for 100*(1+10.00) = 1100 dps.
With 1005 strength, you do 100*(1+10.05) = 1105 dps.
With a 5% skill damage bonus, you do 100*(1+10)*1.05 = 1155 dps.

8. ## Re: How things are calculated in Diablo 3

Ah thank you. I knew there was something wrong. So +n bonus to is the same as 100 prime stat +n% of current prime stat. 5% bonus to spell is the same as 105 points of dex if you have 1000 stat current.
14% bonus to spell with 1500 dex = = 100 + (1500 * .14) = 310 dex 14% bonus to spell with 1500 dex = 1810 dex
That correct?

9. ## Re: How things are calculated in Diablo 3

No, not quite. 14% bonus to spell with 1500 dex == (100 +1500)*1.14 - 100 == 1724 dex == 224 equivelent extra dex.

say i do one damage, 1 * 16 (1500 dex) * 1.14 = 18.24 damage. OR, 1 * 18.24 (1724 dex) = 18.24 damage.

14% bonus damage multiplies everything, so multiply the 14% bonus with the dex multiplier.

1500 dex multiplies your damage by 16. Multiply by 1.14. Subtract the 1500 dex and the base 100% to get the equivalent dex.

10. ## Re: How things are calculated in Diablo 3

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.

NO WAY! I thought 10-22 damage stat would turn 200-500 damage into 350 - 768! WHO WOULD HAVE THOUGHT?!>!>!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•