To Hit Calculations

Diablo II Expansion, patch 1.09d

By Tommi Gustafsson

Contents: 1. Chance To Hit | 2. Attack Rating Calculations | 3. Defense Rating Calculations | 4. Special Modifiers | Acknowledgements


1. Chance to Hit

Many attacks in Diablo II depend on attack rating (AR) to hit. Attack Rating is checked against Defense Rating (DR) of the defender by using the following formula:

Chance to Hit % = 100 x AR / (AR + DR) x 2 x Alvl / (Alvl + Dlvl)

AR = Attack Rating of the attacker
DR = Defense Rating of the defender
Alvl = Level of the attacker
Dlvl = Level of the defender

The chance to hit has an upper cap of 95 % and a lower cap of 5 %. Thus, even if the formula gives a result higher than 95 %, the chance to hit will be 95 %. Similarly results lower than 5 % will produce a 5 % chance to hit. However, if the target is running, the to-hit check is skipped and the attack hits automatically (100 % chance).

1.1 Negative AR and DR

If AR is negative, -AR is added to both AR and DR before applying the chance to hit formula. This modification brings AR to zero, which results in a 0 % chance to hit. This is modified to 5 % by the lower cap.

If DR is negative, -DR is added to both AR and DR before applying the chance to hit formula. This modification brings DR to zero, which results in a 100 % chance to hit. This is modified to 95 % by the upper cap.

If both AR and DR are 0 or get modified to 0, the chance to hit is 0 %. This is modified to 5 % by the lower cap.


2. Attack Rating Calculations

2.1 Base Attack Rating

Characters

The Base Attack Rating for characters is calculated as follows:

Base Attack Rating = (Dexterity x 4) - 28 + To Hit Factor

where To Hit Factor is as follows:

Class To Hit Factor
Amazon +5
Sorceress -15
Necromancer -10
Paladin +20
Barbarian +20
Druid +5
Assassin +15

Monsters

Monster's base attack rating is calculated from Normal Attack Rating, which is listed in Arreat Summit's monster pages and the MPQ files, by multiplying it by 4:

Base Attack Rating = 4 x Normal Attack Rating

2.2 Attack Rating

The total attack rating is calculated from the base AR by applying AR modifying effects, such as skills. They are calculated together about as follows:

Attack Rating = (Base Attack Rating + Direct Attack Rating Bonuses) x (1 + Attack Rating Bonuses % / 100)

If there are more than one modifier of the same type, they are summed up.

Attack Rating - Exact Formulas

The exact calculation is a bit more tricky, because the game rounds down intermediate results in calculations. First, we have to calculate Direct Attack Rating, applying only direct bonuses:

Direct Attack Rating = Base Attack Rating

+ Direct Attack Rating Modifier 1
...
+ Direct Attack Rating Modifier N

N is the number of direct attack rating bonuses, such as "+150 to attack rating." To calculate the total attack rating, each percentage modifier is applied separately, rounding each multiplication down as follows:

Attack Rating = Direct Attack Rating

+ [Direct Attack Rating x Percentage Attack Rating Modifier 1 / 100]
...
+ [Direct Attack Rating x Percentage Attack Rating Modifier M / 100]

M is the number of attack rating modifiers, such as "200% bonus to attack rating." [] indicates rounding down.


3. Defense Rating Calculations

3.1 Base Defense Rating

Characters

Base Defense Rating = [Dexterity / 4]

[] indicates rounding down.

Monsters

Monsters' Base Defense Rating is the same as Normal Defense Rating, which is listed in Arreat Summit's monster pages and the MPQ files.

Base Defense Rating = Normal Defense Rating

3.2 Item Defense

A defense of an item with defense value is calculated about as follows:

Item Defense = Normal Item Defense x Ethereality Multiplier x (1 + Enhanced Defense % / 100) + Direct Bonuses to Item Defense

Normal item defense is the normal defense of the item without any modifiers. The ranges of normal item defenses are listed in Arreat Summit's armor pages and the MPQ files. Ethereality Multiplier is 1 if item is not ethereal and 1.5 if the item is ethereal. If there are more than one modifier of the same type, they are summed up.

If an item does not have a defense value, its defense modifiers apply to the total defense rating.

Item Defense - Exact Formulas

Normal Defense uses the given bounds only if there is no Enhanced Defense (ED) modifiers on the armor. If there is any ED on the armor, the maximum value is always used, and it is augmented by 1 through a special modifier. For example, if Normal Defense ranges normally between 23 and 25 and and the item has an ED modifier on it, Normal Defense of 25 is always used.

Base Item Defense is calculated using as follows depending on the case:

1. No Enhanced Defense on the armor:

Base Item Defense = [Normal Item Defense x Ethereality Multiplier]

2. Enhanced Defense on the armor:

Base Item Defense = [(Maximum Normal Item Defense + 1) x Ethereality Multiplier]

Ethereality Multiplier is 1 if item is not ethereal and 1.5 if the item is ethereal. [] indicates rounding down. To calculate the final item defense, the effects of percentage and direct modifiers are added as follows:

Item Defense = Base Item Defense

+ [Base Item Defense x (Percentage Item Defense Modifier 1 / 100 + ... + Percentage Item Defense Modifier M / 100)]

+  Direct Item Defense Modifier 1
...
+ Direct Item Defense Modifier N

M is the number of percentage defense modifiers. The most one typical is Enhanced Defense. [] indicates rounding down. N is the number direct item defense modifiers. Direct item defense modifiers are those that add directly to defense, such as "+X to defense."

Holy Shield

Holy shield increases the defense of the paladin's shield by a certain percentage. It applies to Item Defense, not Base Item Defense as normal Enhanced Defense modifiers do, and therefore it greatly increases the defense of the shield. However, Holy Shield has a bug that it does not affect all item defense modifiers, such as "+ Defense per Character Level," which appears on Stormshield. Holy Shield does increase Base Item Defense (the first term in the above equation) and the effect of Enhanced Defense Modifiers on the shield (the second term in the above equation). For example, if a paladin wields a shield with 430 defense, which results from Normal Defense and Enhanced Defense, and then he turns on a level 28 Holy Shield (+430 % Enhanced Defense), the shield gains +1849 bonus defense (430 * 4.3), to a total of 2279 defense.

3.3 Defense Rating

The total defense rating is calculated from the base DR and item DRs. They are added to defense rating about as follows:

Defense Rating = (Base Defense + Item Defenses + Direct Defense Bonuses) x (1 + Defense Bonus % / 100)

If there are more than one modifier of the same type (e.g. item defense), they are summed up.

Defense Rating - Exact formulas

To get exact results, one has to first calculate Direct Defense Rating and then Defense Rating:

Direct Defense Rating = Base Defense Rating

+ Item Defense 1
...
+ Item Defense M

+ Direct Defense Modifier 1
...
+ Direct Defense Modifier N

M is the number of item defenses from the equipment. N is the number of direct item modifiers that do not increase or decrease item defenses.

There is one special Direct Defense Bonus. If there are at least two defense bonuses, one which adds to defense per character level and one which adds a percentage defense bonus, a +1 bonus is added to Direct Defense Rating. For example, such a case happens when a character is using Stormshield (unique Monarch) and Defiance (paladin defensive aura).

To calculate the total defense rating, apply each percentage bonus separately (even if summed up on the screen), rounding each multiplication down.

Defense Rating = Direct Defense Rating

+ [Direct Defense Rating x Percentage Defense Rating Modifier 1 / 100]
...
+ [Direct Defense Rating x Percentage Defense Rating Modifier M / 100]

M is the number of defense rating modifiers, such as "Defense: +200%" or "Defense: -88%" from skills. [] indicates rounding down.


4. Special Modifiers

Special modifiers take effect when determining the chance to hit. Therefore, they affect the total attack rating and the total defense rating, not any intermediate results.

Modifier Effect
Ignores Target's Defense Treats the defender's DR as zero in determining chance to hit. ITD works only against normal monsters.
Target Defense X% Treats the defender's DR as [X / 100 x DR].
-X to target defense per hit Each successful hit reduces enemy defense by X.
Eth rune This item is bugged. It treats the defender's DR as [-0.25 x DR], when it should be [0.75 x DR].

Acknowledgements

Adeyke for reporting the exact way of calculating item defenses.
Hammerman
for confirming that monsters' base attack rating is multiplied by 4.
Jarulf for reporting that monsters' AR is multiplied by 4.
Kyrene
for reporting the chance to hit when AR and DR are zero.
Ruvanal
for To Hit Factors, and for AR and DR modifications when AR or DR is negative.