Magic Resistance

Magic resistance is an attribute that reduces magical damage the unit receives. It acts as a counter part to armor, which grants physical damage resistance. All heroes have magic resistance, while most non-hero units have none. On heroes, similarly to armor, magic resistance scales with levels, increasing by % with each point of strength the hero has. Strength heroes gain % more than agility and intelligence heroes, gaining % per strength. There are many abilities and items which can boost or reduce a unit's magical armor.

Magical damage
Magical damage is a type of damage caused mostly by abilities. Unlike physical damage, it is not affected by armor. However, it is affected by magic resistance dealing more or less damage, depending on the unit's current magic resistance. Besides magic resistance, magical damage, just like physical and pure damage, is also affected by damage manipulation.

Mechanics
Magic resistance affects magical damage exclusively. It does not matter whether it is spell damage or attack damage, as long as it is magical, it is reduced. Even if magical damage has the HP Removal flag, it is still affected by magic resistance and reduced accordingly.

Stacking
All sources of magic resistance stack diminishingly. This means a unit's magic resistance value changes less, the higher its magic resistance is, and more, the lower it is. However, this does not mean a reduction in effectiveness with multiple sources. See the next section for details.

The magic resistance gained through strength is all summed up into, and treated as one instance, which stacks diminishingly with other sourcers. This means with a theoretical strength of, a hero would have 100% magic resistance.

Formula

For total magic resistance of a unit (multiply the result by 100 to get the percentage value):

For magical damage after magic resistance:

Example:
 * with level 4 and a  has a magic resistance of:
 * 1 - (1 - ) × (1 - ) × (1 - ) = %
 * on level 25 under the effect of and a level 4  cast by an enemy has a magic resistance of:
 * 1 - (1 - ) × (1 - ( × )) × (1 + ) × (1 + ) = %

With a theoretical strength of ( for strength heroes), magic damage is fully negated. There are several abilities which grant 100% magic resistance. Because of the stacking rules, these abilities prevent a unit's magic resistance to be reduced or increased, as the formula will always result in 100%, no matter how big the magic resistance bonus or reduction.

Effective HP
Despite each source of magic resistance increasing the magic resistance value less the higher it is and making them seem less effective, each sources increases the unit's effective HP against magical damage by their base value. Effective HP means, how much damage can a unit take before dying, after reductions. In this case, magic resistance increases a unit's effective HP against magical damage. A unit with 0% magic resistance has 100% effective HP against magical damage, means magical damage equaling 100% of its health is required to kill it. Most heroes have magic resistance by default, making their effective HP against magical damage %.

Formula:

Instead of 'diminishing' in effectiveness, multiple sources of resistance are actually more effective stacked than they are individually. Two sources of 25% resistance stacked provides 78% extra EHP whereas one source provides 33%.

Example:
 * Anti-Mage has health at max level. With his basic magic resistance, max level Spell Shield and a Cloak, he has an effective HP of:
 * / (1 - × 0.01) =  effective HP
 * Visage has health at max level. With his basic magic resistance, while under the effect of Veil of Discord and an enemy level 4 Decrepify, he has an effective HP of:
 * / (1 - × 0.01) =  effective HP

Sources of 100% magic resistance
These abilities grant 100% magic resistance to the affected units, reducing every magical damage they take to 0, and ceasing the effects of magic resistance reductions.

Magical damage barrier
Magical damage barriers absorb a set amount of magical damage, no matter whether it comes from spells (magical spell damage) or attacks (magical attack damage). They absorb the damage before it is reduced by magic resistance, unless the resistance is provided by spell immunity. This means when a hero with for example 25% magic resistance and a 300 health damage barrier gets hit by 400 magical damage, the shield will absorb 300 of that. The exceeding 100 are not absorbed and are now reduced by the 25% magic resistance down to 75. So in this scenario, the hero takes 75 damage. This means a barrier is more effective the lower a unit's magic resistance is, similar to how damage block is more effective, the lower the armor is.

Multiple sources of magical damage barriers do not stack. When affected by multiple, all of them deplete at the same time. For example, if a unit is affected by a level 4 Flame Guard ( barrier health) and by Pipe of Insight ( barrier health), and then takes 300 magical damage, both shields lose 300 capacity, leaving Flame Guard with and Pipe of Insight  absorb capacity.