User:Irismus/SandboxPage



Magic Resistance is a stat that reduces (or increases, if negative) magical damage a unit takes from spells and magic attacks. Every unit is capable of gaining or losing magic resistance, and most units start with a small amount of base magic resistance. A hero's magic resistance can be passively increased with talents, certain items, and some abilities. The magic resistance of any unit can also be temporarily increased or reduced with some abilities.

Equations
The total magic resistance displayed on the HUD and the incoming magical damage multiplier can be defined as:

Total Magic Resistance = 1 - Magical Damage Multiplier

Magical Damage Multipler = [1 - (1 - Negation Multiplier) × (Base Magic Resistance + × )] × $$\prod_{i=1}^{n}$$(1 - Magic Resistance Modifiers i )

The magical damage multiplier is applied to all incoming magical damage sources to calculate the total magic damage received, after being reduced by damage barrier sources.

Base Magic Resistance
Base magic resistance consists of one fixed value set for each unit individually, and it can be a negative number.

Heroes
All heroes currently have the same Base Magic Resistance value:  % base magic resistance. For heroes, increasing its attribute improves the base magic resistance value, which is gained by leveling up, acquiring certain items, or with the help of certain abilities.

Base Magic Resistance Negation
Some abilities negate or ignore a unit's base magic resistance by removing a percentage of the base magic resistance on the target. This magic resistance negation only affects the base magic resistance value of units, other sources of magic resistance are not affected.

(and 's ) interact with magic resistance differently. Instead of stacking multiplicatively with other sources of magic resistance, it acts as a multiplier for the base magic resistance. These two abilities are currently the only two sources of base magic resistance negation, and it is defined as

This means, for heroes with % base magic resistance, reduces magic resistance by, down to.

Stacking
Multiple sources of magic resistance bonus and/or reductions stack multiplicatively. This means a unit's magic resistance value changes less the higher its magic resistance is, and more the lower it is. This prevents a unit from reaching 100% magic resistance by stacking different sources up.


 * Example 1:
 * have 2 different magic resistance sources, Level 4 and a.
 * Without factoring in the base magic resistance increase by, what is his current magic resistance?
 * Base hero magic resistance:
 * Bonus magic resistance: :, :
 * Magic resistance reduction: 0 (None)


 * Total Magic Resistance
 * = 1 - ((1 - ) × (1 - ) × (1 - ))


 * 's current magic resistance in this example is %, and all incoming magical damage received will now be multiplied by.


 * Example 2:
 * is now affected by two magic resistance reduction sources, Level 4 and a Level 4.
 * Without factoring in the base magic resistance increase by, what is his current magic resistance?


 * Base hero magic resistance:
 * Bonus magic resistance: 0 (None)
 * Magic resistance reduction: : -, : -


 * Total Magic Resistance
 * = 1 - ((1 - ) × (1 - -) × (1 - -) )


 * 's current magic resistance in this example is %, and all incoming magical damage received will now be multiplied by.

Actual Magic Damage Recieved
Calculating the total magic damage received from an ability involves using a few multipliers:


 * Actual Magical Damage Received
 * Total Magical Damage
 * - Magic Damage Barrier
 * × Magic Resistance Multiplier

+ ( × )
 * ± Flat Bonus Health Values
 * × % Bonus Current/Max Health Values

Magic Resistance Multiplier, Actual Base Magic Resistance, Magic Damage Barrier and Magic Damage Negation Sources (if any). The total or actual magic damage dealt is equal to how much health a target immediately loses as a direct result.

Actual magic damage dealt after magic resistance is defined as

 Magic Damage Dealt = (Magical Damage - Magic Damage Barrier - Magic Damage Negations) × (1 - Magic Resistance) 

Magic Damage Barrier absorbs a set amount of magic damage before it is reduced by magic resistance.

Effective HP
The total amount of magic damage a unit can take due to magic resistance is known as effective HP (or EHP). Despite each source of magic resistance increasing the magic resistance value less the higher it is and making them seem less effective, each source increases the unit's effective HP against magic damage by their base value.

A unit with 0% magic resistance has 100% effective HP against magical damage, which means magical damage equaling 100% of its health is required to kill it. All heroes have  magic resistance by default, making their effective HP against magical damage %.

This definition of EHP assumes all damage taken is magic damage. EHP against physical damage (such as basic hero attacks etc.) is modified by armor.

Effective HP against magical damage is defined as

EHP = Σ CurrentHP / (1 - Σ Magic Resistance)

Instead of diminishing effectiveness, multiple sources of the same resistance value are more effective stacked. Two sources of % resistance stacked provides %, extra EHP whereas one source provides %.

Examples

 * Example 1


 * at max level has health with Level 4  and a, how much EHP against magical damage he has?


 * According to the previous example in magic resistance stacking above, with Level 4  and a  has a magic resistance of % (or ).
 * Base magic resistance:
 * Bonus magic resistance: :, :


 * EHPm
 * = / (1 - )


 * has EHP against magical damage in this example.


 * Example 2


 * has health at max level. While under the effect of a Level 4  and Level 4, how much EHP against magical damage he has?


 * According to the previous example in magic resistance stacking above, who is affected by those two abilities will have a magic resistance of % (or ).
 * Base hero magic resistance:
 * Bonus magic resistance: 0 (None)
 * Magic resistance reduction: :, :


 * EHPm
 * = / (1 -  )


 * has EHP against magical damage in this example.

Modifying Magic Resistance
Several abilities and items have abilities that grant or reduce magic resistance.

Debuff Immunity
Debuff Immunity stops most effects of debuffs' effects on a unit without dispelling the debuffs while granting magic resistance bonus as an effect. The following abilities grant debuff immunity and magic resistance bonus.

Talents
With the magic resistance and no other sources of magic resistance, the following heroes with bonus magic resistance talents effectively have their magic resistance increased up to:

Besides these, the following heroes have talents that increase the magic resistance of the units they summon

Items
These items grant bonus percentage-based magic resistance values to the hero who has them equipped.

Spell Immunity


A unit having 100% magic resistance does not equal to being spell immune. Therefore, Spell Immunity and Magic Resistance are separate and different mechanics.

Resistência mágica Сопротивление магии 魔法抗性