All objects / Mechanic / Damage calculation

Damage calculation
Mechanic · patch 2.0 «Armageddon's Blade» · current slice “Shadow of Death”
The Attack and Defense formula, bonus caps, and the difference between SoD and HotA.
Base
If a stack has 10 creatures or fewer, each one's damage is rolled separately from minimum to maximum and added up. Bless locks in the maximum, Curse the minimum.
If there are more than 10 creatures, the game rolls ten values, divides the sum by 10, multiplies by the number, and rounds down. For fixed damage this is simply number × damage.
Attack and Defense
The full Attack of the striker (hero + creature + spells) and the full Defense of the target are used. If Attack is not lower than Defense, damage grows by 5% for each point of difference, but not by more than +300% (a difference of 60).
If Defense is higher, damage falls by 2.5% per point, but by no more than 70% (a difference of 28). Attack versus Defense does not drop damage below 30% of base damage.
Offense and Archery sit in the same increasing bracket: melee +10/20/30%, shooting +10/25/50%. The specialties of Orrin, Gundula, Crag Hack, and Cork add another 5% of that bonus for each hero level.
Formula
SoD: damage = base × (1 + I1 + I2 + I3 + I4 + I5) × (1 − R1) × (1 − R2 − R3) × (1 − R4) × (1 − R5) × (1 − R6).
I1 is the Attack bonus, no more than 3. R1 is the Defense penalty, no more than 0.7. I2 is Offense or Archery. I3 is the specialty of that skill. I4 is a lucky strike in the original; it equals 1 and sits inside the bracket, and it does not multiply the result. I5 is Hates (0.5), Cavalier jousting (0.05 per hex of the path), and similar abilities.
R2 is Armorer: 0.05 / 0.10 / 0.15. R3 is the Armorer specialty, 5% of R2 per level. R4 is Shield (0.15 or 0.30) or Air Shield (0.25 or 0.50). R5 is the point-blank shooting penalty, 0.5. R6 is the wall penalty, 0.5.
In HotA Luck is taken outside: the result is additionally multiplied by 2, by 1, or by 0.5. A lucky strike in the original and a lucky strike in HotA are not the same number if the bracket already has other bonuses.
Another oddity of the original: if the hero has Armorer and the raw damage came out as a whole number, the game subtracts 1. HotA removed this behavior.