Friday, April 20, 2012

Health, Armor, and Magic Resistance

This post contains a lot of mathematics. Specifically, it uses the method of Lagrange Multipliers from multivariable calculus. Maybe you wish I was your calculus instructor right now. If you want to skip all that, feel free to use the calculator here.


You are buying a defensive item, and you need to know whether you should build Health or Resistances. Calculus tells us the answer and this calculator displays it.

Enter the ratio of Physical : Magic damage you will take in a teamfight, and your health, armor, and MR.

Phys:Mag Dmg:
Current Health:
Current Armor:
Current MR:

Ideal Health/(100+Armor):
Ideal Health/(100+MR):
Your Health/(100+Armor):
Your Health/(100+MR):

Equal Physical and Magic Damage

Single-variable optimization problems are standard in a first-semester calculus class. You end up with one of these if you assume that you take an equal amount of physical and magic damage.

Under this assumption, you look at health and resistances, and ask how much they cost. It turns out that health costs about 2.6 gold each, while armor and magic resist cost about 15 gold each.

When we take 1 physical and 1 magic damage, we will actually take less damage than that because of resistances, and we want to maximize the number of times we can get hit before we die. The resulting equation is

Here H = Health, X = 100 + Armor and Y = 100 + Magic Resist.

We would like to maximize this number of hits before death. The trick is that we know our armor and magic resist should be equal, so we can actually substitute X = Y. This means we try to maximize


Now we are trying to maximize a quantity that has 2 variables, so we use our calculus 1 expertise and say, "we should eliminate one of these variables so that we can take the derivative." Eliminating a variable is possible, since Health and Armor+MR cost money, and we only have some finite amount of gold k to spend. Remember that now X stands for one point of both armor and magic resist, so that a point of X costs us 30 gold. We'll use the equation

to eliminate H from our Number of Hits equation above. The result is


Take the derivative and set it equal to zero. You can then solve for H and X:

Which is really cool, because it means that if you are buying H and X from scratch, you want to spend the same amount of money on H as you do on X. This means that you should end up spending half your money on Health and the other half on Armor and MR:

Warning: This model assumes that you start with 0 health and 0 resistances, which is of course false. In practice, you first need to make up for the fact that your armor, health, and MR start out wonky. So the easiest way to interpret it is to look at the optimal ratio of health to resistances:

Conclusion: If you are taking equal physical and magic damage, your health should be 11.5 times the value of your 100+Armor, with your MR being the same as your armor.

Unequal Physical and Magic Damage

When you don't take equal physical and magic damage, we can't use the trick where we set X = Y, so we need multivariable calculus. Specifically we will need Lagrange multipliers to find the optimal solution.

Again we'll use the assumption that armor costs 15 gold, magic resist costs 15 gold, and health costs 2.6 gold. But now we will assume that you take R physical damage for each 1 magic damage you take, so that the damage you take from each "hit" is

Again X = 100 + Armor, Y = 100 + MR.

The number of those units of damage you can take before dying is your health divided by the damage. This is what we want to optimize:


Simplifying a bit we can remove an annoying factor of 100 and work to maximize the function


There isn't any easy argument for claiming that X should be some proportion of Y here (or at least, not one that I see immediately). So we use Lagrange Multipliers to maximize this function subject to the constraint that we only have a finite amount of gold, k, to spend.


Lagrange Multipliers force you to make up a new variable called Lambda, and work with a function of four variables:

Then we set all four partial derivatives of f equal to zero and see what we get.

Note that as always with these things, the last equation just tells us that we better satisfy our initial constraint!

Anyway, we can subtract the first two equations from each other and find that

Since H is nonzero, we get our first interesting result, which is:

This tells you the correct ratio of armor to magic resist given the ratio of damage you are taking. If you take 4 times as much physical as magic damage, you want twice as much X as Y, so you want your 100 + Armor to be twice your (100 + MR).

When we plug (*) back into the first equation we can find


When we plug (*) into the third equation, we find


Now we could use the last equation to find exact values, but what we really care about is the ratio of H to Y and the ratio of H to X, which we can find.


To check our work, we can use R=1 to re-find the fact that H/X and H/Y are both 11.5 if you are taking equal damage from physical and magical sources.

With R=4, H/X is between 8 and 9. So in this situation your health should be about 8 or 9 times your (Armor+100). H/Y is between 17 and 18. So your health should be about 17 or 18 times your (MR+100).

This doesn't take into account last whisper or void staff, and assumes that all health has a constant cost (which is not exactly correct). But it still gives a very good approximation to the optimal defensive build plan. Aren't you glad you learned multivariable calculus?

Sunday, April 8, 2012

Team Composition

I used my Team Composition spreadsheet while watching the IPL4 finals today. Here's what I got.

Game 1

CLG, at left, has a team that has very very strong Initiation and CC but also Counter-Initiate. TSM, at right, can't get away or initiate. This means CLG always gets to choose when the fights happen. There are lots of holes in TSM's team composition; picking Kog'Maw when you can't protect him is sad times.

Game 2

No CC for CLG, at left. But a huge amount of offensive siege and push pressure means that they can split push 3/1/1 all day. TSM, with no push pressure, can't do anything about it. That's basically the story of this game.

The Spreadsheet

The first page explains the 12 Team Composition traits I used, and how to compensate for a lack in one of them.

The second page is the meat of this spreadsheet; the individual champion ratings.

The next page allows you to sort the champions; here I've sorted by "Protection for Carries."

The next page shows the list of 5-star Champions.

The final pages use that data to form the actual Team Composition pages that you saw at the beginning.

Hint: Use "Blank" as a champion to fill in 2 for everything, so you can see what you are missing while the team falls into place.

Would you like to use it?

When opening the XLS in OpenOffice, one of the sheets just plain didn't work. Maybe Google Docs is the only place all the sheets will work? PM me on Reddit (HippityLongEars) if you want a link to the google doc so you can copy it that way.

If you want to complain about my ratings for specific champions, just download the thing and fix it yourself. ;)


The idea for such a thing comes from This Guide at

Thursday, March 29, 2012

Quintessence of Destruction

Quintessences and Marks of Destruction are relatively new: they provide some armor penetration and some magic penetration. When are they better than the alternatives?

The Extremes

The problem is that in every extreme situation, they will be outclassed by either Insight (pure magic penetration) or Desolation (pure armor penetration).

In the extreme where you do no physical damage, Insight is better.
In the extreme where you do no magic damage, Desolation is better.
In the extreme where your target has lots of armor, Insight is better.*
In the extreme where your target has lots of magic resist, Desolation is better.*
*This is not a mistake. Armor penetration is best against low-armor targets.

The Happy Medium

This means that there will be a happy medium where Destruction wins out. Where is it?

The important factors are:
  • What is your ratio of physical : magic damage?
  • How much armor and magic penetration do you get from other sources?
  • How many quintessences are you using for penetration?

The Spreadsheet

At the bottom of this post is a link to a Google document that you can view or download. You'll enter the factors, and see which penetration runes are best against various targets. Remember that if the enemies build too much armor, you'll wish you had magic penetration, and if the enemies build too much magic resist, you'll wish you had armor penetration.

The front of the sheet
You'll enter:
  • Your ratio of Physical:Magic damage
  • The number of these runes you will use (usually 3, or 7.5 if you are using the marks too, since marks are half of quints).
  • Your other sources of flat magic pen (maybe items you plan to have).
  • Your other sources of flat armor pen (don't forget the mastery!).
  • Your percentage magic pen (void staff, mastery).
  • Your percentage magic pen (last whisper, mastery).
It will show you a pretty grid! The rows and columns are labeled with your target's magic resistance and armor. So, if you go way to the right on the grid, you are looking at very very armored enemies, and toward the bottom is very very magic resistant enemies. The pretty green area in the middle is the sweet spot for the Destruction runes. Toward the right, against lots of armor, it shows a blue m for magic penetration: you want Insight runes. Toward the bottom, against lots of magic resistance, it shows a yellow a for armor penetration: you want Desolation runes for them.

Early-Game Shyvana

For a champion who does about 7 physical damage for every 10 magic damage (my estimate of Shyvana's damage), the ratio is 0.7

Shyvana Setup

When I play Shyvana I want to do some early-game counterjungling, so I tend to go up against the enemy jungler, who has about 55 Armor and 35 MR. Look! That whole area is green! So I use Destruction quints.


Late-Game Shyvana

Late-game, you might be hitting squishies with 100 armor and 50 magic resist, or bruisers with 200 armor and 150 magic resist. What then?

Late-game, you might feel torn between Destruction and Insight.
Destruction is on the borderline late game, and it's the best early. So I run the Destruction and feel good about it.

How Much Does It Matter?

The last sheet displays how important it is to choose the best runes: it tells you what percentage damage boost you get from choosing properly. Specifically, it is how much the best runes outperform the second-best runes. Remember that Destruction are always either best or second-best.

 Toward the upper-right and lower-left corners, this shows how much better the single-type penetration runes are than the mixed penetration runes. As the damage boost reaches 0, the tiles fade to black -- these are the borderlines where Destruction runes are even with one of Insight or Desolation.

The Percent Benefit sheet
This means there is a reasonable range where the Destruction runes are the best runes, and a huge range where choosing anything else is only at most 0.25% better than Destruction.

Link To The Spreadsheet

If you'd like to look at the spreadsheet, it is published here.
To download your own copy to excel (the colors don't quite work but the rest does), go here.