An enemy takes the damage times (100% minus its protection), rounded down. Its protection is its armor against physical damage, its magic resistance against magic damage, half its armor against explosive and electric damage, and 0% against true and poison damage.
Damage types
Cut by the target's armor.
Cut by the target's magic resistance.
Cut by half the target's armor; magic resistance does not count.
Cut by half the target's armor, like explosive damage. The Tesla x104 deals it.
Never cut: armor and magic resistance do not count. Rain of Fire deals true damage (30-60 per fireball before upgrades).
Not cut by armor or magic resistance.
How armor and magic resistance work
Armor and magic resistance are percentages and always count between 0% and 100%: a target with 100% armor takes no physical damage. Armor does nothing against magic damage and magic resistance does nothing against physical damage. Some enemies take no damage of a type at all: the Spectral Knight ignores physical, explosive and electric damage.
Units (soldiers and heroes) have the same protection, but for them the blocked part is rounded down instead of the damage taken, so a unit can lose 1 point more than an enemy would: 21 physical damage on 30% armor takes 14 health from an enemy and 15 from a unit.
Worked examples
An arrow deals 11-16 physical damage; the Dark Knight has 80% armor. A 14 roll: 14 x 20% = 2.8, rounded down to 2.
Piercing Shots makes the shots of every archer tower (Rangers Hideout and Musketeer Garrison included) count the target's armor 10 points lower: 70% instead of 80%. The 14 roll now takes 4 health.
A bolt deals 41-74 magic damage; the Shaman has 85% magic resistance. A 60 roll: 60 x 15% = 9, rounded down to 9.
A shell deals 60 explosive damage at the centre of its blast, down to 30 at the edge. The Dark Slayer's 95% armor counts half: 47.5%. A 50-damage hit takes 26 health, where 50 physical damage would take 2.
Damage rolls
Melee attacks, area ones included, and Rain of Fire roll a whole number between their lowest and highest damage. Arrows, bolts, thrown axes and spears, musket shots and the Sunray beam roll a number in between and round it up, so they never deal their lowest value: the Sharpshooter Tower's arrows, 10-16 in the game's info, deal 11-16, and this wiki gives such shots that way. Bombs and missiles with a blast do not roll: they deal their highest damage at the centre and less towards the edge. The armor cut comes after. Enemies that deal true damage: Troll Champion, Raider, Demon Legion, Abomination and Lord Blackburn.
Instant kills, shields and dodging
Instant kills
An instant kill takes all of the target's remaining health, whatever its armor. Enemies that kill your units outright: J.T., Sarelgaz, Moloch, Black Hag and Lycan.
Death effects
An enemy killed by the Arcane Wizard's Death Ray or by the Fat Boy has no death effect: it does not explode and nothing spawns from it (a Fallen Knight does not return as a Spectral Knight).
Infernal shields
A demon shielded by a Demon Lord takes no damage from the next 4 hits. Poison Arrows damage is blocked without using up a hit, and an instant kill goes through the shield.
Dodge
Bandit, Wulf, Worg, Winter Wolf and Demon Hound have a chance to dodge each melee attack; a dodged attack deals no damage. Ranged attacks always hit, and a stunned enemy does not dodge.