League of Legends Guide

  • Views: 43,995
  • Rating: 90% ( Great )

Heat n Serve's Guide to Mathcrafting

written by Heat n Serve

Table of Contents

  • Foreward

    In the first programming course I ever took at college, the professor put a quote in one of his lecture slides: "When C is the only gun you have, everything looks like a foot." For the life of me I can't find the original source of that quote, but nonetheless I feel it is an appropriate way to start this guide because the same can be said of mathcrafting. It's really easy to look at equations and do calculations, but it is another thing to put those things in the context of an actual game. If you do all this math just to split hairs over how to deal an extra 2 damage to an enemy, you have completely missed the purpose of this exercise. It is really easy to shoot yourself in the foot if you aren't trying to formulate a strategy based on what the numbers tell you. In this guide you will hopefully learn more about the numbers and why they matter, just be careful how you apply it to practice.

    What follows is but a brief example of what one man without a working graphics card can accomplish. Please feel free to vote/comment if this guide helped you in anyway. However, the comments section is a poor place for discussion. As such, if you want to discuss anything or ask a question, it would be best to do it in this thread:

    German translation here:

  • Conventions

    Given that all of you will have varying levels of math background, I will briefly take the time to establish some conventions so that you don't start plugging numbers into equations incorrectly or misreading what I am trying to say. If you feel this is unnecessary, then by all means skip to the next section.

    League of Legends uses a lot of percentages. By definition, 1%=0.01. However, it is easy to ignore that equivalence, drop the percent sign and do math without it. Beware that 100 is not the same as 100%. For best results, if you see a variable in an equation that requires a percent term, always evaluate the equation with the decimal number that it represents (Example: if you have a dodge chance of 20%, then the DODGE term in the equation is 0.20; a critical strike damage of 250% is 2.5).

    I do a lot of mathcrafting to figure out the underlying game mechanics of LoL, and one thing I noticed is that even if I carry out every operation to 31 decimal places, LoL may give me a different answer because of rounding. I have no clue how LoL rounds things, but I'm convinced it rounds at several points within a calculation which can cause the end result (damage dealt, for example) to be off by 1 or 2. I will arbitrarily round numbers here to make equations and concepts easier to understand, so if you see my equations give a slightly different result than for an in-game setting, don't be surprised. For best results, do what I do and collapse all necessary mechanics into one equation and punch in the numbers so as to not introduce rounding errors.

    I will try to express variables in all caps using single words or abbreviations to make equations slightly more readable. An index of what these variables mean is in the following section, should you ever get confused. Some of these variables will be "base stats" stats that you can read off of your character info screen or rune page, while others are calculated and applied to real-game situations. I will do my best to distinguish these in the variables section.

  • Variables

    An "*" indicates that it is derived from base character stats.

    AD = Attack damage. Your champion's total attack damage (base + items/runes/masteries/buffs - debuffs) from his/her character stats display.
    AS = Attack speed. Measured in attacks per second. Accounts for all modifiers. Hard cap coded at AS=2.5.
    BAS = Base attack speed. It is essentially the attack speed you would have at level 0, if there was a level 0.
    CSC = Critical strike chance. Percent chance of a champion scoring a critical strike.
    CSD = Critical strike damage. Percent increase in damage when doing a critical strike (default is 2).
    CTC = Chance to crit.* Similar to critical strike chance, but factors in miss chance and enemy dodge chance.
    CTH = Chance to hit.* Chance that an autoattack will hit an enemy for normal damage without you missing or the enemy dodging.
    DAM = Damage after mitigation.* This is the actual damage you will do when attacking an enemy after taking into account enemy armor/resist levels, percentage based damage reduction/amplification buffs/debuffs and any armor/resist penetration you may have.
    EXD = Expected damage.* Damage you will do when taking into account chance-based damage modifiers such as critical strikes, misses and dodges in addition to non-chance based damage mitigation. This is roughly equivalent to the average damage dealt per attack taken over a large sampling of attack outcomes.
    MISS = Miss chance. The chance that your champion will roll a miss on an auto attack. This chance is usually zero unless you are under the effect of a negative debuff.
    SD = Spell damage. Whatever amount of magic damage that is displayed in a spell or item tooltip.

    HP = Hit points. The total amount of hit points (a.k.a. health) that a target has.
    ARMOR = Armor. The amount of armor a target has.
    RESIST = Magic resistance. The amount of magic resistance a target has.
    DODGE = Dodge chance. The chance that your champion will dodge an enemy auto attack, thereby avoiding damage.
    EPHP = Effective physical hit points.* Basically involves finding an equivalent amount of hit points at zero armor that is capable of taking the same number of hits from an enemy as a champion with a fixed health and one or more physical damage reduction mechanisms.
    EMHP = Effective magical hit points.* Basically involves finding an equivalent amount of hit points at zero armor that is capable of taking the same number of hits from an enemy as a champion with a fixed health and one or more magical damage reduction mechanisms.

  • Offense

    General damage inflicted
    For beginners playing damage class champions, the most common question is, "how do I figure out how much damage my attacks actually do?" First of all, you must know the damage type of your attack. Most auto attacks deal physical damage and are affected by positive armor values like so:

    Most (not all) spell based attacks deal magic damage and are affected by positive resist values like so:

    These armor and resist based damage modifiers can be expressed as a percentage. For physical damage, percent damage reduction is:

    For magic damage, percent damage reduction is:

    These percentages can be viewed in-game by holding your mouse pointer over a target's armor and resist values, respectively.

    A word on armor/resist reduction and armor/resist penetration
    Armor reduction and armor penetration are applied in this order:
    1. Percent reduction (Bushwhack / Pounce)
    2. Flat reduction (The Black Cleaver, Puncturing Taunt, etc)
    3. Flat penetration (The Brutalizer, Sunder Mastery, Runes of Desolation)
    4. Percent penetration (Last Whisper)
    (note: not sure of the order of 1 and 2 since the patch notes only mention a change to the order in which penetration is applied, not reduction).

    Resist reduction and resist penetration are applied in this order:
    1. Percent reduction (Bushwhack / Pounce)
    2. Flat reduction (Cursed Touch, Abyssal Scepter, etc)
    3. Flat penetration (Sorcerer's Shoes, Runes of Insight)
    4. Percent penetration (Void Staff, Archaic Knowledge Mastery)
    (note: not sure of the order of 1 and 2 since the patch notes only mention a change to the order in which penetration is applied, not reduction).

    Numbers 1 and 2 will visibly affect a target's armor/resist values in their stat display. While 3 and 4 apply further reduction in much the same way, players will only see a change in damage dealt; there will be no visible change in the target's armor/resist in the stats display. Also note that armor/resist reduction is able to lower an enemy's armor/resist values below zero, but penetration can only penetrate armor/resist up to zero and no further.

    Attacking a target that has negative armor/resist values will result in damage amplification, rather than damage reduction. Simply take the absolute value of armor/resist:

    Perhaps "damage after mitigation" is no longer an appropriate term, but the point is that you still end up with a measure of damage dealt after the effects of armor/resist have been taken into account. Expressed as a percent, damage amplification looks very much like damage reduction:

    Alternate damage reduction mechanics
    Some buffs/abilities on targets actually reduce damage regardless of their armor/resist levels. Examples include Gragas' Drunken Rage, Garen's Courage, having 20 stacks on a Leviathan or having a point in Tenacity in the defensive mastery tree. However, not all of these reduce all damage uniformly. Kassadin's Void Stone, for example, only reduces incoming ability damage. Once you know how enemy armor, resist and other reduction mechanics will affect your auto attacks and spells, it is fairly easy to compute how these mechanics stack. They stack multiplicatively:

    In case you are asking, "in what order do they stack," it doesn't matter because of the commutative property of multiplication:

    In order to make this clearer, let's do a real example with Gragas. With 260 base damage, you auto attack a Gragas that has 160 armor, a buff from level 5 Drunken Rage and a Leviathan with 20 stacks. 160 armor gives Gragas a 61.5% reduction to all incoming physical damage:

    Level 5 Drunken Rage reduces all incoming damage by 26%. A Leviathan with 20 stacks reduces all incoming damage by 15%. Gragas' total percent damage reduction is 75.8%:

    Your damage dealt after mitigation is roughly 63.

    Here I rework the equation to more clearly demonstrate that the order of stacking damage reduction doesn't matter:

    Speaking of alternate reduction mechanics, there appears to be a mechanic that reduces incoming minion damage by roughly 30%: http://forum.leaguecraft.com/showthread.php?tid=7406
    This too, will stack multiplicatively with other forms of damage reduction.

    Attack Speed
    Attack speed is calculated using a base attack speed and any attack speed modifiers your champion has. As your champion levels, he/she gains a fixed attack speed (ASPL) per level. Percentage modifiers (ASMOD), such as those from items/runes/masteries, only apply to the base attack speed a champion possesses and not to the attack speed gained with each level:

    Chance based mechanics
    When you auto attack an enemy champion, not all of your attacks will always hit. The enemy could dodge your attack, or you could miss (two separate mechanics). Misses are caused by having debuffs on your character that reduce your chance to hit:
    [*] Corki's Phosphorus Bomb reduces your chance to hit by 35%
    [*] Shaco's Two-Shiv Poison has a passive debuff that reduces chance to hit by 20/22.5/25/27.5/30%.
    [*] Teemo's Blinding Dart reduces your chance to hit by 100%
    [*] Heimerdinger's [spell_text=CH-1 Concussion Grenade] reduces your chance to hit by 100%

    Provided you actually land your attack, you could either crit or you could non-crit (what I will call a "hit" for this discussion). First, let's look at the probability that your attack actually lands on the target (no dodge, no miss):

    So far so good. Now things might get confusing, but I want to actually show the correlation between the critical strike chance (CSC) in your champion's stat display and your actual chance to land a crit (CTC):

    Chance to hit (CTH), is simply the chance that your attack lands without critting the enemy:

    Expected damage is the weighted average of these outcomes, accounting for the enemy damage reductions we calculated earlier and bonus damage from crits:

    The remaining chance (the probability of all possible outcomes must add to 100%) results in zero damage being dealt, and therefore drops out of the expected damage calculation.

    Damage per second can be calculated by taking the product of the expected damage for an attack and the rate of attacks per second:

  • Defense

    Effective health
    When it comes to surviving enemy damage, effective health is the name of the game. Varying amounts of armor/resist can make a given health pool capable of absorbing more damage depending on how much armor/resist you have. By accounting for armor/resist, you can place your health on the same scale as the incoming damage (AD) on your champion. As I discussed in the offense section, how much effective health you have depends the type of damage (physical/magical) your champion is taking. I, like most people, prefer to break down effective health into two camps: effective physical hit points (EPHP) and effective magical hit points (EMHP). Each point of armor/resist basically increases your EPHP/EMHP by 1% of your base HP:

    Corollary: Effective regen and healing
    Most people stop their analysis of effective health at what you see above, forgetting that health is not some static attribute; it is in a constant state of flux due to regen from items/runes/masteries and from heals. Once that health is restored, enemies must remove that health in order to kill you, and armor/resist can make it more difficult for your enemies to do so. Therefore, I prefer to consider regeneration and healing to be scaled by armor/resist in exactly the same way that static HP is.

    Summoners would be wise to consider this effective health corollary on champions like Mundo that have high health regen. Is it better to stack more regen or more armor/resist? Much like static HP, the answer is often more armor/resist. The same can be said during the early laning phase of each game. Armor and resist (more often resist in the early game) make enemy harassment less effective, making it easier for regeneration items to recover lost health. For this reason, Spirit Visage and Warden's Mail are extremely effective items for countering enemy harassment. Spirit Visage in particular will practically shut down even the most annoying spell spammers in the early game.

    Dodge is a chance based mechanic that allow your champion to avoid damage from an enemy attack. Each dodge item, along with your rune page and mastery build, is checked separately (D1, D2, D3, etc) when rolling for a dodge. This means the probability of you getting a dodge from any one of them is one minus the probability of you simultaneously failing a dodge roll on all of them:

    Because dodge allows you to avoid the damage from an attack, you could say it can scale your EPHP in a similar way that armor does:

    You have to be careful when doing this though, because at low levels of EPHP one shot can practically kill you. If you don't dodge, you're basically dead. In the extreme case it is an all or nothing deal, and therefore your EPHP won't scale quite as nicely as in the above equation. You therefore need to have enough HP and armor such that your effective physical health is considerably higher than than the incident damage. Otherwise dodge won't help you. Needless to say, I'm writing for the tank players that are reading this. In my opinion, dodge only scales effective HP well when you have the armor and HP to support it. On squishy damage class champions, it is a weak stat, and you should never consider a Phantom Dancer as a form of defense on a champion like Twitch. For some specific examples, check out this post:
    (note that Phantom Dancers no longer provide dodge as a stat, but the discussion is worthwhile nonetheless to observe its usefulness on squishy champions)

    Alternate damage reduction mechanics
    What about Gragas' Drunken Rage, or 20 stacks on a Leviathan? How do they scale effective HP? As it turns out, their effect is similar to armor/resist. Rewriting the original EPHP equation may help to see this:

    Stack as many damage reduction mechanics as you want, they all scale effective health in the same manner. Recall how to stack damage reduction terms:

    Apply this to our re-derived effective health equations:

    Or, more succinctly:

    You can see how each damage reduction mechanic separately scales effective HP. If you really want to beat this concept into the ground, you can think of these other mechanics like additional armor/resist for your champion. I won't go into great detail on this, but you can actually find an equivalent armor/resist that gives the same increase in effective HP as something like Gragas' Drunken Rage. This allows you to put some of these damage reduction mechanics into perspective. How good is having points in Evasion or a point in Tenacity in the defensive tree? As it turns out, the cheapest items in the game offer more defensive value than a maxed out defensive tree in most practical mid-game scenarios:
    Even if I play as a tank, I prefer to make a 9/0/21 mastery build; the defensive tree just doesn't seem strong enough to me to be worth the points.

  • Utility

    Movespeed calculations
    This has already been discussed at length both on the Leaguecraft forums, and the official LoL forums. Rather than repeat myself and others, I will simply link you to this thread:
    It should tell you everything you ever wanted to know about movespeed, complete with in-game tests. Enjoy!

    Gold per 10 payoff time
    Items have a resale value equal to 70% of their total purchase value. In other words, by buying and selling an item you lose 30% of the item's cost in the transaction. To recoup that lost gold and break even, you must hold on to that gold per 10 item long enough for its passive to tick for an equal amount of gold:

    Solving for MINUTES gives us a nice handy rule:

    The time in minutes to break even on the purchase of a 5 gold per 10 second item is simply the cost of the item divided by 100. Credit goes to those who partook in this thread:

    Some of you may prefer to only count the recipe cost in your break-even calculations, arguing that you get stats for the remaining portion of the cost. The problem with that argument is you lose those stats upon selling the item. The above way is pretty much the only way I accept a time-to-payoff calculation to work.

  • Changelog

    v1.8 - 7/3/11 - Added link to German translation. Credit/thanks to Ero.

    v1.7 - 4/1/11 - Minor updates that were needed to reflect patches to the game since my last revision of the guide. Also, I undid revision v1.5; it appears that the passive debuff still applies to a target, even though the active does not apply this debuff. I've noticed "miss" procs many times while jungling with Shaco since v1.0.0.99.

    v1.6 - 12/31/10 - Fixed an error where Archaic Knowledge mastery was accidentally listed under "flat penetration." Credit/thanks to WarTornPanda.

    v1.5 - 9/9/2010 - It was correctly pointed out that Shaco's Two-Shiv Poison no longer applies a chance to hit debuff (the leaguecraft tooltip does not reflect the patch v1.0.0.99 that applied this change but will be updated soon). Credit/thanks to RobertMeta.

    v1.4 - 8/30/2010 - Fixed yet another typo where EPHP was mistakenly used in an equation that called for MPHP. Credit/thanks to econdroidbot.

    v1.3 - 8/23/2010 - Fixed a typo where ARMOR was mistakenly used in an equation that called for RESIST. Credit/thanks to Dialupman.

    v1.2 - 8/13/2010 - Added variable SD (spell damage) since AD used in magic damage calculations is misleading/inaccurate. Credit/thanks to SuzakuCMX.

    v1.1 - 8/12/2010 - Fixed a critical error in the expected damage (EXD) calculation. Credit/thanks to jwc909.

    v1.0 - 7/23/2010 - Here is the guide. Yay!

Do you have your own
Build Guide?

Submitted by Heat n Serve

Featured Guides

New Guides