Magic Resistance

Magic resistance (MR) is a percentage unit stat that allows a unit to reduce damage exclusively received from Hero spells (this includes Artifact spells and Spell Marks). It however has no effect on unit skills.
Magic Immunity is a different effect, but it does make redundant any Magic Resistance the unit might possess. 
=Calculation=
Notation:
* DMG Inflicted = Final spell damage received by the unit after all the calculations
* DMG Total = Spell damage attempted on the unit after taking into account all effects, but before applying magic resistance.
* SB = Final Spell Bonus of the hero casting the spell. It can be found in the hero's profile (at least 100%).
* MR = Magic resistance relevant to a particular spell. Can include general magic resistance and resistance to the specific element of the spell.
Note that we are ignoring Hero Intelligence and Knowledge for the purposes of this discussion. Both of these impact spell damage.
We also ignore any source of magic resistance that may derive from specific artifacts.
DMG_{Inflicted} = DMG_{Total} \cdot (SB - MR)
It is unknown whether there is any cap to Magic Resistance, but given the formula above it is clear that a Magic Resistance of 100% (counterintuitively) does not grant immunity to spell damage.
==Example==
We have a hero casting LV10 Fire Arrow, with a spell damage modifier of 250% against a unit with 20% MR and an extra 30% Resistance against Fire spells.
1. Calculate the base spell damage from LV10 Fire Arrow:
DMG_{Base} = DMG{Arrow}(10) = 435 + (516 \cdot 10) = 5595
2. Calculate total magic resistance to the spell:
MR = MR_{Unit} + MR_{Fire} = 20% + 30% = 50%
3. Calculate the spell modifier:
Modifier = SB - MR = 250% - 50% = 200%
4. Calculate Received Spell Damage:
DMG_{Inflicted} = 13987 \cdot 200% = 13987 \cdot 2 \approx 27974
Note: While the actual final value calculated by the game may have some slight variations due to different rounding steps, this should give you a good idea on how Magic Resistance comes into effect.
==Multiplicative vs. Additive==
Some Magic Resistance bonuses are additive, while others are multiplicative.
Here is how the final MR bonus is calculated:
* MR_Additive(i) - Represents an additive MR bonus the unit benefits from
* MR_Multiplicative(j) - Represents an multiplicative MR bonus the unit benefits from
* MR_Max - A "hypothetical" maximum Magic Resistance imposed on any unit. Without it, units with MR values of 100% or higher would completely negate spell damage (which seems unlikely).
MR = Min(MR_{Max}, [\sum MR_{Additive}(i) \cdot (1 + \sum MR_{Multiplicative}(i)])
Notes:
* Multiplicative bonuses are not effective as long as unit has no Additive MR.
* The game seems to separate "Unit Magic Resistance" from other types of resistances to spells. Therefore you should think of a unit's "true" MR stat as calculated separately using the formula above. You can then combine the other bonuses together before applying the inflicted damage formula.
=Sources=
All units can improve their Magic Resistance by upgrading Dexterity Potential. (Additive)
Some units have further innate Magic Resistance via Talents. (Additive)
Hero Mastery Resistance also improves them Magic Resistance on your units. (Additive)
Magic Guild also provides additional magic resistance.
Finally, you may find temporary magic resistance bonuses in Campaign and Endless Inferno that will affect all your units in those respective game modes only. (Multiplicative)
Remember that although not covered here, you can also improve your magic resistance by upgrading your overall Hero Knowledge.
==Unit Skills==
==Awakening Skills==
==Hero Abilities==
==Spells==
==Artifacts==
==Weapon==
=Reduction=
There are a handful of effects that reduce one or more units' Magic Resistance, rendering them more susceptible to spell damage.
==Unit Skills==
==Hero Abilities==
==Artifacts==
==Magic Guild==
==Adjutant==
==Weapon==
=Specific Element=
While this does not count as real unit Magic Resistance, several effects do grant resistance to specific elements. See previous example that includes such a resistance.
==Sources==
===Unit Skills===
Fire 	Fire 	Fire
Water	Water	Water
Air 	Air 	Air
Earth	Earth	Earth
===Hero Skills===
===Magic Guild===
==Counters==
Crystallized and Static are a status effects that can reduce a unit's Magic Resistance. Please consult their pages for sources.
===Unit Skills===
Fire 	Fire 	Fire
Water	Water	Water
Air 	Air 	Air
Earth	Earth	Earth
===Weapons===
===Hero Skills===
===Adjutant===
Category:Spells