Talk:Magic penetration/@comment-143.115.159.53-20110103190417/@comment-84.245.40.155-20110107014551

The formula indeed seems to be broken.

From the Magic_Resistance page: Damage Reduction = Effective Magic Resistance / (100 + Absolute Value of Effective Magic Resistance )

So with magic reduction/penetration added, I get the following pseudo code:

If Mreduction >= MR then DR% = (MR - Mreduction) / (100 + abs(MR - Mreduction)) else if (Mreduction + Mpenetration) >= MR DR% = 0 / (100 + 0) = 0 else effective MR = (MR - Mreduction - Mpenetration) * (100%-%Mpen1) * (100%-Mpen2) # there's only 1 %Mpen item and 1 %Mpen mastery right now... DR% = effective MR / (100 + effective MR)
 * 1) below 0 already -> Mpen and %Mpen don't matter
 * 1) Mreduction didn't push it below zero, Mpenetration can only push it _to_ zero
 * 2) 0 -> %Mpen doesn't matter
 * 1) above 0 after Mreduction + Mpenetration

Or if you want that 3rd one in 1 formula: DR% = ((MR - Mred - Mpen)*(100%-%Mpen1)*(100%-%Mpen2) / (100 + ((MR - Mred - Mpen)*(100%-%Mpen1)*(100%-%Mpen2)))

(actually it should be "foreach %Mpen effective MR = effective MR * (100% - that %Mpen)" but there are just those 2 %Mpen, so I named them %Mpen1 and %Mpen2 ...)

Some examples for the 3 options above: 1st: (30 - 40) / (100 + abs(30 - 40)) = -10 / (100 + 10) = 9.1% bonus damage 2nd: 0% damage reduction (of course) 3rd(squishy): effective MR = (50 - 20) * (100% - 15%) = 30 * 85% = 25.5 25.5 / (100 + 25.5) = 20.3% damage reduction 3rd(tank & voidstaff): ((250 - 20) * (100% - 15%) * (100% - 40%)) = 230 * 85% * 60% = 117.3 117.3 / (100 + 117.3) = 54% damage reduction

It's late at night, so I _think_ I'm right, but I'm not 100% sure...