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 resistance. A hero's magic resistance can be passively increased with talents, certain items, and some abilities. Magic resistance of any unit can also be temporarily increased or reduced with some abilities.

Total magic resistance is defined as

Magic Resistance = 1 - (1 - Base Magic Resistance) × $$\prod_{i=1}^{n}$$(1 - Magic Resistance Modifiers i )

Base Magic Resistance
Base Magic Resistance is a value that never changes throughout a game. It consists of one fixed value set for each unit individually. The base magic resistance of a unit can be a negative number.

Heroes
All heroes currently have the same Base Magic Resistance value:

Base Magic Resistance Negation
Some abilities negate or ignores 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.

Total Magic Damage
Calculating the total magic damage of an ability involves using a few multipliers, 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.

Magic Resistance Stacking
Multiple sources of magic resistance 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. All sources of magic resistance modification stack fully with the exception of Ethereal buffs and debuffs.

Total magic resistance is defined as

Magic Resistance = 1 - (1 - Base Magic Resistance) × $$\prod_{i=1}^{n}$$(1 - Magic Resistance Modifiers i )

However, there are a few abilities that directly sets a unit's magic resistance to 100%, e.g..


 * Example 1:


 * have Level 4 and a . 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 %.


 * Example 2:


 * is at max level under the effect of a Level 4 and a Level 4 . 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 %. Magic resistance reduction's calculation is highlighted red in this example.

Magical Damage Barrier
Magical damage barriers absorb a flat amount of magical damage, no matter whether it comes from abilities (magical spell damage) or attacks (magical attack damage). The barrier absorbs the damage before it is reduced by magic resistance, and it is defined as the formula above.


 * Example


 * has a health damage barrier, and gets hit by  magical damage. How much actual magical damage will he take?
 * Base magic resistance:


 * Magical Damage Taken
 * = ( - ) × (1 - )


 * will take magical damage in this example.

This means the exceeding 100 magical damage is not absorbed and the damage is reduced by Anti-Mage's base % magic resistance to 75 magical damage. In this example, takes 75 magic 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.

Magical Damage Barrier Stacking
Multiple sources of magical damage barriers work independently and do not stack. When a unit is affected by multiple magical damage barriers, all of them deplete at the same time.

However, if a unit is affected by multiple barriers receive a damage instance that is greater than all barriers individually, the damage gets blocked as if the barriers were one barrier with combined capacity.

Magical Damage Barrier stacking is defined as

Magical Damage Barrier = $$ \begin{cases} i - B_n & \quad \text{if } x \leq B_n \\ i - (\sum_{i=1} B_n) & \quad \text{if } x > B_n \end{cases} $$

With  being the incoming magical damage value,   the source(s) of the magical damage barrier value.


 * Example 1


 * is affected by Level 4 and  of Pipe of Insight. He then takes  magical damage. Both magical damage barriers will lose  capacity.
 * Barrier capacity: :, :


 * Since the incoming magical damage is less than B1 and B2:


 * B1


 * B2


 * Since incoming magical damage is less than all individual barriers. Both and  will now have  and  remaining magic barrier capacity respectively in this example.


 * Example 2
 * is affected by Level 4 and  of Pipe of Insight. He then takes  magical damage.
 * Barrier capacity: :, :


 * Since the incoming magical damage is more than B1 and B2 combined:


 * Incoming Magical Damage


 * Since incoming magical damage is greater than the sum of both barriers, both and  are depleted, and magical damage is blocked as if the barriers were one barrier with combined capacity, highlighted in blue in this example.  takes the remaining  damage before applying 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 sources 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, means magical damage equaling 100% of its health is required to kill it. All 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 in effectiveness, multiple sources of resistance are actually more effective stacked than they are individually. 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.

Magic Resistance Increasing Sources
The only way to improve a hero's base magic resistance is to increase its, which is gained by leveling up, acquiring certain items, or with the help of certain abilities.

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 which increase the magic resistance of the units they summon

Items
These items grant bonus magic resistance 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 Сопротивление магии 魔法抗性