Damage: Difference between revisions

From Heroes 3 wiki
Jump to navigation Jump to search
m (Formatting)
(55 intermediate revisions by 21 users not shown)
Line 1: Line 1:
'''Damage''' is a general term for the amount of [[health]] loss a [[creature]] or a [[spell]] can cause to a single creature or to a creatures [[stack]]. If a creature suffers more damage than its current health, it is eliminated, while in a stack of creatures, the topmost dies. The remainder of the damage is dealt to the next one and so forth until all damage is dealt or the whole stack is eliminated.
'''Damage''' is a general term for the amount of [[health]] loss a [[creature]] or a [[spell]] can cause to a single creature or to a creatures [[stack]]. If a creature suffers more damage than its current health, it is eliminated, while in a stack of creatures, the topmost dies. The remainder of the damage is dealt to the next one and so forth until all damage is dealt or the whole stack is eliminated.


Creature's ability to deal damage typically has a range, which means that it causes randomly chosen damage between the minimum and maximum value. Some creatures like [[Naga]]s do not have a damage treshold meaning they always do the same amount of damage. Creatures in a stack cause individual damages, and the combined damage of the stack is calculated by adding them together. However, the final damage can deviate from the combined damage greatly because of different additions and reductions, which are covered in the next section.
Creature's ability to deal damage typically has a range, which means that it causes randomly chosen damage between the minimum and maximum value. Some creatures like [[Naga]]s do not have a damage range, meaning they deal a fixed amount of damage. This is also true for creatures that are [[bless]]ed or [[curse]]d. Creatures in a stack cause individual damages, and the combined damage of the stack is calculated by adding them together (see External Links below). However, the final damage can deviate from the combined damage greatly because of different additions and reductions, which are covered in the next section.


Spells can deal damage much like creatures do, except that the amount of inflicted damage does not vary within a range but is fixed. The exact amount of unmodified spell damage can always be calculated with a linear formula. For example, basic [[Lightning Bolt]] cast by a hero with 7 [[Primary skill#Power skill|spell power]] does 7 × 25 + 10 = 185 damage. For other spells different values than 25 and 10 need to be substituted. The eventual amount of spell damage is modified as follows:
Spells can deal damage much like creatures do, except that the amount of inflicted damage does not vary within a range but is fixed. The exact amount of unmodified spell damage can always be calculated with a linear formula. For example, basic [[Lightning Bolt]] cast by a hero with 7 [[Primary skill#Power skill|spell power]] does 7 × 25 + 10 = 185 damage. For other spells different values than 25 and 10 need to be substituted. The eventual amount of spell damage is modified as follows:
*The [[Sorcery]] secondary skill increases spell damage.
*The [[Sorcery]] secondary skill increases spell damage.
*Heroes increase spell damage with 3% per hero level when casting the spell they [[Hero specialty#Spell specialties|specialize]] in.
*Some Heroes increase spell damage by 3% per hero level when casting the spell they [[Hero specialty#Spell specialties|specialize]] in.
*Other Heroes increase spell damage of the spell they specialize in by a percentage which never changes.
*[[Elemental]]s take double damage from certain spells. [[Fire Elemental]]s, for example, are vulnerable to [[Ice Bolt]].   
*[[Elemental]]s take double damage from certain spells. [[Fire Elemental]]s, for example, are vulnerable to [[Ice Bolt]].   
*The damage that [[Stone Golem]]s, [[Iron Golem]]s, [[Gold Golem]]s and [[Diamond Golem]]s take from spells is reduced by, respectively, 50%, 75%, 85% and 95%.
*The damage that [[Stone Golem]]s, [[Iron Golem]]s, [[Gold Golem]]s and [[Diamond Golem]]s take from spells is reduced by, respectively, 50%, 75%, 85% and 95%.
*The spells [[Protection from Air]], [[Protection from Earth|Earth]], [[Protection from Fire|Fire]] and [[Protection from Water|Water]] reduce spell damage from the school they protect against by 30%, or even by 50% when cast at advanced or expert level.
*The spells [[Protection from Air]], [[Protection from Earth|Earth]], [[Protection from Fire|Fire]] and [[Protection from Water|Water]] reduce spell damage from the school they protect against by 30%, or even by 50% when cast at basic or advanced/expert level.
*[[Dwarf|Dwarves]] have a 20% chance and [[Battle Dwarf|Battle Dwarves]] a 40% chance to completely resist any (damage) spells.
 
*Creatures adjacent to [[Unicorn]]s and [[War Unicorn]]s have a 20% chance to completely resist any (damage) spells.
Moreover, [[magic resistance]] ability, [[Resistance]] secondary skill and resistance artifacts such as the [[Boots of Polarity]] give a chance to completely avoid spell damage. Some creatures are naturally [[immunity|immune]] to some damage spells, or even to all spells. Finally, there are some artifacts which make your units immune to a certain damage spell, or disallow casting certain spells to both sides. [[Orb of Inhibition]] and [[Anti-Magic Garrison]] ban all spells with no exceptions.
*The [[Resistance]] secondary skill and resistance artifacts such as the [[Boots of Polarity]] provide each creature stack of a hero's army with a chance to resist any (damage) spell.
*Some creatures are naturally [[immunity|immune]] to certain (damage) spells.


== Damage calculation of creature stacks ==
== Damage calculation of creature stacks ==
=== The damage calculation formula ===
=== The damage calculation formula ===
{| border=1 cellspacing=0 style="margin: 0 0 0 1em; float:right; border: 1px solid; background:#{{Grey 3}};"
{| class="wikitable" style="margin: 0 0 0 1em; float:right;"
|+ <big>'''Table 1: Damage calculation variables'''</big>
|+ <big>'''Table 1: Damage calculation variables'''</big>
|- bgcolor={{Grey 1}}
|-  
! {{-}}Description{{-}}
! {{-}}Description{{-}}
|-
| {{-}}DMG<sub>b</sub> = Base damage
|-  
|-  
| {{-}}I<sub>1</sub>&thinsp;&thinsp; = 0.05 &times; ([[Attack]] - [[Defense]]) (if A ≥ D)
| {{-}}I<sub>1</sub>&thinsp;&thinsp; = 0.05 &times; ([[Attack]] - [[Defense]]) (if A ≥ D)
Line 31: Line 32:
| {{-}}I<sub>4</sub>&thinsp;&thinsp; = 1.00 for [[luck]]y strikes
| {{-}}I<sub>4</sub>&thinsp;&thinsp; = 1.00 for [[luck]]y strikes
|-
|-
| {{-}}I<sub>5</sub>&thinsp;&thinsp; = 1.00 for [[Death Blow]], [[Ballista]] double damage<br>
| {{-}}I<sub>5</sub>&thinsp;&thinsp; = 2.00 for [[Cannon]]{{-wh}} triple damage<br>
&emsp;&thinsp;&thinsp;&thinsp;&thinsp;= 1.00 for [[Death Blow]], [[Ballista]] or cannon{{-wh}} double damage<br>  
&emsp;&thinsp;&thinsp;&thinsp;&thinsp;= 1.00 if [[Elemental]] attacks opposite [[Elemental]] type<br>
&emsp;&thinsp;&thinsp;&thinsp;&thinsp;= 1.00 if [[Elemental]] attacks opposite [[Elemental]] type<br>
&emsp;&thinsp;&thinsp;&thinsp;&thinsp;= 0.50 for [[hate]]<br>
&emsp;&thinsp;&thinsp;&thinsp;&thinsp;= 0.50 for [[hate]]<br>
Line 42: Line 44:
| {{-}}R<sub>3</sub> = 0.05 &times; R<sub>2</sub> &times; hero level for Armorer [[Hero_specialty#Secondary_skill_specialties|specialty]]
| {{-}}R<sub>3</sub> = 0.05 &times; R<sub>2</sub> &times; hero level for Armorer [[Hero_specialty#Secondary_skill_specialties|specialty]]
|-
|-
| {{-}}R<sub>4</sub> = 0.15 for [[Shield]], 0.30 at advanced, expert level<br>
| {{-}}R<sub>4</sub> = 0.15, 0.30 for basic, advanced/expert level [[Shield]]<br>
&emsp;&ensp;&thinsp;= 0.25 for [[Air Shield]], 0.50 at advanced, expert level<br>
&emsp;&ensp;&thinsp;= 0.25, 0.50 for basic, advanced/expert level [[Air Shield]]
&emsp;&ensp;&thinsp;= 0.50 for shooter with (basic) [[Forgetfulness]]
|-
|-
| {{-}}R<sub>5</sub> = 0.50 if attacker has [[range penalty|range]] or [[melee penalty]]{{-}}
| {{-}}R<sub>5</sub> = 0.50 if attacker has [[range penalty|range]] or [[melee penalty]]{{-}}
Line 51: Line 52:
|-
|-
| {{-}}R<sub>7</sub> = 0.50 for retaliation after being [[Blind]]ed<br>
| {{-}}R<sub>7</sub> = 0.50 for retaliation after being [[Blind]]ed<br>
&emsp;&ensp;&thinsp;= 0.75 for retaliation after advanced [[Blind]]
&emsp;&ensp;&thinsp;= 0.75 for retaliation after advanced [[Blind]]<br>
&emsp;&ensp;&thinsp;= 0.50 for shooter with basic [[Forgetfulness]]<br>
&emsp;&ensp;&thinsp;= 0.50 for shooter's melee attack with [[Forgetfulness]]
|-
|-
| {{-}}R<sub>8</sub> = 0.50 for Psychic Elemental vs. [[mind spell]] immunity<br>
| {{-}}R<sub>8</sub> = 0.50 for Psychic Elemental vs. [[mind spell]] immunity<br>
Line 57: Line 60:
&emsp;&ensp;&thinsp;= 0.50 if target is [[Petrify|petrified]]<br>
&emsp;&ensp;&thinsp;= 0.50 if target is [[Petrify|petrified]]<br>
&emsp;&ensp;&thinsp;= 0.75 for retaliation after being [[paralyze]]d
&emsp;&ensp;&thinsp;= 0.75 for retaliation after being [[paralyze]]d
|-
| {{-}}R<sub>9</sub> =  0.50 for [[Luck|unlucky]] {{wh}} strikes
|}
|}


Mathematical formula for calculating the final damage (DMG<small>f</small>) is:
Mathematical formula for calculating the final damage (DMG<small>f</small>) is:


<big><code> DMG<sub>f</sub> = DMG<sub>b</sub> &times; (1 + I<sub>1</sub> + I<sub>2</sub> + I<sub>3</sub> + I<sub>4</sub> + I<sub>5</sub>) &times; (1 - R<sub>1</sub>)&times;(1 - R<sub>2</sub>)&times;(1 - R<sub>3</sub>)&times;(1 - R<sub>4</sub>)&times;(1 - R<sub>5</sub>)&times;(1 - R<sub>6</sub>)&times;(1 - R<sub>7</sub>)&times;(1 - R<sub>8</sub>)</code></big>
{{Math|DMG<sub>f</sub> <nowiki>=</nowiki> DMG<sub>b</sub> &times; (1 + I<sub>1</sub> + I<sub>2</sub> + I<sub>3</sub> + I<sub>4</sub> + I<sub>5</sub>) &times; (1 - R<sub>1</sub>) &times; (1 - R<sub>2</sub> - R<sub>3</sub>) &times; (1 - R<sub>4</sub>) &times; (1 - R<sub>5</sub>) &times; (1 - R<sub>6</sub>) &times; (1 - R<sub>7</sub>) &times; (1 - R<sub>8</sub>) &times; (1 - R<sub>9</sub>{{wh}})}}
 
Primary determinant for the final damage is the base damage (DMG<sub>b</sub>), which is affected by the number of attacking creatures and their damage range. All other variables are basically modifiers of the base damage. Variables are denoted as I if they (i)ncrease damage and as R if they (r)educe it. I<sub>1</sub> and R<sub>1</sub> are mutually exclusive, but all other variables may simultaneously affect the final damage (DMG<sub>f</sub>). A brief summary of the variables have been given in the table on the right. To summarize the above formula, the content in the first parentheses increase the base damage by multiplying it with a modifier varying from 1.00 to 8.00, and the content in the second parentheses reduces the damage with a modifier varying from ~0.01 to 1.00.
 
=== Offense variables ===
==== Base damage – variable DMG<sub>b</sub> ====
 
Damage range for a single unit type is displayed in its stats. Base damage for a stack of creatures is calculated as such:


Primary determinant for the final damage is the base damage (DMG<small>b</small>), which is affected by the number of attacking creatures and their damage range. All other variables are basically modifiers of the base damage. Variables are denoted as I if they (i)ncrease damage and as R if they (r)educe it. I<small>1</small> and R<small>1</small> are mutually exclusive, but all other variables may simultaneously affect the final damage (DMG<small>f</small>). A brief summary of the variables have been given in the table on the right. To summarize the above formula, the content in the first parentheses increase the base damage by multiplying it with a modifier varying from 1.00 to 8.00, and the content in the second parentheses reduces the damage with a modifier varying from ~0.01 to 1.00.
* If there are less than or equal to 10 creatures in a stack then a random integer is chosen in a damage range for each creature, and they are added up.
* If there are more than 10 creatures in a stack, 10 random integers are chosen in a damage range of the creature  and added up. The  result  is  multiplied  by  N/10, where N is  the number  of creatures in the stack, and rounded down.


=== Attack-Defense difference – variables I<sub>1</sub> and R<sub>1</sub> ===
==== Attack-Defense difference – variables I<sub>1</sub> and R<sub>1</sub> ====
The Attack-Defense difference (ADD), denoted by I<small>1</small> and R<small>1</small> in the formula, is typically the main modifier of the base damage. It is calculated as the difference between the attacker's attack value and the defender's defense value. These are determined by adding up the attack skill of the attacking hero and of the attacking creature type, and by adding up defense skill of the defending hero and defending creature type. Spells and creature abilities that affect attack or defense values, such as [[Bloodlust]] or [disease]], are also taken into account in this part of the formula, as are any bonuses from [[native terrain]] or hero's [[Hero_specialty#Creature_specialties|creature specialties]].
The Attack-Defense difference (ADD), denoted by I<small>1</small> and R<small>1</small> in the formula, is typically the main modifier of the base damage. It is calculated as the difference between the attacker's attack value and the defender's defense value. These are determined by adding up the attack skill of the attacking hero and of the attacking creature type, and by adding up defense skill of the defending hero and defending creature type. Spells and creature abilities that affect attack or defense values, such as [[Bloodlust]] or [[disease]], are also taken into account in this part of the formula, as are any bonuses from [[native terrain]] or hero's [[Hero_specialty#Creature_specialties|creature specialties]].


If the attacking creature's total attack value is higher than the defending creature's total defense value (i.e., the difference is positive), then the attacking creature receives a 5% bonus to its base damage for every point the attack value is higher. If the difference is negative, then the attacking creature receives a 2.5% penalty to its total damage for every point the attack value is lower. A positive ADD therefore increases damage, meaning that the variable I<small>1</small> in the formula is positive whereas R<sub>1</sub> is 0. Conversely, a negative ADD decreases damage, meaning that R<small>1</small> is positive whereas I<small>1</small> is 0. An Attack-Defense difference of 0 does not modify base damage.
If the attacking creature's total attack value is higher than the defending creature's total defense value (i.e., the difference is positive), then the attacking creature receives a 5% bonus to its base damage for every point the attack value is higher. If the difference is negative, then the attacking creature receives a 2.5% penalty to its total damage for every point the attack value is lower. A positive ADD therefore increases damage, meaning that the variable I<small>1</small> in the formula is positive whereas R<sub>1</sub> is 0. Conversely, a negative ADD decreases damage, meaning that R<small>1</small> is positive whereas I<small>1</small> is 0. An Attack-Defense difference of 0 does not modify base damage.


The ADD can modify base damage only within 1.00...3.00 if ADD is postivie, and within 0.70...1.00 if ADD is negative. These limits are reached by a positive ADD of +60 and a negative ADD of -28. This means that a high attack skill can grant no more than +300% bonus damage, whereas a high defense skill can grant no more than a -70% penalty. Thus, the Attack-Defense difference can modify a base damage of 100 to no more than 400, and to no less than 30.
The ADD can modify base damage only up to +300% (400% damage dealt) if ADD is positive, and up to -70% (30% damage dealt) if ADD is negative. These limits are reached by a positive ADD of +60 and a negative ADD of -28. This means that a high attack skill can grant no more than +300% bonus damage, whereas a high defense skill can grant no more than a -70% penalty. Thus, the Attack-Defense difference can modify a base damage of 100 to no more than 400, and to no less than 30.


=== Secondary skill factors – variables I<sub>2</sub> and I<sub>3</sub> ===
==== Secondary skill factors – variables I<sub>2</sub> and I<sub>3</sub> ====
Variable I<small>2</small> represents [[secondary skill]] modifier of either [[Archery]] or [[Offense]] depending on the attack type. Creatures able to [[Ranged attack|attack from the distance]] gain bonus from the Archery secondary skill when using their ability, and if a creature engages into [[melee]] combat, it gains bonus to its damage from Offense secondary skill. For ranged attacks, Archery secondary skill may give 0, 0.10, 0.25 or 0.50 for I<small>2</small> depending on what level the skill is (if any). Similarly, Offense may give 0, 0.10, 0.20 or 0.30 to melee attacks. Because creatures cannot peform ranged and melee attacks at the same time, Archery and Offense modifiers cannot affect damage simultaneously.
Variable I<sub>2</sub> represents [[secondary skill]] modifier of either [[Archery]] or [[Offense]] depending on the attack type. Creatures able to [[Ranged attack|attack from the distance]] gain bonus from the Archery secondary skill when using their ability, and if a creature engages into [[melee]] combat, it gains bonus to its damage from Offense secondary skill. For ranged attacks, Archery secondary skill may give 0, 0.10, 0.25 or 0.50 for I<sub>2</sub> depending on what level the skill is (if any). Similarly, Offense may give 0, 0.10, 0.20 or 0.30 to melee attacks. Because creatures cannot peform ranged and melee attacks at the same time, Archery and Offense modifiers cannot affect damage simultaneously.


Variable R<small>3</small> is related to Archery and Offense modifiers through heroes who specilize in these skills. There are three heroes specializing in Archery or Offense; Orrin specializes in Archery, while Gundula and Crag Hack specialize Offense. They receive additional bonus from Archery or Offense secondary skill, as calculated with the following formula:
Variable I<sub>3</sub> is related to Archery and Offense modifiers through heroes who specilize in these skills. There are three heroes specializing in Archery or Offense; Orrin specializes in Archery, while Gundula and Crag Hack specialize Offense (also Corkes in HotA). They receive additional bonus from Archery or Offense secondary skill, as calculated with the following formula:


<big><code>I<sub>3</sub> = 0.05 &times; hero level &times; I<sub>2</sub></code></big>
<big><code>I<sub>3</sub> = 0.05 &times; hero level &times; I<sub>2</sub></code></big>


As can be seen from the formula, the specialty bonus requires that the hero has the appropriate secondary skill, otherwise I<sub>2</sub> becomes 0, which leads I<sub>3</sub></code> to become 0 as well. In other words, Orrin does not receive his specialty bonus if he does not have Archery secondary skill; same applies to Gundula and Crag Hack with Offense. By default these heroes start with the skill they specialize in, but in custom maps the map-maker may change the starting skills.
As can be seen from the formula, the specialty bonus requires that the hero has the appropriate secondary skill, otherwise I<sub>2</sub> becomes 0, which leads I<sub>3</sub> to become 0 as well. In other words, Orrin does not receive his specialty bonus if he does not have Archery secondary skill; same applies to Gundula and Crag Hack with Offense (also Corkes in HotA). By default these heroes start with the skill they specialize in, but in custom maps the map-maker may change the starting skills.


A special case of the variable I<small>3</small> is [[Adela]] and her [[Bless]] specialty. Adela's Bless maximizes base damage as usual, but also deals extra damage according to the following formula:
A special case of the variable I<sub>3</sub> is [[Adela]] and her [[Bless]] specialty. Adela's Bless maximizes base damage as usual, but also deals extra damage according to the following formula:


<big><code>I<sub>3</sub> = 0.03 &times; hero level &divide; creature level</code></big>
<big><code>I<sub>3</sub> = 0.03 &times; hero level &divide; creature level</code></big>
Line 88: Line 101:


==== Luck as combat modifier – variable I<sub>4</sub> ====
==== Luck as combat modifier – variable I<sub>4</sub> ====
The [[luck]] variable may be either 0 or 1.00, depending on whether or not the attacking creatures gets "a lucky strike". This is determined by the combat variable luck, which may be 0 (neutral), +1 (positive), +2 (good) or +3 (excellent). These values determine how often lucky strikes occur. These probabilities are, respectively, 0/24 (0%), 1/24 (4.17%), 1/12 (8.33%) and 1/8 (12.5%). Luck may be affected by artifacts, adventure map locations, spells and the [[Luck (secondary skill)|Luck]] secondary skill.
The [[luck]] variable may be either 0 or 1.00, depending on whether or not the attacking creatures gets "a lucky strike". This is determined by the combat variable luck, which may be 0 (neutral), +1 (positive), +2 (good) or +3 (excellent). These values determine how often lucky strikes occur. These probabilities are, respectively, 0/24 (0%), 1/24 (4.17%), 1/12 (8.33%) and 1/8 (12.5%). Luck may be affected by artifacts, creature special abilities, adventure map locations, spells and the [[Luck (secondary skill)|Luck]] secondary skill.


==== Creature abilities – variable I<sub>5</sub> ====
==== Creature abilities – variable I<sub>5</sub> ====
The final variable capable of increasing total damage is I<small>5</small>, which denotes creature specialties from [[Cavalier and Champion|Cavaliers and Champions]], [[Dread Knight]]s, [[Ballista]]s, [[elemental]]s, and creatures that [[hate]] each other. Dread Knights may strike [[Death Blow]] attacks, which gives variable I<small>5</small> a value of 1.00, effectively doubling base damage (though not necessarily total damage). The I<small>5</small> variable is also 1.00 for a Ballista whose shots deal double (base) damage. Additionally, there are a few creatures who [[hate]] each other, which gives I<small>5</small> a value of 0.50 when they attack each other. This is true for [[Angel]]s and [[Devil]]s, [[Titan]]s and [[Black Dragon]]s, and [[Genie]]s and [[Efreet]]i. Although [[Fire Elemental]]s and [[Water Elemental]]s, as well as [[Air Elemental]]s and [[Earth Elemental]]s do not hate each other, they also do double base damage against each other (i.e., I<small>5</small> = 1.00). Finally, the jousting specialty of Cavaliers and Champions lets them deal 5% extra damage for every hex they travel during the combat turn in which they attack their target:
The final variable capable of increasing total damage is I<sub>5</sub>, which denotes creature specialties from [[Cavalier and Champion|Cavaliers and Champions]], [[Dread Knight]]s, [[Ballista]]s, [[Cannon]]s{{-wh}}, [[elemental]]s, and creatures that [[hate]] each other. Dread Knights may deliver [[Death Blow]]s, which gives variable I<sub>5</sub> a value of 1.00, effectively doubling base damage (though not necessarily total damage). The I<sub>5</sub> variable is also 1.00 for a ballista or cannon{{-wh}} whose shots deal double (base) damage, and 2.00 for cannon's triple damage. Additionally, there are a few creatures who [[hate]] each other, which gives I<sub>5</sub> a value of 0.50 when they attack each other. This is true for [[Angel]]s and [[Devil]]s, [[Titan]]s and [[Black Dragon]]s, and [[Genie]]s and [[Efreet]]i. Although [[Fire Elemental]]s and [[Water Elemental]]s, as well as [[Air Elemental]]s and [[Earth Elemental]]s do not hate each other, they also do double base damage against each other (i.e., I<sub>5</sub> = 1.00). Finally, unless they are attacking [[Pikeman and Halberdier| pikemen or halberdiers]], the jousting specialty of Cavaliers and Champions lets them deal 5% extra damage for every hex they travel during the combat turn in which they attack their target:


<big><code>I<sub>5</sub> = 0.05 &times; squares travelled</code></big>
<big><code>I<sub>5</sub> = 0.05 &times; squares travelled</code></big>


=== Defense variables ===
=== Defense only variables ===
==== Secondary skill factors – variables R<sub>1</sub> and R<sub>2</sub>====
==== Secondary skill factors – variables R<sub>2</sub> and R<sub>3</sub>====
Similarly to the variables I<small>2</small> and I<small>3</small> variables R<small>2</small> and R<small>3</small> denote how [[Armorer]] and specializing in the skill affects the value of final damage. The reduction due to Armorer is not dependable on the attack type, but is the same for both ranged and melee damage. R<small>2</small> can receive values 0, 0.05, 0.10 or 0.15, respectively indicating that a hero does not posses the skill, has it on basic, advanced or expert level. The three heroes with an Armorer specialty - [[Mephala]], [[Neela]] and [[Tazar]] - increase the effectiveness of Armorer secondary skill by 5% for every level. Thus, as can be seen from the following formula, they double the effectiveness of the Armorer skill when they reach level 20:
Similarly to the variables I<small>2</small> and I<small>3</small> variables R<small>2</small> and R<small>3</small> denote how [[Armorer]] and specializing in the skill affects the value of final damage. The reduction due to Armorer is not dependable on the attack type, but is the same for both ranged and melee damage. R<small>2</small> can receive values 0, 0.05, 0.10 or 0.15, respectively indicating that a hero does not posses the skill, has it on basic, advanced or expert level. The three heroes with an Armorer specialty - [[Mephala]], [[Neela]] and [[Tazar]] - increase the effectiveness of Armorer secondary skill by 5% for every level. Thus, as can be seen from the following formula, they double the effectiveness of the Armorer skill when they reach level 20:


<big><code>D<sub>2</sub> = 0.05 &times; hero level &times; D<sub>1</sub></code></big>
<big><code>R<sub>3</sub> = 0.05 &times; Hero level &times; R<sub>2</sub></code></big>


Armorer has two unexpected side effects. First, heroes with Armorer take extra damage from [[arrow tower]]s. The damage reduction is reversed, as if the sign within the parenthesis would be plus instead of minus. Second, damage is reduced by 1 if creatures from a hero with Armorer take an amount of damage that is exactly an integer value. Thus, if 100 [[Peasant]]s attack a stack of Peasants commanded by a hero with basic Armorer (and the ADD is 0), damage is not 100 &times; 1 &times;(1 - 0.05) = 95, but 94. If the attack had instead been performed by 99 Peasants, the damage would be 99 &times; 1 &times;(1 - 0.05) = 94.05, which is not an integer value and therefore rounded off in the usual way, that is, to 94.
Armorer has two unexpected side effects. First, heroes with Armorer take extra damage from [[arrow tower]]s. The damage reduction is reversed, as if the sign within the parenthesis would be plus instead of minus. Second, damage is reduced by 1 if creatures from a hero with Armorer take an amount of damage that is exactly an integer value. Thus, if 100 [[Peasant]]s attack a stack of Peasants commanded by a hero with basic Armorer (and the ADD is 0), damage is not 100 &times; 1 &times;(1 - 0.05) = 95, but 94. If the attack had instead been performed by 99 Peasants, the damage would be 99 &times; 1 &times;(1 - 0.05) = 94.05, which is not an integer value and therefore rounded off in the usual way, that is, to 94.


==== Spells - Variable R<sub>4</sub> ====
==== Magic shields - variable R<sub>4</sub> ====
There are many spells that modify damage, but most do so by increasing or decreasing the attack and defense skills of allied or enemy troops. [[Stone Skin]], for example, increases an allied unit's defense skill, and therefore modifies damage by affecting variable R<sub>1</sub>. The only spells that modify damage directly are [[Shield]], [[Air Shield]], and [[Forgetfulness]]. Shield reduces all [[melee]] damage done to the hero's troops by 15% (R<small>4</small> = 0.15), or even by 30% when cast with advanced or expert proficiency. [[Air shield]] reduces all [[ranged attack|ranged]] damage done to the hero's troops by 25% (R<small>4</small> = 0.25), or even by 50% when cast with advanced or expert proficiency. Similarly to Armorer and arrow towers, also Air Shield actually increases the damage from arrow towers instead if decreasing it.
There are many spells that modify damage, but most do so by increasing or decreasing the attack and defense skills of allied or enemy troops. [[Stone Skin]], for example, increases an allied unit's defense skill, and therefore modifies damage by affecting variable R<sub>1</sub>. The only spells that modify damage directly are [[Shield]], [[Air Shield]], and [[Forgetfulness]]. Shield reduces all [[melee]] damage done to the hero's troops by 15% (R<small>4</small> = 0.15), or even by 30% when cast with advanced or expert proficiency. [[Air shield]] reduces all [[ranged attack|ranged]] damage done to the hero's troops by 25% (R<small>4</small> = 0.25), or by 50% when cast with advanced or expert proficiency. Similarly to Armorer and arrow towers, also Air Shield actually increases the damage from arrow towers instead of decreasing it.
 
==== Range and Melee penalty - variable R<sub>5</sub> ====
[[Ranged attack|Ranged units]] do only 50% damage (R<small>5</small> = 0.50) to targets that are situated at a distance of ten or more [[hex]]es on the combat field. This range penalty is negated by [[Sharpshooter]]s and by heroes carrying the [[Golden Bow]] or [[Bow of the Sharpshooter]]. When a target occupies two hexes, it is possible for a range penalty to apply to the second hex, but not to the first hex the creature is standing on.
 
When a hex adjacent to a ranged unit is occupied by an enemy unit, the ranged unit is unable to shoot (i.e., blocked). It has to resort to melee attacks. This typically reduces its damage by 50% (R<small>5</small> = 0.50). However, [[Beholder]]s, [[Evil Eye]]s, [[Medusa]]s, [[Medusa Queen]]s, [[Mage|Magi]], [[Arch Mage|Arch Magi]], [[Zealot]]s, [[Enchanter]]s and [[Titan]]s are the only ranged units that do not suffer from this [[melee penalty]].
 
==== Obstacle Penalty - variable R<sub>6</sub> ====
[[Ranged attack|Ranged units]] that during a siege attack a target behind the wall receive an [[obstacle penalty]] if the wall protecing the target is not destroyed. As a result, their damage is reduced by 50% (R<small>6</small> = 0.50). This damage is halved once again if a range penalty applies. The obstacle penalty is negated by [[Mage|Magi]], [[Arch Mage|Arch Magi]], [[Enchanter]]s and [[Sharpshooter]]s, and by heroes carrying the [[Golden Bow]] or [[Bow of the Sharpshooter]].
 
==== Mind spells - variable R<sub>7</sub> ====
The spell [[Blind]] is deactivated when a blinded creature stack is attacked. Any retaliation against this attack will not be at full strength. It will be at only 50% strength (R<small>7</small> = 0.50) when Blind is cast with basic or no proficiency, and at 25% (R<small>7</small> = 0.25) when cast with advanced proficiency. An attack that deactivates expert Blind cannot be retaliated against, but the targeted creature stack does retain its ability to retaliate against another attack in that same combat round. [[Unicorn]]s and [[War Unicorn]]s cast Blind with basic proficiency, unless the battle takes place on [[Magic Plains]].
 
Additionally, when [[Forgetfulness]] cast with basic or no proficiency, it causes half of an enemy creature stack to forget to use its ranged attack, effectively halving its ranged damage (R<small>7</small> = 0.50). Due to a bug, shooter's melee attack damage, affected by Forgetfulness, is also decreased by half (R<small>7</small> = 0.50) (fixed in {{hota}}{{-wh}}).
 
==== Creature Specialties - variable R<sub>8</sub> ====
 
Damage may also be reduced by some special abilities from creatures:
 
* [[Psychic Elemental]]s deal half damage (R<small>8</small> = 0.50) against creatures that are immune to [[Mind spell]]s, such as [[Giant]]s and [[Undead]]. This is not affected by the [[Orb of Vulnerability]].
* [[Magic Elemental]]s deal half damage (R<small>8</small> = 0.50) against [[Magic Elemental]]s and [[Black Dragon]]s. This is not affected by the [[Orb of Vulnerability]], [[Anti-Magic]], or [[Magic Resistance]].
* Creatures that are petrified by a [[Basilisk]]'s [[Petrifying attack]] or a [[Medusa]]'s [[Stone gaze]] take 50% damage (R<small>8</small> = 0.50) from [[ranged attack|ranged]] and [[melee]] attacks. Taking damage also deactivates the effect.
* Creatures that are paralyzed by a [[Scorpicore]]'s [[Paralyzing Venom]] retaliate at only 25% of their full strength against the attack that deactivates the effect.
 
A special case of damage calculation concerns the spell and creature ability [[Fire Shield]]. [[Efreet Sultan]]s and any creatures that have Fire Shield cast on them counter-inflict damage from [[melee]] attacks. This is calculated as follows:


[[Forgetfulness]], when cast with basic or no proficiency, causes half of an enemy creature stack to forget to use its ranged attack, effectively halving its ranged damage (R<sub>4</sub> = 0.50).
<big><code>Fire Shield damage =  FS &times; DMG<sub>b</sub> &times; (1 + I<sub>1</sub> + I<sub>2</sub> + I<sub>3</sub> + I<sub>4</sub> + I<sub>5</sub>)</code></big>


====Range and Melee penalty - variable R<sub>5</sub>====
FS is a percentage that equals 0.20 for Efreet Sultans and (basic) Fire Shield, 0.25 for advanced Fire Shield, and 0.30 for expert Fire Shield.


[[Ranged attack|Ranged units]] do only 50% damage (R<sub>5</sub> = .50) to targets that are situated at a distance of ten or more [[hex]]es on the combat field. This range penalty is negated by [[Sharpshooter]]s and by heroes carrying the [[Golden Bow]] or [[Bow of the Sharpshooter]]. When a target occupies two hexes, it is possible for a range penalty to apply to the second hex, but not to the first hex the creature is standing on.
==== Unluck as combat modifier - variable R<sub>9</sub> ====
[[Horn of the Abyss]] {{wh}} introduced negative effects of [[luck]]. R<sub>9</sub> variable may be either 0 or 0.50, depending on whether or not the attacking creatures gets "an unlucky strike". This is determined by combat variable luck, which may range from -3 to 3. Negative values can trigger unlucky strike to occur. The probability of such a strike is 1/12 (8.33%) if luck variable is -1, 1/6 (16.7%) for luck equal to -2, and 1/4 (25%) for luck equal to -3. Luck variable may be affected by artifacts, creature special abilities, adventure map locations, spells and the [[Luck (secondary skill)|Luck]] secondary skill.


When a hex adjacent to a ranged unit is occupied by an enemy unit, the ranged unit is  unable to shoot (i.e., blocked). It has to resort to [[melee]] attacks. This typically reduces its damage by 50% (R<sub>5</sub> = .50). [[Beholder]]s, [[Evil Eye]]s, [[Medusa]]s, [[Medusa Queen]]s, [[Mage|Magi]], [[Arch Mage|Arch Magi]], [[Zealot]]s, [[Enchanter]]s and [[Titan]]s are the only ranged units that do not suffer from this [[melee penalty]].
== Example ==
On [[lava]] terrain, one hundred [[Archangel]]s that benefit from basic [[Bless]] cast by a level 14 [[Adela]] with expert [[Offense]] and an Attack Skill of 8 deliver a [[luck]]y strike against a stack of [[Petrify|petrified]] [[Arch Devil]]s that adopted a defensive stance right after a level 20 [[Tazar]] with advanced [[Armorer]] and 14 Defense casted expert [[Shield]] and expert [[Stone Skin]] at the beginning of the present combat round. How much damage do the Archangels inflict?


====Obstacle Penalty - variable R<sub>6</sub>====
First, base damage (DMG<sub>b</sub>) is calculated. Because Bless has been cast with basic (rather than advanced or expert) proficiency and Archangels always deal a fixed amount of damage, base damage is equal to 100 &times; 50 = 5000.
This base damage is modified by several I and R variables. Let’s calculate I<sub>1</sub> and R<sub>1</sub> first. The Archangels have a base Attack Skill of 30, to which +8 Attack from Adela is added, for a total of 38. The Arch Devils have a base Defense Skill of 28, to which +14 Defense from Tazar is added, +6 due to Stone Skin and +1 due to [[Native Terrain]], for a total of 49. Because the Arch Devils adopted a defensive stance only after Stone Skin was cast, they receive a 20% Defense bonus over a Defense Skill of 49 (rather than 43), meaning their defense is 1.2 &times; 49 = 58.8, which is rounded down to 58. This is 58 - 38 points higher than the Attack Skill of the Archangels, meaning that I<sub>1</sub> = 0 and R<sub>1</sub> = 20 &times; 0.025 = 0.5.


[[Ranged attack|Ranged units]] that during a siege attack a target behind a wall receive an [[obstacle penalty]] if the wall protecing the target is not destroyed. As a result, their damage is reduced by 50% (R<sub>6</sub> = .50). This damage is halved once again if a range penalty applies. The obstacle penalty is negated by [[Arch Mage|Arch Magi]] and [[Sharpshooter]]s, and by heroes carrying the [[Golden Bow]] or [[Bow of the Sharpshooter]].
Because Adela has learned expert Offense, I<sub>2</sub> = 0.30.


==== Blind - variable R<sub>7</sub> ====
Adela’s Bless specialty at Hero level 14 means that I<sub>3</sub> = 0.03 &times; 14 / 7 = 0.06.


The spell [[Blind]] is deactivated when a blinded creature stack is attacked. Any retaliation against this attack will not be at full strength. It will be at only 50% strength (R<sub>7</sub> = 0.50) when Blind is cast with basic or no proficiency, and at 25% (R<sub>7</sub> = 0.25) when cast with advanced proficiency. An attack that deactivates expert Blind cannot be retaliated against, but the targeted creature stack does retain its ability to retaliate against another attack in that same combat round. [[Unicorn]]s and [[War Unicorn]]s cast Blind with basic proficiency, unless the battle takes place on [[Magic Plains]].
Because the Archangels deliver a lucky strike, I<sub>4</sub> = 1.00


==== Creature Specialties - variables R<sub>8</sub> ====
Archangels hate Arch Devils, so I<sub>5</sub> = 0.50.
     
Because Tazar has learned advanced Armorer, R<sub>2</sub> = 0.10.
Tazar’s Armorer specialty at Hero level 20 means that R<sub>3</sub> = 0.05 &times; 20 &times; 0.10 = 0.10.


* Creatures
Tazar has cast expert Shield, meaning that R<sub>4</sub> = 0.30.
** Attacker is Psychic Elemental, defender is immune to Mind spells
** Attacker is Magic Elemental, defender is Magic Elemental or the Black Dragon
** Petrified
** Paralyzed


== Examples ==
Because the Arch Devils are petrified, R<sub>5</sub> = 0.50
''No heroes are assumed to be present in the battle.''


*'''2''' [[Naga]]s attack a stack of [[Pikeman|Pikemen]].
Substituting these values in the damage formula above shows that total damage is equal to 100 &times; 50 &times; (1 + 0.30 + 0.06 + 1.00 + 0.50) &times; (1 - 0.50) &times; (1 - 0.10 - 0.10) &times; (1 - 0.30) &times; (1 - 0.50) = 2002.
*The [[Naga]]s have a single unit damage value of '''20''' and their Attack skill is '''16'''.  
*A [[Pikeman]] has '''10''' [[health]] and their Defense skill is '''5'''.
*The base stack damage done by the stack of [[Naga]]s is '''2 * 20 = 40'''.  
*The [[Pikeman|Pikemen]]'s Defense skill ('''5''') is subtracted from the [[Naga]]s' Attack skill ('''16'''), which gives us '''11''', giving the [[naga]]s an att/def damage bonus.
*The dealt damage will after the att/def consideration thusly have the bonus percentage modificator of '''5%''', multiplied with the damage bonus number in this case, '''11''', resulting in '''55%''' bonus percentage of the [[Naga]]s damage towards the [[Pikeman|Pikemen]].
*So the damage is increased by a '''55%''' increase and the [[naga]]s through superior attack skill have '''155% damage''' on the [[Pikeman|Pikemen]] stack.
*The total damage thus is '''40 * 1.55 = 62''' damage points.
*'''6''' [[Pikeman|Pikemen]] will be killed, and the top [[Pikeman|Pikemen]] of the remaining stack will have '''8''' health left.


When the remaining (if any) '''[[Pikeman|Pikemen]]''' (attack points of 4) '''attack''' the '''[[naga]]s''' (sporting 13 points of defense):
However, because this damage is exactly 2002 (i.e., an integer value) and Tazar has learned Armorer, damage is reduced by one additional damage point, for a total of 2001.
*-22.5% damage would be dealt by the [[Pikeman|Pikemen]] to the 5 creature level higher [[naga]] chimera stack.
*The '''difference''' between the [[Pikeman|Pikemen]] attack ('''4''') and the [[naga]]s defense ('''13''') would mean '''9 malus points''' with a malus point resulting in 2.5 % each malus point (the half of the bonus points).
* ((2.5)*-9)% is -22.5% damage the [[Pikeman|Pikemen]] can damage the [[naga]]s with.


== External Links ==
Thread at [http://heroescommunity.com HeroesCommunity], started by Ecoris: [http://heroescommunity.com/viewthread.php3?TID=20955 Base damage calculation]<br>
Thread at [http://heroescommunity.com HeroesCommunity], started by Angelito: [http://heroescommunity.com/viewthread.php3?TID=11801 How do the Offense and Armorer skills work exactly?] <br>
Thread at [http://heroescommunity.com HeroesCommunity], started by Ecoris: [http://heroescommunity.com/viewthread.php3?TID=21273 Rules for (Creature) Spells and Orbs] <br>
[http://homm3.plazacraft.com/damagesymulator HOMM3 Damage Simulator] is an implementation of the damage calculation based on this article.<br>
[http://heroes3wog.net/download/%5BManual%5D%20Tribute%20to%20Strategists.pdf Tribute to Strategists]<br>
[[Category: Combat]]
[[Category: Combat]]
[[Category: Terms]]
[[Category: Terms]]

Revision as of 19:59, 24 April 2024

Damage is a general term for the amount of health loss a creature or a spell can cause to a single creature or to a creatures stack. If a creature suffers more damage than its current health, it is eliminated, while in a stack of creatures, the topmost dies. The remainder of the damage is dealt to the next one and so forth until all damage is dealt or the whole stack is eliminated.

Creature's ability to deal damage typically has a range, which means that it causes randomly chosen damage between the minimum and maximum value. Some creatures like Nagas do not have a damage range, meaning they deal a fixed amount of damage. This is also true for creatures that are blessed or cursed. Creatures in a stack cause individual damages, and the combined damage of the stack is calculated by adding them together (see External Links below). However, the final damage can deviate from the combined damage greatly because of different additions and reductions, which are covered in the next section.

Spells can deal damage much like creatures do, except that the amount of inflicted damage does not vary within a range but is fixed. The exact amount of unmodified spell damage can always be calculated with a linear formula. For example, basic Lightning Bolt cast by a hero with 7 spell power does 7 × 25 + 10 = 185 damage. For other spells different values than 25 and 10 need to be substituted. The eventual amount of spell damage is modified as follows:

  • The Sorcery secondary skill increases spell damage.
  • Some Heroes increase spell damage by 3% per hero level when casting the spell they specialize in.
  • Other Heroes increase spell damage of the spell they specialize in by a percentage which never changes.
  • Elementals take double damage from certain spells. Fire Elementals, for example, are vulnerable to Ice Bolt.
  • The damage that Stone Golems, Iron Golems, Gold Golems and Diamond Golems take from spells is reduced by, respectively, 50%, 75%, 85% and 95%.
  • The spells Protection from Air, Earth, Fire and Water reduce spell damage from the school they protect against by 30%, or even by 50% when cast at basic or advanced/expert level.

Moreover, magic resistance ability, Resistance secondary skill and resistance artifacts such as the Boots of Polarity give a chance to completely avoid spell damage. Some creatures are naturally immune to some damage spells, or even to all spells. Finally, there are some artifacts which make your units immune to a certain damage spell, or disallow casting certain spells to both sides. Orb of Inhibition and Anti-Magic Garrison ban all spells with no exceptions.

Damage calculation of creature stacks

The damage calculation formula

Table 1: Damage calculation variables
 Description 
 DMGb = Base damage
 I1   = 0.05 × (Attack - Defense) (if A ≥ D)
 I2   = 0.10, 0.25, 0.50 for basic, advanced, expert Archery

        = 0.10, 0.20, 0.30 for basic, advanced, expert Offense 

 I3   = 0.05 × I2 × hero level for Archery/Offense specialty

     = 0.03 × (hero ÷ creature level) for Adela's bless

 I4   = 1.00 for lucky strikes
 I5   = 2.00 for Cannon Horn of the Abyss triple damage

     = 1.00 for Death Blow, Ballista or cannon Horn of the Abyss double damage
     = 1.00 if Elemental attacks opposite Elemental type
     = 0.50 for hate
     = 0.05 × hexes travelled for Cavaliers, Champions

 R1 = 0.025 × (Defense - Attack) (if D ≥ A)
 R2 = 0.05, 0.10, 0.15 for basic, advanced, expert Armorer
 R3 = 0.05 × R2 × hero level for Armorer specialty
 R4 = 0.15, 0.30 for basic, advanced/expert level Shield

   = 0.25, 0.50 for basic, advanced/expert level Air Shield

 R5 = 0.50 if attacker has range or melee penalty 
 R6 = 0.50 if target is behind a wall (obstacle penalty
 R7 = 0.50 for retaliation after being Blinded

   = 0.75 for retaliation after advanced Blind
   = 0.50 for shooter with basic Forgetfulness
   = 0.50 for shooter's melee attack with Forgetfulness

 R8 = 0.50 for Psychic Elemental vs. mind spell immunity

   = 0.50 for Magic Elemental vs. lvl 1-5 spell immunity
   = 0.50 if target is petrified
   = 0.75 for retaliation after being paralyzed

 R9 = 0.50 for unlucky Horn of the Abyss strikes

Mathematical formula for calculating the final damage (DMGf) is:

DMGf = DMGb × (1 + I1 + I2 + I3 + I4 + I5) × (1 - R1) × (1 - R2 - R3) × (1 - R4) × (1 - R5) × (1 - R6) × (1 - R7) × (1 - R8) × (1 - R9Horn of the Abyss)

Primary determinant for the final damage is the base damage (DMGb), which is affected by the number of attacking creatures and their damage range. All other variables are basically modifiers of the base damage. Variables are denoted as I if they (i)ncrease damage and as R if they (r)educe it. I1 and R1 are mutually exclusive, but all other variables may simultaneously affect the final damage (DMGf). A brief summary of the variables have been given in the table on the right. To summarize the above formula, the content in the first parentheses increase the base damage by multiplying it with a modifier varying from 1.00 to 8.00, and the content in the second parentheses reduces the damage with a modifier varying from ~0.01 to 1.00.

Offense variables

Base damage – variable DMGb

Damage range for a single unit type is displayed in its stats. Base damage for a stack of creatures is calculated as such:

  • If there are less than or equal to 10 creatures in a stack then a random integer is chosen in a damage range for each creature, and they are added up.
  • If there are more than 10 creatures in a stack, 10 random integers are chosen in a damage range of the creature and added up. The result is multiplied by N/10, where N is the number of creatures in the stack, and rounded down.

Attack-Defense difference – variables I1 and R1

The Attack-Defense difference (ADD), denoted by I1 and R1 in the formula, is typically the main modifier of the base damage. It is calculated as the difference between the attacker's attack value and the defender's defense value. These are determined by adding up the attack skill of the attacking hero and of the attacking creature type, and by adding up defense skill of the defending hero and defending creature type. Spells and creature abilities that affect attack or defense values, such as Bloodlust or disease, are also taken into account in this part of the formula, as are any bonuses from native terrain or hero's creature specialties.

If the attacking creature's total attack value is higher than the defending creature's total defense value (i.e., the difference is positive), then the attacking creature receives a 5% bonus to its base damage for every point the attack value is higher. If the difference is negative, then the attacking creature receives a 2.5% penalty to its total damage for every point the attack value is lower. A positive ADD therefore increases damage, meaning that the variable I1 in the formula is positive whereas R1 is 0. Conversely, a negative ADD decreases damage, meaning that R1 is positive whereas I1 is 0. An Attack-Defense difference of 0 does not modify base damage.

The ADD can modify base damage only up to +300% (400% damage dealt) if ADD is positive, and up to -70% (30% damage dealt) if ADD is negative. These limits are reached by a positive ADD of +60 and a negative ADD of -28. This means that a high attack skill can grant no more than +300% bonus damage, whereas a high defense skill can grant no more than a -70% penalty. Thus, the Attack-Defense difference can modify a base damage of 100 to no more than 400, and to no less than 30.

Secondary skill factors – variables I2 and I3

Variable I2 represents secondary skill modifier of either Archery or Offense depending on the attack type. Creatures able to attack from the distance gain bonus from the Archery secondary skill when using their ability, and if a creature engages into melee combat, it gains bonus to its damage from Offense secondary skill. For ranged attacks, Archery secondary skill may give 0, 0.10, 0.25 or 0.50 for I2 depending on what level the skill is (if any). Similarly, Offense may give 0, 0.10, 0.20 or 0.30 to melee attacks. Because creatures cannot peform ranged and melee attacks at the same time, Archery and Offense modifiers cannot affect damage simultaneously.

Variable I3 is related to Archery and Offense modifiers through heroes who specilize in these skills. There are three heroes specializing in Archery or Offense; Orrin specializes in Archery, while Gundula and Crag Hack specialize Offense (also Corkes in HotA). They receive additional bonus from Archery or Offense secondary skill, as calculated with the following formula:

I3 = 0.05 × hero level × I2

As can be seen from the formula, the specialty bonus requires that the hero has the appropriate secondary skill, otherwise I2 becomes 0, which leads I3 to become 0 as well. In other words, Orrin does not receive his specialty bonus if he does not have Archery secondary skill; same applies to Gundula and Crag Hack with Offense (also Corkes in HotA). By default these heroes start with the skill they specialize in, but in custom maps the map-maker may change the starting skills.

A special case of the variable I3 is Adela and her Bless specialty. Adela's Bless maximizes base damage as usual, but also deals extra damage according to the following formula:

I3 = 0.03 × hero level ÷ creature level

Because of the division, Adela's Bless bonus is greater for low-tier creatures. Her Bless grants +3% damage per her level to 1st level creatures, whereas it grants +0.6% per her level for 5th level creatures.

Luck as combat modifier – variable I4

The luck variable may be either 0 or 1.00, depending on whether or not the attacking creatures gets "a lucky strike". This is determined by the combat variable luck, which may be 0 (neutral), +1 (positive), +2 (good) or +3 (excellent). These values determine how often lucky strikes occur. These probabilities are, respectively, 0/24 (0%), 1/24 (4.17%), 1/12 (8.33%) and 1/8 (12.5%). Luck may be affected by artifacts, creature special abilities, adventure map locations, spells and the Luck secondary skill.

Creature abilities – variable I5

The final variable capable of increasing total damage is I5, which denotes creature specialties from Cavaliers and Champions, Dread Knights, Ballistas, Cannons Horn of the Abyss, elementals, and creatures that hate each other. Dread Knights may deliver Death Blows, which gives variable I5 a value of 1.00, effectively doubling base damage (though not necessarily total damage). The I5 variable is also 1.00 for a ballista or cannon Horn of the Abyss whose shots deal double (base) damage, and 2.00 for cannon's triple damage. Additionally, there are a few creatures who hate each other, which gives I5 a value of 0.50 when they attack each other. This is true for Angels and Devils, Titans and Black Dragons, and Genies and Efreeti. Although Fire Elementals and Water Elementals, as well as Air Elementals and Earth Elementals do not hate each other, they also do double base damage against each other (i.e., I5 = 1.00). Finally, unless they are attacking pikemen or halberdiers, the jousting specialty of Cavaliers and Champions lets them deal 5% extra damage for every hex they travel during the combat turn in which they attack their target:

I5 = 0.05 × squares travelled

Defense only variables

Secondary skill factors – variables R2 and R3

Similarly to the variables I2 and I3 variables R2 and R3 denote how Armorer and specializing in the skill affects the value of final damage. The reduction due to Armorer is not dependable on the attack type, but is the same for both ranged and melee damage. R2 can receive values 0, 0.05, 0.10 or 0.15, respectively indicating that a hero does not posses the skill, has it on basic, advanced or expert level. The three heroes with an Armorer specialty - Mephala, Neela and Tazar - increase the effectiveness of Armorer secondary skill by 5% for every level. Thus, as can be seen from the following formula, they double the effectiveness of the Armorer skill when they reach level 20:

R3 = 0.05 × Hero level × R2

Armorer has two unexpected side effects. First, heroes with Armorer take extra damage from arrow towers. The damage reduction is reversed, as if the sign within the parenthesis would be plus instead of minus. Second, damage is reduced by 1 if creatures from a hero with Armorer take an amount of damage that is exactly an integer value. Thus, if 100 Peasants attack a stack of Peasants commanded by a hero with basic Armorer (and the ADD is 0), damage is not 100 × 1 ×(1 - 0.05) = 95, but 94. If the attack had instead been performed by 99 Peasants, the damage would be 99 × 1 ×(1 - 0.05) = 94.05, which is not an integer value and therefore rounded off in the usual way, that is, to 94.

Magic shields - variable R4

There are many spells that modify damage, but most do so by increasing or decreasing the attack and defense skills of allied or enemy troops. Stone Skin, for example, increases an allied unit's defense skill, and therefore modifies damage by affecting variable R1. The only spells that modify damage directly are Shield, Air Shield, and Forgetfulness. Shield reduces all melee damage done to the hero's troops by 15% (R4 = 0.15), or even by 30% when cast with advanced or expert proficiency. Air shield reduces all ranged damage done to the hero's troops by 25% (R4 = 0.25), or by 50% when cast with advanced or expert proficiency. Similarly to Armorer and arrow towers, also Air Shield actually increases the damage from arrow towers instead of decreasing it.

Range and Melee penalty - variable R5

Ranged units do only 50% damage (R5 = 0.50) to targets that are situated at a distance of ten or more hexes on the combat field. This range penalty is negated by Sharpshooters and by heroes carrying the Golden Bow or Bow of the Sharpshooter. When a target occupies two hexes, it is possible for a range penalty to apply to the second hex, but not to the first hex the creature is standing on.

When a hex adjacent to a ranged unit is occupied by an enemy unit, the ranged unit is unable to shoot (i.e., blocked). It has to resort to melee attacks. This typically reduces its damage by 50% (R5 = 0.50). However, Beholders, Evil Eyes, Medusas, Medusa Queens, Magi, Arch Magi, Zealots, Enchanters and Titans are the only ranged units that do not suffer from this melee penalty.

Obstacle Penalty - variable R6

Ranged units that during a siege attack a target behind the wall receive an obstacle penalty if the wall protecing the target is not destroyed. As a result, their damage is reduced by 50% (R6 = 0.50). This damage is halved once again if a range penalty applies. The obstacle penalty is negated by Magi, Arch Magi, Enchanters and Sharpshooters, and by heroes carrying the Golden Bow or Bow of the Sharpshooter.

Mind spells - variable R7

The spell Blind is deactivated when a blinded creature stack is attacked. Any retaliation against this attack will not be at full strength. It will be at only 50% strength (R7 = 0.50) when Blind is cast with basic or no proficiency, and at 25% (R7 = 0.25) when cast with advanced proficiency. An attack that deactivates expert Blind cannot be retaliated against, but the targeted creature stack does retain its ability to retaliate against another attack in that same combat round. Unicorns and War Unicorns cast Blind with basic proficiency, unless the battle takes place on Magic Plains.

Additionally, when Forgetfulness cast with basic or no proficiency, it causes half of an enemy creature stack to forget to use its ranged attack, effectively halving its ranged damage (R7 = 0.50). Due to a bug, shooter's melee attack damage, affected by Forgetfulness, is also decreased by half (R7 = 0.50) (fixed in Horn of the Abyss Horn of the Abyss).

Creature Specialties - variable R8

Damage may also be reduced by some special abilities from creatures:

A special case of damage calculation concerns the spell and creature ability Fire Shield. Efreet Sultans and any creatures that have Fire Shield cast on them counter-inflict damage from melee attacks. This is calculated as follows:

Fire Shield damage = FS × DMGb × (1 + I1 + I2 + I3 + I4 + I5)

FS is a percentage that equals 0.20 for Efreet Sultans and (basic) Fire Shield, 0.25 for advanced Fire Shield, and 0.30 for expert Fire Shield.

Unluck as combat modifier - variable R9

Horn of the Abyss Horn of the Abyss introduced negative effects of luck. R9 variable may be either 0 or 0.50, depending on whether or not the attacking creatures gets "an unlucky strike". This is determined by combat variable luck, which may range from -3 to 3. Negative values can trigger unlucky strike to occur. The probability of such a strike is 1/12 (8.33%) if luck variable is -1, 1/6 (16.7%) for luck equal to -2, and 1/4 (25%) for luck equal to -3. Luck variable may be affected by artifacts, creature special abilities, adventure map locations, spells and the Luck secondary skill.

Example

On lava terrain, one hundred Archangels that benefit from basic Bless cast by a level 14 Adela with expert Offense and an Attack Skill of 8 deliver a lucky strike against a stack of petrified Arch Devils that adopted a defensive stance right after a level 20 Tazar with advanced Armorer and 14 Defense casted expert Shield and expert Stone Skin at the beginning of the present combat round. How much damage do the Archangels inflict?

First, base damage (DMGb) is calculated. Because Bless has been cast with basic (rather than advanced or expert) proficiency and Archangels always deal a fixed amount of damage, base damage is equal to 100 × 50 = 5000.

This base damage is modified by several I and R variables. Let’s calculate I1 and R1 first. The Archangels have a base Attack Skill of 30, to which +8 Attack from Adela is added, for a total of 38. The Arch Devils have a base Defense Skill of 28, to which +14 Defense from Tazar is added, +6 due to Stone Skin and +1 due to Native Terrain, for a total of 49. Because the Arch Devils adopted a defensive stance only after Stone Skin was cast, they receive a 20% Defense bonus over a Defense Skill of 49 (rather than 43), meaning their defense is 1.2 × 49 = 58.8, which is rounded down to 58. This is 58 - 38 points higher than the Attack Skill of the Archangels, meaning that I1 = 0 and R1 = 20 × 0.025 = 0.5.

Because Adela has learned expert Offense, I2 = 0.30.

Adela’s Bless specialty at Hero level 14 means that I3 = 0.03 × 14 / 7 = 0.06.

Because the Archangels deliver a lucky strike, I4 = 1.00

Archangels hate Arch Devils, so I5 = 0.50.

Because Tazar has learned advanced Armorer, R2 = 0.10.

Tazar’s Armorer specialty at Hero level 20 means that R3 = 0.05 × 20 × 0.10 = 0.10.

Tazar has cast expert Shield, meaning that R4 = 0.30.

Because the Arch Devils are petrified, R5 = 0.50

Substituting these values in the damage formula above shows that total damage is equal to 100 × 50 × (1 + 0.30 + 0.06 + 1.00 + 0.50) × (1 - 0.50) × (1 - 0.10 - 0.10) × (1 - 0.30) × (1 - 0.50) = 2002.

However, because this damage is exactly 2002 (i.e., an integer value) and Tazar has learned Armorer, damage is reduced by one additional damage point, for a total of 2001.

External Links

Thread at HeroesCommunity, started by Ecoris: Base damage calculation
Thread at HeroesCommunity, started by Angelito: How do the Offense and Armorer skills work exactly?
Thread at HeroesCommunity, started by Ecoris: Rules for (Creature) Spells and Orbs
HOMM3 Damage Simulator is an implementation of the damage calculation based on this article.
Tribute to Strategists