Artwork by GenOne from the Smogon Forums.
Damage calculators are extremely useful tools for competitive Pokémon play. Being able to optimize EV spreads allows players to fine-tune their battle strategies by taking advantage of raw numbers, maximizing the usefulness of a Pokémon’s EVs in surviving opposing moves, obtaining relevant KOs, and outspeeding the appropriate threats. But how do these damage calculators work? Are they really using the exact damage formula that the game uses? Just what is that formula?
Back in the days of Generation IV, the damage formula was empirically derived through the hard work of two users named X-Act and peterko. Damage calculation is incredibly complex: just think about all the basic variables that come into damage calculation (attack, defense, move base power, level, etc). Not only do you have to devise a formula that takes into account these pieces and everything that makes them up, but you also have to take into account the randomness of damage rolls. In Pokémon, damage isn’t the same every time—every number that makes it all the way to the “random damage” section of the damage formula could leave with 16 potentially different values. Figuring out the damage formula in this way is both tedious and prone to human error, because not only are there a ton of variables to test, but there’s even randomness involved!
In Generation V, understanding the damage formula was tackled in a different way: looking at the game’s code. xfr, Bond697, Kaphotics, and V4Victini datamined and documented the structure of the damage formula as of Black & White, revealing exactly in what order different modifiers were applied and exactly how they were applied. This was big progress! Armed with new information, users like Honko and Sopan developed the Honkcalculator and the Poketron Damage Calculator. While these weren’t quite as nice-looking or as versatile as what we expect from modern damage calculators, they did have one very important feature—they were accurate. This was especially important to VGC, because playing on cartridge was required at in-person events and the norm for the majority of online grassroots VGC competitions. Having an accurate damage calculator meant that, if the damage calculator said you survived the move, you actually survived the move—no questions asked.
As the VGC playerbase’s general knowledge of how to use damage calculators grew, the demand for VGC-oriented damage calculation also increased. Honko’s damage calculator rose to the top as the go-to damage calculator, offering new features and drastically improving the look and feel of damage calculation. However, it focused chiefly on Smogon formats and offered minimal support for VGC. In 2015, Tapin, with help from Firestorm, created VGC’s very first damage calculator, introducing more VGC-centric default features and Pokémon sets, offering accessibility in damage calculation like never before to the VGC scene. squirrelboy1225 took over the project after Tapin’s retirement and has since maintained it to this day. However, with the addition of two new generations came a boatload of new modifiers, including Auras, Terrains, the -ate Abilities, and tons of new Abilities, items, and unique moves. Where do these belong in the damage formula? Does it even matter where they’re at? After all, isn’t it all just basically multiplication?
Unfortunately, not only does it matter where different modifiers are located at: it matters a LOT. A modifier is anything that can affect any part of damage calculation. There are 5 major “groups” of modifiers: modifiers to Attack/Special Attack, modifiers to Defense/Special Defense, modifiers to the base power of a move, general damage modifiers, and final modifiers. Additionally, throughout the damage formula, decimals are largely dealt with via rounding, but there are three different types of “rounding” that can occur.
These rounding differences might not seem like a big deal, but since the game will round, pokeRound, and floor at different steps, rounding errors will amplify quite quickly. Even something as simple as a Life Orb Dazzling Gleam in a Double Battle with Light Screen invokes all three of these rounding methods, so haphazardly slapping everything together during damage calculation can result in wildly different results from what will actually occur on cartridge.
This brings up a problem! The damage formula has not been datamined and thoroughly documented again for Generation VI or VII like it was back in Black & White. So where do new modifiers go? Well, at the start of a generation, it’s just anyone’s guess where these go! Is Terrain a base power modifier, or is it a damage modifier? Maybe it’s neither, and it’s a final modifier! How can you tell? Unfortunately, with no dataminers stepping up to the plate to reverse engineer the damage formula again, it was back to manual testing. The most successful of these manual testers has been a Japanese group led by Japanese researcher OZY, who were able to document the Generation VII damage formula in its entirety over the course of 9 months. The OZY Warriors’ documentation is the best resource on the damage formula in modern times, and it should be the primary source for all modern damage calculators and battle simulators.
Throughout this article, I will also use other terminology that you should familiarize yourself with:
This is… Game Freak being Game Freak. Take weather, for example. If I wanted to apply a weather boost from Rain on a Water-type move, you might expect that we’d multiply by 1.5x and round in some fashion. Maybe multiplying by 3 and dividing by 2 would work just as well, or perhaps dividing the original number by 2 and adding that result back to the original number will suffice. Game Freak does none of these: instead, they multiply by 6144, and divide by 4096. So instead of multiplying by 1.5x, you’re really multiplying by 6144/4096. Now, if you plug 6144/4096 into your calculator, you’ll see that it is the exact same value as 1.5x; for the most part, it will behave the same way as doing a normal 1.5x calculation. Game Freak decided to do this for consistency across all of its modifiers. Division is much easier for computers if the divisor (the number on the bottom of the fraction) is a power of 2, and so Game Freak just picked 4096 and rolled with it for all their modifiers in the damage formula.
This means some modifiers can’t be precisely represented in fraction form under this system, though. A good example is Life Orb, which boosts damage by roughly 1.3x. Internally, this is represented as 5324/4096, which is actually 1.2998046875, slightly less than 1.3. Properly speaking, only the 5324 is actually stored; whenever a modifier is applied, it always does the same step of dividing by 4096, then pokeRounds the result. Here it is as a formula:
For the sake of readability in this article, instead of saying “apply a modifier with value 6144”, I will say “multiply the damage by 6144/4096 (1.5x), and pokeRound the result”.
Unlike the general damage modifiers, which more or less get applied sequentially, one after the other, the attack, defense, base power, and final modifiers all undergo a “chaining” process, where multiple modifiers get “combined” together before being applied like we would do it in the “How Modifiers Are Stored” section.
For every modifier you have that needs to be chained, follow this formula:
Where:
This was one of the most confusing parts of the damage formula for me to understand personally, and I would encourage you to check out the examples when we get to our sections that use chained modifiers to help with comprehension. Again, for the sake of readability in this article, instead of saying “add 5324 to the list of modifiers to be chained”, I will say “multiply by 5324/4096”. See this proof of concept as a demonstration that normal rounding is used when chaining modifiers, as opposed to pokeRounding or flooring.
In a very broad sense, this is how damage calculation is done:
When reading, these sections can mostly be tackled in any order, and you can click on the links above to jump around to whatever interests you the most. If you’re new to damage calculation, I recommend you start with the base damage and go through general damage modifiers, then final damage modifiers (basically, do 5-7 first, then come back to 1-4).
In addition to the above, the following topics will also be covered:
The most impactful part of the damage formula is for what’s known as “base damage”. Here’s the formula for calculating base damage:
Where:
If you think this is daunting already, you’re in for a wild ride! The damage formula only gets more complex from here. To help you understand what’s going on, I’ve provided examples as we go along.
Calculate the base damage for 4 Atk (136 Attack stat) Incineroar’s U-turn vs. 76 Def (100 Defense stat) Amoonguss . To start off, plug in our values for level, base power, Attack, and Defense:
To tackle solving this, we need to work from the innermost floor to the outermost floor. Generally speaking, since we’re dealing with level 50 battles for VGC, the level portion is always going to evaluate to 22 for our purposes. Floor[(2*50 / 5) + 2] = Floor[(100 / 5) + 2] = Floor(20+2) = 22. First floor taken care of.
Floor(22*70*136/100) = Floor(2094.4). Remember that floor means to truncate/”chop off” the decimal, so this becomes 2094.
Floor(2094/50) = Floor(41.88). Like before, flooring means we truncate the decimal, so Floor(41.88) = 41. 41+2 = 43. This means we have found the base damage for this Incineroar’s U-turn against this Amoonguss: 43!
Previously, we were calculating the base damage. When I speak about damage in the upcoming sections, I’m referring to this initial base damage. These steps are applied in this order for general damage modifiers, one after another.
If the move is targeting more than one Pokémon on the field, multiply the damage by 3072/4096 (0.75x), and pokeRound the result. Having multiple targets is independent of accuracy checks, whether or not a Pokémon used Protect, or if it could dodge the move via other means (such as Sky Drop, Levitate, Telepathy, etc.). A Pokémon that has fainted is NOT a target.
Examples:
If the battle is a Battle Royal and meets the “targeting more than one Pokémon on the field” condition, instead multiply the damage by 2048/4096 (0.5x), and pokeRound the result.
If this was the second hit of an move because of Parental Bond, multiply the damage by 1024/4096 (0.25x), and pokeRound the result.
If the weather is Harsh Sunlight (e.g. from Drought) or Extremely Harsh Sunlight (from Desolate Land):
If the weather is Rain (e.g. from Drizzle) or Heavy Rain (from Primordial Sea):
Strong Winds (from Mega Rayquaza’s Delta Stream) do not apply a weather modifier. Rather, Strong Winds fundamentally changes type matchups, so an Electric-type move targeting Dragon/Flying Mega Rayquaza will literally be “not very effective”.
The exact multiplier for critical hits is currently unknown. Critical hits are for sure not 6144/4096, but it is difficult to prove mathematically what it should be. Multiplying by 3/2 and pokeRounding the result should work fine. The odds of getting a critical hit are dependent on the critical hit ratio:
Stage | Probability | Fraction equivalent |
---|---|---|
+0 | ~4.167% | 1/24 |
+1 | 12.5% | 1/8 |
+2 | 50% | 1/2 |
+3 | 100% | 1/1 (Always) |
The following can increase the critical hit ratio:
If the defender has the Ability Battle Armor or Shell Armor, or the defender’s team is protected by Lucky Chant, then critical hit checks are bypassed. If the move used is Storm Throw or Frost Breath, the attacker’s previous action was Laser Focus, or the attacker’s Ability is Merciless and the defender is poisoned, the move will land a critical hit, unless the defender is protected by one of the aforementioned effects. Sniper’s bonus 1.5x boost is applied later, in the final modifiers.
The current damage is multiplied by a randomly generated number from 85 to 100, inclusive, then divided by 100, and finally the result is floored. As a formula, this is represented by the following:
Where:
This will give you 16 different possible damage rolls. The random factor is, as the name implies, generated through the game’s battle RNG. You will only use 1 Random Factor per move, and each hit of a multi-strike move has a new Random Factor generated that is independent of the Random Factor of the previous hit. This is why Mega Kangaskhan’s second hit does not do exactly one-quarter of the damage of the first hit, and it’s why Icicle Spear doesn’t deal the same amount of damage for all five hits.
At this point, the game just picks one of these 16 values to use. For the purposes of damage calculators, all 16 possible damage rolls are considered, and all 16 possible damage rolls will need to have the remaining modifiers applied to them individually. For our purposes when calculating by hand, we’ll usually just look at the minimum and maximum damage rolls to get a range of damage.
If the move being used matches the type of the Pokémon using the move, multiply the damage by 6144/4096 (1.5x) and pokeRound the result. If the Pokémon using the STAB move has the Ability Adaptability, instead multiply all damage rolls by 8192/4096 (2x) and pokeRound the result.
Determine the type effectiveness of a move via the type chart. An example type chart can be found on Bulbapedia. Properly speaking, the type modifier is just a bitshift of 1, 2, or 3 left or right, which is equivalent to multiplying or dividing by 2, 4, or 8 depending on the effectiveness and flooring the result. It is not scaled to a /4096. Thanks to Forest’s Curse and Trick-or-Treat, it is possible as a result for the type effectiveness modifier to be 0.125x-8x instead of the normal 0.25x-4x like in previous generations.
I consider “type matchups” to be the interaction between particular types (e.g. Electric is super effective vs. Water-types), while the type effectiveness modifier is the end result (e.g. Electric is 4x vs. Water/Flying type). These can affect both type matchups and the type effectiveness modifier, and generally follow this order:
If the attacker is burned and the move uses physical Attack, multiply the damage by 2048/4096 (0.5x), and pokeRound the result. If the attacker’s Ability is Guts or the attacker’s move is Facade, do not apply the Burn modifier (but don’t do anything else; Guts is an attack modifier, and Facade is a base power modifier).
After chaining together final modifiers, multiply the damage by the final modifier / 4096, and pokeRound the result. If there are no final modifiers, multiply by 4096/4096 (1x), and pokeRound the result. See the section on final modifiers for more information.
If the move is a Z-Move and the defender is protected by Protect, Detect, King’s Shield, Spiky Shield, Baneful Bunker, or Mat Block, the Z-Move is priority and the defender is protected by Quick Guard, or the move is Clangorous Soulblaze and the defender is protected by Wide Guard, multiply the damage by 1024/4096 (0.25x) and pokeRound the result. You can’t have this multiplier be applied multiple times (e.g. Clangorous Soulblaze into Wide Guard and Protect will still multiply damage by 0.25x, not 0.0625x).
If the damage is 0, make it 1.
If the damage is greater than 65,535, make it the the current damage modulo 65,536 (damage % 65536). So for example, a move that would deal 65,638 damage before this check would only deal 102 damage after this check (65,638 % 65,536 = 102), and a move that would deal 131,085 damage before this check would only deal 13 damage after this check (131,085 % 65,536 = 13). This means it is still possible to do 0 damage, given that you have an move that deals a multiple of 65,536 damage. See this proof of concept of being able to deal 0 damage in Generation 7.
Once you’re done with step 12, this is the damage that is actually dealt to the defender. However, if you would deal more damage to a defender than its current HP is at, it will only deal the damage necessary to reduce the target’s HP to 0. For example, if the damage calculated by the damage formula is going be 300, but the defender only has 200 HP remaining, the move will only deal 200 damage.
Calculate the minimum and maximum damage of a 252+ Sp. Atk Primal Kyogre’s full HP Water Spout vs 252+ Sp. Def Amoonguss, in Rain, and as a spread move in a Double Battle.
Let’s see what modifiers will apply in this damage calculation:
Before we begin with general damage modifiers, though, we have to determine the base damage. Primal Kyogre’s Special Attack is 255 for this calculation, Water Spout is 150 base power, and Amoonguss has 145 Special Defense. This example doesn’t have any modifiers to Special Attack, base power, or Special Defense in its calculation. Remember, since we’re working with level 50 Pokémon in VGC, the level calculation always comes out to be 22. Let’s plug in our numbers for the base damage.
Floor(5803/50) + 2 = Floor(116.06) +2. Chopping off the decimal, Floor(116.06) + 2 = 116 + 2 = 118. So 118 is our base damage for this calculation. Now let’s apply our modifiers, in order:
For our purposes, rather than calculate all 16 damage rolls, we’ll just calculate the minimum and maximum damage rolls for the Water Spout. Let’s start with the minimum damage; recall that the minimum damage will occur when the random factor has a value of 15.
So 112 is our minimum damage. The maximum damage is much easier to find: the maximum damage roll is the same as Current Damage, because the Random Factor is 0, and anything multiplied by 100 then divided by 100 will not change its value. In this case, our maximum damage is 132, giving us a range of 112-132 damage.
There are no modifiers left to apply, so this is the damage Water Spout will do to Amoonguss: 84-99. If you check this result against a damage calculator using proper Generation 7 modifier order, you’ll see this matches what the damage calculator gives:
Final modifiers are chained together in this order, and the end result is applied in step 9 of the general damage modifiers.
If it is a Double Battle or a Battle Royal, the modifier is 2732/4096 (0.6669921875x); if in a Single Battle, the modifier is 2048/4096 (0.5x). The game does not check whether or not the move is single-target for the purposes of screens checks, only what format the battle is in. As a result, it is possible to have a single-target spread move affected by the Doubles screens modifier at the same time. If the move was a critical hit or the attacker’s Ability was Infiltrator, skip this modifier.
So Psyshock, Psystrike, and Secret Sword are all weakened by Light Screen, not Reflect. The duration of Aurora Veil and a regular screen can overlap, but their effects combined do not stack (i.e. you can’t get a double reduction from Aurora Veil and Reflect; it’ll only apply the screen modifier once).
n | Modifier | Decimal equivalent |
---|---|---|
1 | 4915/4096 | 1.199951171875 |
2 | 5734/4096 | 1.39990234375 |
3 | 6553/4096 | 1.599853515625 |
4 | 7372/4096 | 1.7998046875 |
5 or greater | 8192/4096 | 2 |
Calculate the value of the final modifiers for a Life Orb Mega Rayquaza’s Dragon Ascent into a Lunala with Shadow Shield, Reflect, and Friend Guard active.
Let’s start by looking at how final modifiers are chained together. We have four final modifiers: Reflect, Shadow Shield, Friend Guard, and Life Orb.
Always start with 4096 as our first OldCombinedModifier. The first final modifier we have is Reflect (2732).
Which evaluates to 2732. Next, we plug in 2732 as our old modifier, and chain the second final modifier in the list, Shadow Shield (2048).
This evaluates to 1366. Continuing, we apply Friend Guard (3072).
Finally, we have something significant! (1366 * 3072) / 4096 = 1024.5, which means normal rounding practices apply. So rather than round down like we do in pokeRounding, we round up on 0.5 to 1025. Given 1025, we apply our last modifier: Life Orb (5324).
This evaluates to NormalRound(1332.299…), which will normal round down to 1332. This makes 1332 our final modifier that we would use in step 9 of damage calculation.
Given a 232 Attack Mega Rayquaza using a 120 base power Dragon Ascent vs. a Lunala at full HP with 109 Defense, our base damage will be 114. Our minimum and maximum damage rolls will be 96-114. Applying STAB gets us to 144-171. Now, at the final modifier (step 9 of the general damage modifiers):
As you can see, 47-56 is the damage we get from the damage calculator.
There isn’t any particular order that needs to be followed for this one, since we’re only dealing with individual moves here. As a result, I’ll be grouping moves that behave similarly together to break up the sections a bit more. All of these moves have an internal default base power, which is normally unused; however, the default base power does get used when the move is affected by the Rollout Storage glitch (more on that when we get to Rollout). If any of these moves have a base power less than 1 after their calculation is complete, make it 1 BP.
For Speed calculations, the Speed used for the attacker and the defender is the Speed after all Speed modifiers have been applied.
If the base power of Gyro Ball is greater than 150, make it 150.
Once you have determined S, use this lookup table to determine the base power.
S | Base Power |
---|---|
4 or more | 150 |
3 | 120 |
2 | 80 |
1 | 60 |
0 | 40 |
For weight calculations, the weight used for the attacker and the defender is the weight after all weight modifiers have been applied. Weight calculations are done in kilograms.
Weight (kg) | Base Power |
---|---|
x ≥ 200 | 120 |
100 ≤ x < 200 | 100 |
50 ≤ x < 100 | 80 |
25 ≤ x < 50 | 60 |
10 ≤ x < 25 | 40 |
x < 10 | 20 |
Once you have determined W, use this lookup table to determine the base power.
W | Base Power |
---|---|
5 | 120 |
4 | 100 |
3 | 80 |
2 | 60 |
Less than 2 | 40 |
Once you have determined P, use this lookup table to determine the base power.
P | Base Power |
---|---|
P > 32 | 20 |
17 ≤ P ≤ 32 | 40 |
10 ≤ P ≤ 16 | 80 |
5 ≤ P ≤ 9 | 100 |
2 ≤ P ≤ 4 | 150 |
P ≤ 1 | 200 |
The reason this formula is so wildly different is because the game computes the defender’s percent of HP by using a fixed point division with 4096 as the scaling factor. If that doesn’t make any sense to you, you’re in good company.
Happiness is a value that corresponds from 0-255. Details on happiness can be found on Bulbapedia. Of note, Ditto / Smeargle do not copy happiness on Transform, so it is important to max out happiness on Ditto / Smeargle if they want maximum gains from Return, or reduce happiness to 0 for optimal Frustration damage.
A Smeargle or Ditto at base happiness (e.g. from a trade placed directly in the box) will have 28 BP when using Return.
A Smeargle or Ditto at base happiness (e.g. from a trade placed directly in the box) will have 74 BP when using Frustration.
Where Counter is the number of times Fury Cutter has been used successfully and consecutively, with a maximum of 2.
Where DefaultBP is the default BP of the move (30 in the case of Rollout / Ice Ball), Counter is the number of times Rollout / Ice Ball has been used successfully and consecutively, with a maximum of 4, and Defense Curl equals if 1 the attacker used Defense Curl at any time before Rollout / Ice Ball was used, and 0 otherwise. The maximum multiplier without Defense Curl is 16x, while the maximum multiplier with Defense Curl is 32x.
Rollout Storage is a glitch that allows the Rollout / Ice Ball multiplier to apply to any move (when I refer to “Rollout” from here on out, know that it all applies to Ice Ball as well). When Rollout breaks a Disguise, the Rollout counter increases by 1 for the purposes of keeping the attacker locked into Rollout, but Counter does not similarly increment. If Rollout breaks the Disguise of multiple Mimikyu, the multiplier will be delayed for each time Disguise is broken.
Example of Rollout Storage with no Defense Curl, and using Thunderbolt afterwards:
Rollout 1: 30 * 2^(0+0) = 30 BP
Rollout 2: 30 * 2^(1+0) = 60 BP
Rollout 3: Disguise
Rollout 4: 30 * 2^(2+0) = 120 BP
Rollout 5: 30 * 2^(3+0) = 240 BP (Rollout lock is canceled; you can now choose a new move)
Thunderbolt: 90 * 2^(4+0) = 1440 BP
Rollout Storage will stay active until some damaging move that uses the damage formula consumes the glitch (e.g. Seismic Toss, Swords Dance, Protect, or Super Fang won’t “use up” Rollout Storage). If the Rollout Storage-boosted move is a move with custom BP, multiply the Rollout Storage by the default BP, and do not undergo its normal calculation (e.g. a Rollout Storage-boosted Grass Knot with Defense Curl will always have 1 * 32 = 32 BP). If the next move is a multi-hit move, Rollout Storage only applies to the first strike of the multi-hit move. Similarly, if the move is a spread move, only apply Rollout Storage to the first target the spread move hits (first ally, then opponent’s left slot, then opponent’s right slot). Being affected by Rollout Storage is not something copied by Transform.
Stat boosts that affect the base power for these moves include any +1 to +6 boosts to Attack, Defense, Special Attack, Special Defense, Speed, accuracy, or evasion. Negative stat drops will not affect these moves (e.g. a Pokémon with +6 Special Attack and -6 Attack would have a 120 Stored Power).
Where Attacker Stat Boosts are the sum of the attacker’s positive stat increases. There is no internal cap, but the maximum base power will be (20 + 20 * (6 * 7 stats)) = 860 BP.
Where Defender Stat Boosts are the sum of the defender’s positive stat increases. If the base power is greater than 200, make it 200.
Where Base Attack is the literal base Attack of the Pokémon, not its attack stat after modifiers. For example, Jolly 252 Atk EVs Garchomp’s Base Attack for the purposes of Beat Up is 130, not 182.
Number of Times | Base Power |
---|---|
1 | 40 |
2 | 80 |
3 | 120 |
4 | 160 |
5 or more | 200 |
n | Magnitude Strength | Factor |
---|---|---|
n < 5 | 4 | 0 |
5 ≤ n < 15 | 5 | 1 |
15 ≤ n < 35 | 6 | 2 |
35 ≤ n < 65 | 7 | 3 |
65 ≤ n < 85 | 8 | 4 |
85 ≤ n < 95 | 9 | 5 |
n ≥ 95 | 10 | 6 |
Once you have Factor, the base power for Magnitude is determined by this formula:
PP Remaining | Base Power |
---|---|
4 or more | 40 |
3 | 50 |
2 | 60 |
1 | 80 |
0 | 200 |
If Trump Card is called via a move that calls another move (e.g. Metronome, Sleep Talk), the base power will be determined with respect to how much PP the move that calls another move will have after usage.
If the move has custom BP, evaluate its base power first; otherwise, use the regular base power of the move (what is listed in the summary screen). Base power modifiers are chained together in this order, and the end result is applied to the starting base power before being used in the base damage formula.
Apply the chained modifier to the starting base power. That is, multiply the starting base power by the chained base power modifiers, divide by 4096, and pokeRound the result. If the base power would now be less than 1, make it 1. Finally, if the base power is greater than 65,535, make it the the current base power modulo 65,536 (BP % 65536).
Calculate the final base power for a Tapu Koko with 214 happiness that uses Return, affected by the effect of Electrify. Tapu Koko is holding a Zap Plate, and on the previous turn, it had used Charge. Both Mud Sport and Electric Terrain are active on the field, and Tapu Koko is being assisted with one Helping Hand.
To start off, Return is a move with custom base power, so we need to determine that first before we get into chaining modifiers.
Plugging in our 214 for Happiness, we get this: Floor[(214*10)/25] = Floor(2140/25) = Floor(85.6) = 85. So Return has a starting 85 BP. Next, let’s list our BP modifiers that will be applied, in the order they will be applied:
Always start with 4096 as our first OldCombinedModifier. The first BP modifier we have is Zap Plate (4915).
Which evaluates to 4915. Next, we plug in 4915 as our old modifier, and Helping Hand (6144) as our next BP modifier.
This evaluates to 7372.5. Remember, chained modifiers use normal rounding, so this rounds up to 7373. Our next BP modifier is Charge (8192).
This comes out to be an even 14746. Next up is Electric Terrain (6144).
This calculation also evaluates to a nice, even number: 22119. Our last BP modifier to apply is Mud Sport (1352).
This final calculation evaluates to a much messier 7300.998046875, which is normal rounded up to 7301. Finally, we will take our starting BP (85) and apply a modifier of 7301. That is,
Which evaluates to pokeRound(151.510009765625), which pokeRounds up to 152. So our final base power for this damage calculation is 152 BP. You can see me work out this example on cartridge in this proof of concept video.
Throughout this section, I will be referring to the starting attack (Attack or Special Attack) of a Pokémon. I don’t mean the literal base stat of the Pokémon in this case—I’m referring to the number you’d see on the summary screen on cartridge. For example, a Hydreigon with 31 IVs, 252 EVs in Sp. Atk, and a Modest Nature would have a starting attack of 194, not 125.
There are still several steps that apply before we can get to chaining modifiers. Apply these effects in this order:
For example, a +1 critical hit Leaf Blade into a Pokémon with Unaware will be treated as a +0 critical hit Leaf Blade.
Stage | Fraction | Decimal |
---|---|---|
-6 | 2/8 | 0.25 |
-5 | 2/7 | ~0.2857 |
-4 | 2/6 | ~0.3333 |
-3 | 2/5 | 0.4 |
-2 | 2/4 | 0.5 |
-1 | 2/3 | ~0.667 |
0 | 2/2 | 1 |
1 | 3/2 | 1.5 |
2 | 4/2 | 2 |
3 | 5/2 | 2.5 |
4 | 6/2 | 3 |
5 | 7/2 | 3.5 |
6 | 8/2 | 4 |
If the starting attack stat multiplied by the numerator of the attack boosts/drops fraction is greater than 65,535, make it the attack modulo 65,536 (attack % 65536). (Note: It is only possible to get an attack stat this high with hacking.)
Next, the remaining attack modifiers are chained together in this order, and the end result is applied to the starting attack before being used in the base damage formula.
Apply the chained modifier to the current attack. That is, multiply the current attack by the chained attack modifiers, divide by 4096, and pokeRound the result. If the current attack would now be less than 1, make it 1. Finally, if the attack is greater than 65,535, make it the attack modulo 65,536 (attack % 65536).
Calculate the final Special Attack of a Chandelure with max Special Attack investment that uses Overheat against a Thick Fat Mamoswine . Chandelure is currently at -2 Sp. Atk, Chandelure has an active Flash Fire due to being hit by a Fire-type move previously, and Chandelure has a starting 216 Special Attack stat.
Starting with the boosts/drops, we multiply 216 by 2/4. Floor(216*2/4) = 108. Next, we will apply our two attack modifiers: Flash Fire, then Thick Fat.
Always start with 4096 as our first OldCombinedModifier. The first BP modifier we have is Flash Fire (6144).
Which evaluates to 6144. Our next modifier is Thick Fat (2048).
This comes out to be an even 3072. So, take our starting Special Attack of 108 and apply a modifier of 3072.
This becomes a nice, even 81 final Sp. Atk.
Calculating defense is very similar to calculating attack, except there are less modifiers for defense than there are for attack.
For example, a critical hit Sacred Sword at -1 Defense is treated as a critical hit Sacred Sword at +0 Defense.
Stage | Fraction | Decimal |
---|---|---|
-6 | 2/8 | 0.25 |
-5 | 2/7 | ~0.2857 |
-4 | 2/6 | ~0.3333 |
-3 | 2/5 | 0.4 |
-2 | 2/4 | 0.5 |
-1 | 2/3 | ~0.667 |
0 | 2/2 | 1 |
1 | 3/2 | 1.5 |
2 | 4/2 | 2 |
3 | 5/2 | 2.5 |
4 | 6/2 | 3 |
5 | 7/2 | 3.5 |
6 | 8/2 | 4 |
If the starting defense stat multiplied by the numerator of the defense boosts/drops fraction is greater than 65,535, make it the defense modulo 65,536 (defense % 65536). (Note: It is only possible to get a defense stat this high with hacking.)
Next, the remaining defense modifiers are chained together in this order, and the end result is applied to the starting defense before being used in the base damage formula.
Apply the chained modifier to the starting defense. That is, multiply the starting defense by the chained defense modifiers, divide by 4096, and pokeRound the result. If the current defense would now be less than 1, make it 1. Finally, if the defense is greater than 65,535, make it the defense modulo 65,536 (defense % 65536). If the defense stat is 0 because of this modifier, the result of base damage will always be 2.
Calculate the Special Defense stat of a Tyranitar in Sand, holding an Assault Vest, and at +1 Sp. Def, with a 121 starting Special Defense stat.
First, we’ll apply the +1 Sp. Def: Floor(121*3/2) = Floor(181.5) = 181. Next, we’ll apply the boost from Sandstorm: pokeRound(181*6144/4096) = pokeRound(271.5) = 271.
Although Assault Vest is technically a defense modifier that needs to be chained, since it’s the only modifier we have for this calculation, it’s mathematically equivalent to just apply it directly. pokeRound(271*6144/4096) = pokeRound(406.5) = 406.
So this Tyranitar has a 406 starting Special Defense stat. If we had just multiplied all these variables to Tyranitar’s Special Defense all at once, we would have instead figured its Special Defense to be (121*1.5*1.5*1.5) = 408.375, which would become 408. But 406 and 408 are definitely different values! This examples underscores the point to make sure you round in exactly the same way that the game does, or these rounding errors will pop up.
Speed modifiers are applied not only for the purposes of turn order, but also for calculations with Gyro Ball and Electro Ball. Our current knowledge on how Speed modifiers work is actually based largely on my own personal research on the subject!
Speed modifiers were never datamined, instead only empirically derived. It is impossible to demonstrate if Speed modifiers are actually chained like attack or defense through tests on cartridge; see this pastebin for justification why. Nevertheless, it is highly likely that they do follow the same conventions we’re used to by now with chaining modifiers, so for the sake of this article, I will assume Speed modifiers are being chained.
Begin with the starting Speed of the Pokémon. Then, apply these effects in this order:
Stage | Fraction | Decimal |
---|---|---|
-6 | 2/8 | 0.25 |
-5 | 2/7 | ~0.2857 |
-4 | 2/6 | ~0.3333 |
-3 | 2/5 | 0.4 |
-2 | 2/4 | 0.5 |
-1 | 2/3 | ~0.667 |
0 | 2/2 | 1 |
1 | 3/2 | 1.5 |
2 | 4/2 | 2 |
3 | 5/2 | 2.5 |
4 | 6/2 | 3 |
5 | 7/2 | 3.5 |
6 | 8/2 | 4 |
If the starting Speed stat multiplied by the numerator of the Speed boosts/drops fraction is greater than 65,535, make it the speed modulo 65,536 (Speed % 65536). (Note: It is only possible to get a Speed stat this high with hacking.)
Note that Unaware does not ignore Speed boosts/drops for the purposes of Gyro Ball / Electro Ball. Next, the remaining speed modifiers are chained together in this order, and the end result is applied to the starting speed before being used in calculating turn order, Gyro Ball, or Electro Ball:
Apply the chained modifier to the starting speed. That is, multiply the starting speed by the chained speed modifiers, divide by 4096, and pokeRound the result. Next,
There is no 1 Speed check. If the speed is greater than 65,535, make it the speed modulo 65,536 (Speed % 65536). Next, if the Speed is greater than 10,000, make it 10,000. Speed calculations stop here for the purposes of Gyro Ball / Electro Ball.
For the purposes of turn order (which isn’t relevant to damage calculation, but still interesting), apply the following steps:
This will be the Speed stat used for the purposes of turn order.
Calculate the Speed of a Landorus-T that holds a Choice Scarf, has a -1 Speed drop, and has a 143 starting Speed stat.
Landorus-T’s starting Speed stat is 143. First, we need to apply the -1 Speed stat. Floor(143 * 2/3) = Floor(95.3333) = 95.
Next, we apply Speed modifiers. In this case, all we have is Choice Scarf. pokeRound(95 * 6144/4096) = pokeRound(142.5) = 142. So -1 Scarf Landorus-T is 142 Speed stat. As you can see, Choice Scarf and the -1 Speed drop don’t “cancel each other out”, because of the different rounding methods used at each step.
Weight modifiers are applied when calculating the base power of Low Kick / Grass Knot or of Heavy Slam / Heat Crash, or determining if a target can be picked up via Sky Drop. The dust and sound effect played when a Pokémon enters a battle is determined by weight, but weight modifiers do not apply for determining the size of the dust cloud or pitch of the sound. The game stores weight internally as kilograms. Weight modifiers were researched by SadisticMystic.
Beginning with the base weight, apply these effects in order:
This will be the ending weight used for the purposes of Low Kick / Grass Knot or Heavy Slam / Heat Crash. If the weight is less than 200 kg, the defender can be picked up with Sky Drop.
The following moves do not determine their damage by calling the damage formula, instead by other means. They still respect type effectiveness (e.g. a Super Fang cannot hit Ghost-types, and Mirror Coat can’t hit Dark-types). There isn’t any particular order that needs to be followed for this one, since we’re only dealing with individual moves here. As a result, I’ll be grouping moves that behave similarly together to break up the sections a bit more.
Counterattacks – If multiple moves hit the user of a counterattack this turn, these counterattacks will target the Pokémon that most recently damaged the user of a counterattack (this includes being able to counterattack allies).
Moves dependent on the defender’s HP – If the defender has a Substitute, use the HP of the Pokémon itself to determine the damage of these moves, not the HP of the Substitute. If the damage would be less than 1, make it 1.
Moves dependent on the attacker’s HP
Set-damage moves
Other
At level 50, Psywave’s damage will always be 25-75. At level 100, Psywave’s damage will always be 50-150. Psywave’s minimum damage is 1.
So far, we’ve surveyed one type of damage overflow: the 65,535 check on damage in the general damage modifiers. We also saw that base power, attack, and defense must also conform to this 65,535 maximum, or else risk overflowing back down to smaller numbers. To review, if a move would exceed 65,535 damage, then the game will take the damage and apply a modulo of 65536 (damage % 65536). So for example, if a move was going to deal 65,539 damage, it would only actually do (65,539 % 65,536) = 3 damage. Again, if a move would deal 196,621 damage, it would only actually do (196,622 % 65,536) = 14 damage. This sort of damage overflow is actually explicitly defined by the game: it is doing this kind of “overflow” on purpose. However, there is another kind of overflow that is not explicitly defined by the game, and is instead a result of the limitations of the 3DS itself.
The 3DS does its math for damage calculation using an ARM11 processor, which came out back in 2005. According to its documentation, it uses exclusively 32-bit registers (see section 2.8 of the linked documentation). In computing, numbers are represented internally as “1’s and 0’s”; these are called bits. Having 32-bit registers means you can handle 32 “1’s and 0’s” for each calculation. Because there are two possible combinations for each number, the largest number possible with 32 bits is going to be 2^32 – 1 (4,294,967,295). It’s 2^32 because there are two possibilities and 32 bits; it’s -1 because we include 0 as a number we can represent.
Normally, it’d be astronomically difficult to reach such a high amount of damage. Prior to the discovery of Rollout Storage, speculation about the maximum damage in Pokémon couldn’t even cross into the 1.5 billion range (never mind they got the mechanics wrong, so it was even less than what was speculated in this Reddit thread). However, with the discovery of Rollout Storage came an additional 32x multiplier to play with on any move you wanted, and estimates of maximum damage soared to 20.6 billion as a result. The discovery of Rollout storage was before we knew about either 32-bit overflow or 16-bit (65,535) overflow, but this prompted battle mechanics researcher SadisticMystic to undergo a series of tests to document it.
Remember how, all throughout this guide, I listed modifiers as being out of 4096? This one of the places where 32-bit damage overflow can come into play. Take weather as an example: if the weather is Rain and the move is Water-type, we multiply by 6144 and divide by 4096. 6144 is much bigger than something like 3/2! It means we only need to have a prior damage of 699,051 in order to achieve 32-bit damage overflow. 699,051 is still pretty large, but it’s not even in the millions, so it’s very reasonable to hit with some prior setup.
To clarify, let’s see an example if we had 699,080 damage prior to weather:
So because of damage overflow and how modifiers are represented, we could say 699,080 times “1.5” equals 44.
According to research from SadisticMystic, these are the known places in the damage formula where 32-bit overflow is possible (it should apply to every calculation, in general, but these are where it has specifically been proven):
For a proof of concept along with a walkthrough of the math used to arrive at damage overflow for a particular calculation, see SadisticMystic’s video or my collaboration with Wolfey.
Since damage caps at 65,535, it is much easier to engineer setups that deal maximum damage. Consider this one-turn setup:
With these 4 Pokémon, you can set up maximum damage on turn 1:
Let’s review why this works! Starting with our variables for base damage, we have level, BP, Attack, and Defense:
Plugging in our variables to the base damage formula, we get this:
And 65533 + 2 = 65535. With that in place, there are no other modifiers to affect this setup except the random damage roll. However, recall that if the move hits the maximum damage roll, its value will not change (because multiplying and then dividing by 100 will not change its value, and we’re nowhere near the 32-bit cutoff for that to change here).
Hitting this particular damage roll will only occur 1/16 of the time, but consider that we just achieved the maximum amount of damage in Pokémon without even using the highest attack stat in the game and just a measly 92 BP! Very peculiar stuff. I’m sure there are setups for max damage that can also be done on the first turn in single battles. If you manage to find one that works 1/16 of the time or better, let me know by tweeting at my Twitter account.
While not practical to understand for the average VGC match, a general knowledge of the damage formula can be useful for explaining certain phenomena and analyzing trends in your damage calcs. Being familiar with how damage calculation works means that you can verify a damage calculator is working the way it’s supposed to be working, and help contribute when inconsistencies arise between cartridge and calculator. Lastly, I think it’s fun to explore the inner workings of the game; understanding the math behind the damage formula can be challenging, but I think it’s interesting and cool to work out the exact damage a move would actually do in-game on paper. I’d like to give a special shoutout to SadisticMystic, who was extremely resourceful and helpful with answering technical questions about the damage formula throughout the past few months. If you made it this far, thanks for reading! I hope you enjoyed.