Magic penetration

Magic Penetration is the statistic of a Champion that allows them to counter some or all of a target's Magic Resistance. All champions have 0 base magic penetration but can increase it with items or runes.

Calculations
Magic penetration and magic resistance reduction are applied in the following order:
 * 1) Magic Resistance Reduction
 * 2) Flat Magic Penetration
 * 3) Percentage Magic Penetration

Magic Resistance Reduction

 * The target's Magic Resistance is reduced by a certain amount.
 * If the target has 30 magic resist and you have 20 magic resistance reduction, the target will take damage as if it had only 10 magic resistance.
 * 30 - 20 == 10
 * Magic-Resistance Reduction can reduce a target's resistance below zero.
 * The target will take additional bonus magic damage with negative resistance.

Flat Magic Penetration

 * The target's magic resistance is reduced by the amount of magic penetration.
 * If the target has 30 magic resist and you have 10 magic pen, the target will take damage as if it had only 20 magic resist.
 * 30 - 10 == 20
 * Flat magic penetration cannot reduce a target's resistance below zero.

Percentage Magic Penetration

 * The target's magic resistance is reduced by a percentage.
 * If the target has 30 magic resist and you have 20% magic pentration, the target will take damage as if it had only 24 magic resist.
 * 30 * (1.0 - 0.2) == 30 * 0.8 == 24
 * Percentage magic penetration has a bigger impact on targets with higher resistance.
 * For 40% penetration, a target with 200 magic resist will lose 80.
 * For 40% penetration, a target with 40 magic will lose 16.
 * Pecentage magic penetration cannot reduce a target's resistance below zero.
 * Multiple sources of percentage magic penetration stack multiplicatively.
 * If you have an item with 40% magic penetration and a mastery with 15% magic penetration, you have 49% magic penetration.
 * (1.0 - 0.4) * (1.0 - 0.15) == 0.6 * 0.85 == 0.51 == 51% of original resist == 49% penetration

Examples
You have 20 magic resist reduction, 29 flat magic penetration, and 15% magic penetration.
 * Target A has 80 magic resist.
 * The 80 is reduced to 60 by your 20 magic resist reduction.
 * The 60 is reduced to 31 by your 29 magic resist penetration.
 * The 31 is reduced to 26.35 by your 15% magic penetration.
 * 31 * (1.0 - 0.15) == 31 * 0.85 == 26.35
 * Target A takes damage as if it has 26.35 magic resist.
 * Target B has 15 magic resist.
 * The 15 is reduced to -5 by your 20 magic resist reduction.
 * The -5 is not reduced by your 29 magic resist penetration (cannot penetrate below 0).
 * The -5 is not reduced by your 15% magic penetration (cannot penetration below 0).
 * Target B takes damage as if it has -5 magic resist.

Negative Resistance
If a target has negative magic resistance, the amount of bonus damage is equal to the amount of damage reduction caused by that positive amount of magic resist. This sounds confusing and is better illustrated with an example.
 * If a target has 10 magic resistance, they take take 9.1% reduced damage (formula from Magic Resistance).
 * Therefore a target with -10 magic resistance would take 9.1% bonus damage.
 * So if you cast a spell that does 100 magic damage on the target, it would take 109.1 damage instead.
 * If a target has 20 magic resistance, they would take 16.7% reduced damage.
 * Therefore a target with -20 magic resistance would take 16.7% bonus damage.
 * So if you cast a spell that does 250 magic damage on the target, it would take 291.7 damage instead.

Items

 * +20 Magic Penetration
 * +20 Magic Penetration
 * 40% Magic Penetration

Masteries

 * : Your magical spells penetrate 15% of the target's magic resistance.

Runes

 * Insight runes provide flat magic penetration.

Items

 * Aura: 20 Magic Reduction to nearby enemies
 * UNIQUE: Your physical attacks shred your target doing 20 magic damage and reducing their magic resistance by 6. Magic resistance reduction stacks up to 4 times

Hero Abilities

 * : 15 / 25 / 35 Magic Resistance Reduction on hit for 4 seconds
 * : 10 / 14 / 18 / 22 / 26 Magic Resistance Reduction for 5 seconds
 * : +10 Magic Resistance Reduction to nearby enemy champions
 * : 15 / 20 / 25 / 30 / 35 Magic Resistance Reduction for 5 seconds
 * - 4 / 5 / 6 / 7 / 8 Magic Resistance Reduction for each second
 * : 20% / 25% / 30% / 35% / 40% Magic Resistance Reduction for 12 seconds.
 * : 12 / 15 / 18 / 21 / 24 Magic Resistance Reduction for 5 seconds
 * : 8 Magic Resistance Reduction each hit for 8 seconds (maximum 20 stacks).