User:Irismus/SandboxPage3

Magic Resistance is a stat that reduces (or increases, if negative) a percentage of 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.

Definition
For illusions, all Magic Resistance Modifiying sources will be set to 0, since illusion do not benefit form magic resistance bonus.

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 - Negation Multiplier × (Base Magic Resistance + × )] × $$\prod_{i=1}^{n}$$(1 - Magic Resistance Modifiers i )

Each source of magic resistance acts as a incoming magic damage multiplier that work independently from each other. Because of this, combination of multiple magic resistance sources that are individually less than 100% is also effectively less than 100%. The magic resistance displayed in HUD is calculated from the final multiplier, after all magic resistance effects is accounted for. The total magic resistance displayed on the HUD and the incoming magical damage multiplier can be defined as:
 * For example, source that "increase magic resistance by 30%" or simply states "+30% Magic resistance" means that it acts as a  incoming magic damage multiplier.
 * They work independently from each other, meaning apply multiple magic resistance effects is equivalent to apply their corresponding magic damage multiplier in a multiplicative manner.
 * A unit that has a +30% Magic resistance and another +40% Magic resistance means that it has a  incoming magic damage multiplier. It will only take 42 damage when a 100 magic damage instance is dealt to it.
 * Activating will reduce the magic damage a hero is taking by half, regardless of how much magic resistance it has.
 * In other direction, a unit that has a -40% Magic resistance and another -60% Magic resistance means that it has a  incoming magic damage multiplier.
 * grants 100% magic resistance, which acts as a  incoming magic damage multiplier. When it stacks with other magic resistance sources, the final incoming magic damage multiplier is always 0 (due to multiplication with 0). Thus, the affected unit will always take 0 magic damage, no matter what other source of negative magic resistance it has.
 * A unit with a  incoming magic damage multiplier will be displayed as having -124% magic resistance.


 * For base magic resistance,


 * For other magic resistance sources,

In full equation,

Actual Magic Damage Received
certain calculations should link to damage manipulation instead. Still figuring out a better way to present this

The total or actual magic damage dealt is equal to how much health a target immediately loses as a direct result. The incoming damage received is calculated by the following factors, listed in the order of their applications:


 * Actual Magical Damage Received
 * Total Magical Damage
 * - Damage absorbed by
 * - Magic Damage Block
 * × Incoming Magic Damage Multiplier
 * - Magic Damage Barrier
 * × Other generic incoming damage manipulation Sources
 * × Other unique incoming damage manipulation Sources

In equation form:


 * Actual Magical Damage Received = [ (Total Magical Damage - Damage absorbed by - Magic Damage Block) × Incoming Magic Damage Multiplier - Magic Damage Barrier] × Other incoming damage manipulation Sources

The Total Magical Damage can be amplified by the damage dealer's generic outgoing damage manipulation (e.g. spell amplification) before other calculations are performed.

Due to this order, a unit affected by and  will suffer damage to its mana pool even though it will take no damage anyway. Similarly, any magic damage block source will be triggered even though no damage will be taken.

Spell Immunity


A unit having 100% magic resistance neither equals being spell immune nor debuff immune. Therefore, all three of these mechanics are separate and different mechanics.

The biggest difference with Magic Resistance is that Spell Immune units do not interact with spell damage at all, while magic resistance reduces incoming magical damage from abilities.

Spell immunity usually are granted to some units as an extra layer of protection, usually on ward-type units, or in combination with invulnerability.

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

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 magic resistance bonus sources 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, applies a base magic resistance negation multiplier of, reducing the base magic resistance down to.

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.

Stacking

 * Example 1:
 * Magic Resistance Bonus and Magical Damage Multiplier
 * with level 4 and has a  equipped. Without factoring in the base magic resistance increase by, what is his current magic resistance?
 * Base hero magic resistance:
 * Bonus magic resistance: :, :


 * Final Magic Damage Multiplier


 * All incoming magical damage dealt to will now be multiplied by . His current total  magic resistance in this example is 1 -  = %.


 * Example 2:
 * Magic Resistance Reduction and Magical Damage Multiplier
 * is now affected by two magic resistance reduction sources, level 4, a level 4 and.
 * Without factoring in the base magic resistance increase by, what is her current magic resistance?
 * Base hero magic resistance:
 * Magic resistance reduction: : -, : -, -


 * Final Magic Damage Multiplier
 * = (1 - ) * (1 - - ) * (1 - - )


 * All incoming magical damage dealt to will now be multiplied by  . Her current total  magic resistance in this example is 1 -  = %.
 * The ethereal magic resistance reduction is not factored into the calculations because has a higher magic resistance reduction value than.

Effective Health
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 (e.g. basic hero attacks etc.) is modified by armor.

Effective HP against magical damage is defined as

EHP = CurrentHP / Final Magic Damage Multiplier


 * Example 1
 * is Level 6 and has a health, what is her EHP against magical damage?
 * Base magic resistance:


 * EHPmagic


 * has EHP against magical damage in this example.


 * Example 2
 * from Example 1 now is affected by two magic resistance reduction sources, a level 4 and level 4 . What is her EHP against magical damage now?
 * Health:
 * Base magic resistance:
 * Magic resistance reduction: : -, : -


 * Final Magic Damage Multiplier
 * = (1 - ) * (1 - - ) * (1 - - )


 * EHPmagic


 * has EHP against magical damage in this example.

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