Monday, January 7, 2013

A Meditation on Armor and Magic Resistance, or, "when are we ever going to use this?"

I'll start with some backstory, but if you'd rather not hear me rant about how much I hate non-math people, skip down to the bolded paragraph and keep reading.
So, college started back up for most of us today.  My schedule's pretty math-intensive (senior math-major here), with (ahem) Introduction to Statistics, Introduction to Probability, and Linear Algebra (and a Shakespeare class, but whatever).  If you're anything like me, when you hear, "probability," you're like, "there's no fucking way that there's a 4000-level class for probability."  Evidently, there is.  We start out studying Bernoulli's "Law of Large Numbers," and from there, I hear it goes batshit crazy.
As a math-major, there's nothing quite like hearing kids complain about their math courses.  Today, I had the wonderful opportunity to talk to a sophomore Biochem-major who had just failed his Calculus I class last semester, who remarked that he'd "never need to use calculus in the future," and that he "doesn't know why [he] even has to take the stupid sequence (that's to say, Calculus I, II and III)."  Now, as per usual, I immediately shot to my guns, and retorted, "probably when you'd never to find any sort of optimization of a system."
Later that day, I had a professor scoff at Calculus, saying that it's so utterly plebeian and Americans have a hard time with it because they're lazy and their society makes them even lazier.  I couldn't find myself agreeing anymore, and it's kind of a funny aside, but he was my Calculus II professor--this big, fat Russian guy.  Great guy.
So, when the shitfuck do we need Calculus?  Most people just see it as this "scary topic" that they, thankfully, never have to touch.  Others have to take it and absolutely hate it (methinks because they don't understand the beauty (be it in the concepts or the applications) of the math).  Still, others, such as myself, find themselves absolutely enraptured in it.
Today's blog-post is the culmination of two lessons in one: first, I'll go over the concept of derivatives (a very basic topic in calculus), and then I'll go over how to apply it, by finding the efficiency of magic resistance and armor in League of Legends.

If we could take any graph of a function and throw a dart at it, where the dart ABSOLUTELY WITHOUT A DOUBT will land somewhere on the function, and then find the slope at that point, we have the derivative (which is to say, "the derivative on a point of a function is the slope at that point").  For instance, if we were to, say, take y=x^2 (which looks similar to a curved-at-the-bottom V) and find the slope of the line at x=0, then, it goes without saying that the slope will be 0.  Now, the glory of this is that the actual x-derivative of y=x^2 is y'=2x, so the slope at x=1 will be 2.  Go ahead and digest that really quickly.  If you can't, it isn't the most important think you'll learn today.
Another example is the line, y=2x.  Now, obviously, the function is in slope-intercept form: it's a line with slope 2, with the y-intercept at y=0.  The derivative of this function is y=2, which is to say, regardless of where we put x (be it 0 or 1,000), the slope of the function will be 2.  Make anymore sense?
So, let's talk the glory that is the application of this (aside from, you know, finding slopes, which is sort of a glory in itself).

The way that magic resist and armor works in League of Legends can be illustrated by two separate functions: y=100/(100+x), where y is the damage multiplier and x is the armor or magic resistance (they both work the same, so I'll just call it MR for the rest of the entry).  So, essentially, If you have 20 MR, that means that you take damage at a factor of 100/120, or 5/6, so a 60 damage spell will only do 50 damage.  If you have 100 MR, you take damage at a factor of 100/200, or 1/2, so a 60 damage spell will only do 30 damage.  It's an important note that it isn't linear: if true damage would be 60 damage, and 20 MR would do 50 damage, then 120 MR would completely negate the damage IF MR was on a linear function (which is to say, the damage-reduction formula, y=100/(100+x), was a straight line with no curve).
Instead, however, the only way to get to 100% damage reduction is to get infinity MR.  Yes, even at 10,000 MR, you'd still take damage (100/(100+10000) would equate out to ~.59 damage from a 60-damage spell, but that's STILL DAMAGE).  This is known as an asymptote, because, mathematically (lest we're counting infinity), we can NEVER achieve immunity.
So, when does it become negligible to keep building MR?  Conceptually, the more MR you get, the less of an effect it has.  The different between getting hit with a 60-damage spell with 0 MR and 10 MR  is ~6 damage, where the difference between getting hit with the same spell with 100 MR and 110 MR is ~1.5 damage.
We can find the rate at which MR will affect the damage we take by taking its derivative (which is a more complex process that I'll skip), which comes out to y' = -100/(100+x)^2.  Here, we can take advantage of our human-curiosity by just plugging in numbers for x for the MR.  At x=10, y' = ~-.00826, which means that the next MR will have, similarly, that much damage reduction (in which case, it does, with -~.00812).  However, going closer to, say, 100 MR (x=100), y' = -.0025. 101 MR would equal -~.00248, which is significantly less than the difference between 10 and 11 (as we shown earlier).  Because of this difference, it becomes much harder to see an established change when stacking past 100 MR.  This equates out to you having to spend much more gold to see the same changes in damage-reduction after, say, 100 MR.

Stacking it, however, is more important whenever the other team begins to build magic penetration, because just as well as it stacks, it also comes apart.  My favorite mpen item, and it has been for a long time, is the Void Staff, because of its 40% mpen property.  What this entails is not +40% to THEIR magic penetration, but rather, their damage penetrates 40% of your magic resistance.  If you have 100 MR, then, without a Void Staff, you'd only take 30 damage from a 60-damage spell, however, with one, you'd take 37.5 damage (albeit, seems silly, but when the enemy Anivia is doing 800 damage instead, that's a difference of 100 damage, not counting a difference in AP).  In order for them to get 50% damage-reduction back, they'd have to get ~167 MR (which takes up more gold and another slot).
I want to go over the optimization-formula for damage between AP and mpen, but  I'm just...so wiped out.  SOME OTHER TIME.

No comments:

Post a Comment