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 illusions do not benefit from magic resistance bonus.

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.

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 )

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


 * 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. Unlike other magic resistance increasing or reducing sources, base magic resistance can be increased by and its total value is affected by Base Magic Resistance Negation.

The final base magic resistance can be defined as:

Final Base = Negation Multiplier × (Base + × )

Base Magic Resistance Negation
Base Magic Resistance Negation is a multiplier for the base magic resistance, and does not affect other magic resistance increasing or reducing sources. It is not a magic resistance source and thus does not "stack" with any magic resistance source.

For heroes with % base magic resistance, applies a base magic resistance negation multiplier of, reducing the base magic resistance down to.

Modifying Magic Resistance
A source that increases magic resistance by 30% (or ) acts as a   incoming magical damage multiplier. Since magic resistance sources work independently of each other, multiple magic resistance sources apply their corresponding magical damage multiplier multiplicatively and can be defined as:

Magic Resistance Bonus = 1 - Magical Damage Multiplier

Magical Damage Multiplier = $$\prod_{i=1}^{n}$$(1 - Magic Resistance Modifiers i ) × (1 + MAX Ethereal Reduction)


 * Magical Damage Multiplier
 * $$\prod_{i=1}^{n}$$(1 - Magic Resistance Modifiers i )
 * × (1 + MAX Ethereal Reduction)
 * × Illusion Negation

Increasing Sources
For illusions, all Magic Resistance Modifiying sources will be set to 0, since illusions do not benefit from magic resistance bonus.



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.

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

Reducing Sources
For illusions, all Magic Resistance Modifiying sources will be set to 0, since illusions do not benefit from magic resistance bonus.

Stacking

 * Example 1a
 * Multiple Sources of Magic Resistance Stack Multiplicatively
 * A source that increases magic resistance by 30% (or ) acts as a   incoming magical damage multiplier.
 * Every source works independently of each other, therefore applying multiple magic resistance-increasing sources is equivalent to applying their corresponding magical damage multiplier multiplicatively.


 * A unit with two sources of 30% and 40% magic resistance bonus respectively will have a total of  incoming magical damage multiplier, its current total  magic resistance on the HUD in this example will be 58%.


 * Magical Damage Multiplier
 * = (1 - 0.3) × (1 - 0.4)


 * Total Magic Resistance
 * = 1 - Magical Damage Multiplier
 * = 1 - 0.42


 * In example 1a, all incoming magical damage dealt to the unit will be multiplied by.
 * The unit will receive 42 damage per 100 magical damage instances.


 * Example 1b
 * Inversely, a unit being affected by 30% and 40% magic resistance reduction respectively will have a total of  incoming magical damage multiplier, and its current total  magic resistance on the HUD in this example will be -82%.


 * Magical Damage Multiplier
 * = (1 - -0.3) × (1 - -0.4)


 * Total Magic Resistance
 * = 1 - Magical Damage Multiplier
 * = 1 - 1.82


 * In example 1b, all incoming magical damage dealt to the unit will be multiplied by.
 * The unit will receive 182 damage per 100 magical damage instances.


 * Example 1c
 * Interactions with 100% Magic Resistance Sources
 * Consequentially, a combination of evasion sources that are individually less than 100% is also less than 100%.
 * The same unit from example 1b is affected by two sources of 30% and 40% magic resistance reduction respectively, and is also affected by.


 * Magical Damage Multiplier
 * = (1 - -0.3) × (1 - -0.4) × (1 - Fate's Edict icon.png 1)


 * grants 100% magic resistance, which acts as a  incoming magic damage multiplier. When stacking with other magic resistance sources, the final incoming magical damage will be 0, regardless of being affected by other magic resistance reduction sources.

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