User:FIQ/Damage calculation

TODO: clean up page

Mirror of damage calculation page for https://www.trainertower.com/dawoblefets-damage-dissertation/

SwSh addendum: Technician is now the first BP modifier, meaning Auras no longer interfere with Technician boosts.


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?

Background Information 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?

Basic Terms 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.

Normal rounding, like you’d learn in school. If the number has a decimal of 0.5 or higher, round up to the nearest whole number; if less than 0.5, round down. So round(30.2) = 30, round(30.5) = 31, and round(30.7) = 31. A technique known as “pokeRounding“, where Game Freak decided to round down on 0.5. If the number has a decimal of higher than 0.5, round up to the nearest whole number; if the decimal is less than or equal to 0.5, round down. So pokeRound(30.2) = 30, pokeRound(30.5) = 30, and pokeRound(30.7) = 31. Truncation/flooring, where the decimal part of the number is completely ignored. You can think of it like “chopping off” the decimal. So floor(30.2) = 30, floor(30.5) = 30, and floor(30.7) = 30. 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:

Attacker: the Pokémon using the move Defender: the Pokémon that is the target of the attacker attack: will always refer to either Attack/Sp. Atk (depending on context). If I use Attack with a capital A, I’m referring to literally physical Attack. Move is reserved for Pokémon moves. defense: will always refer to either Defense/Sp. Def (depending on context). If I use Defense with a capital D, I’m referring to literally physical Defense. How Modifiers Are Stored 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:

New Value = pokeRound\left (\frac{Old Value \times Modifier}{4096} \right )

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”.

Chaining Modifiers 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:

\small CombinedModifier = NormalRound(\frac{OldCombinedModifier \times NextModifier}{4096})

Where:

NormalRound = do normal school rounding (round up on 0.5) OldCombinedModifier = the result of the previous modifier chaining calculation. If this is the first modifier being chained, OldCombinedModifier is 4096. NextModifier = the next modifier you have to chain. 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.

The Damage Formula In a very broad sense, this is how damage calculation is done:

Custom BP: Determining the base power of moves that don’t have a fixed base power, like Heavy Slam or Eruption. BP modifiers: Applying modifiers like Terrains, Auras, Helping Hand, etc. Attack modifiers: Applying modifiers like boosts/drops, Choice Band, Water Bubble, etc. Defense modifiers: Applying modifiers like boosts/drops, Fur Coat, Eviolite, etc. Base Damage: The initial “big calculation”, combining base power, attack, and defense. General damage modifiers: Applying modifiers like weather, type effectiveness, STAB, etc. Final damage modifiers: Applying modifiers like Life Orb, screens, Friend Guard, etc. 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:

Speed modifiers: Applying modifiers like boosts/drops, Tailwind, Choice Scarf, etc. Weight modifiers: Applying modifiers like Heavy Metal, Float Stone, etc. Special cases: Moves like Psywave or Guardian of Alola that calculate their damage in other ways. Damage overflow: How limitations of 3DS hardware affects damage calculation. A one-turn setup for maximum damage: How to get the maximum damage in Pokémon in a single turn. Base Damage The most impactful part of the damage formula is for what’s known as “base damage”. Here’s the formula for calculating base damage:

Base Damage = Floor\left \lfloor \frac{Floor\left \lfloor \frac{Floor\left \lfloor \frac{2 \times Level}{5} + 2 \right \rfloor \times Base Power \times Attack}{Defense} \right \rfloor}{50}\right \rfloor + 2

Where:

Floor = truncating the decimal Level = the Pokémon’s actual level Base Power = the base power of a move, after the base power modifiers have been applied Attack = the attacking Pokémon’s Attack or Special Attack stat, after the attack modifiers have been applied Defense = the defending Pokémon’s Defense or Special Defense stat, after the defense modifiers have been applied 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.

Example 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:

Base Damage = Floor\left \lfloor \frac{Floor\left \lfloor \frac{Floor\left \lfloor \frac{2 \times 50}{5} + 2 \right \rfloor \times 70 \times 136}{100} \right \rfloor}{50}\right \rfloor + 2

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.

Base Damage = Floor\left \lfloor \frac{Floor\left \lfloor \frac{22 \times 70 \times 136}{100} \right \rfloor}{50}\right \rfloor + 2

Floor(22*70*136/100) = Floor(2094.4). Remember that floor means to truncate/”chop off” the decimal, so this becomes 2094.

Base Damage = Floor\left \lfloor \frac{2094}{50}\right \rfloor + 2

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!

back to top

General Damage Modifiers 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.

1) Spread Move Modifier 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:

You have a Garchomp and a Tornadus versus an opponent’s solo Ferrothorn. Earthquake would have the spread move modifier applied. You have a Garchomp against the opponent’s Charizard and Ferrothorn. Earthquake would have the spread move modifier applied. If you use Rock Slide while Charizard uses Protect, the spread move modifier is applied when calculating Rock Slide’s damage against Ferrothorn. You have a Garchomp and a Life Orb Tapu Koko against the opponent’s Tapu Fini and Ferrothorn. Suppose Tapu Koko uses Thunderbolt, knocking out Tapu Fini, but Tapu Koko also faints from Life Orb recoil. This leaves just Garchomp against Ferrothorn, and the spread move modifier is NOT applied for Earthquake, because only Garchomp and Ferrothorn are left on the field, so Earthquake deals the full damage. 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.

2) Parental Bond Modifier 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.

3) Weather Modifier If the weather is Harsh Sunlight (e.g. from Drought) or Extremely Harsh Sunlight (from Desolate Land):

If the move is Fire-type, multiply the damage by 6144/4096 (1.5x), and pokeRound the result. If the move is Water-type, multiply the damage by 2048/4096 (0.5x), and pokeRound the result. If the weather is Rain (e.g. from Drizzle) or Heavy Rain (from Primordial Sea):

If the move is Water-type, multiply the damage by 6144/4096 (1.5x), and pokeRound the result. If the move is Fire-type, multiply the damage by 2048/4096 (0.5x), and pokeRound the result. 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”.

4) Critical Hit Modifier 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:

Using a move that has increased critical hit ratio: +1 Holding a Scope Lens or Razor Claw: +1 Having Super Luck as an Ability: +1 Using 10,000,000 Volt Thunderbolt: +2 Holding Stick or Lucky Punch if the Pokémon is Farfetch’d or Chansey, respectively: +2 Using Focus Energy, Z-Foresight, Z-Sleep Talk, Z-Tailwind, Z-Acupressure, Z-Heart Swap, or eating a Lansat Berry: +2 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.

5) Random Factor Modifier 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:

Damage = Floor\left \lfloor \frac{Current Damage \times \left ( 100 - Random Factor \right )}{100} \right \rfloor

Where:

Floor = truncating the decimal Current Damage = the damage after the most recent modifier (if no modifiers have applied, then the base damage) Random Factor = any whole number between 0 ≤ Random Factor ≤ 15 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.

6) Same-Type Attack Bonus (STAB) Modifier 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.

7) Type Effectiveness Modifier 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:

Iron Ball: If the move type is Ground and the defender is a non-grounded Flying-type, the entire type effectiveness modifier is 1x, regardless of the defender’s secondary type. Ring Target: If the type matchup was 0, make it 1. Thousand Arrows: If the move type is Ground and the defender is a non-grounded Flying-type, the entire type effectiveness modifier is 1x, regardless of the defender’s secondary type. Scrappy: If the move is Fighting-type or Normal-type, the type matchup versus Ghost type is 1x. Freeze-Dry: If the opposing type is Water, the type matchup is 2x. Flying Press: A secondary Flying-type type modifier is calculated and multiplied with the modifier for Flying Press’s default type against the defender. See Bulbapedia’s type chart of Flying Press for a visualization. Strong Winds: If the defender is a Flying-type and the type matchup is super-effective against Flying-type, ignore the Flying-type completely. 8) Burn Modifier 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).

9) Final Modifiers 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.

10) Z-move into Protecting Move Modifier 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).

11) One Damage Check If the damage is 0, make it 1.

12) 65,535 Damage Check 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.

Example 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:

Spread move and meets the conditions to have the damage reduction? – Yes Parental Bond? – No Weather? – Yes, Rain, 1.5x Critical hit? – No Random factor? – Yes STAB? – Yes Type effectiveness? – Yes, 1/2x Burn? – No Final modifiers? – No (there aren’t any in this example) Z-move into protect effect? – No One damage check 65535 HP cutoff check 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. Base Damage = Floor\left \lfloor \frac{Floor\left \lfloor \frac{Floor\left \lfloor \frac{2 \times Level}{5} + 2 \right \rfloor \times Base Power \times Attack}{Defense} \right \rfloor}{50}\right \rfloor + 2

Base Damage = Floor\left \lfloor \frac{Floor\left \lfloor \frac{22 \times 150 \times 255}{145} \right \rfloor}{50}\right \rfloor + 2

Base Damage = Floor\left \lfloor \frac{Floor\left \lfloor 5803.4482... \right \rfloor}{50}\right \rfloor + 2

Base Damage = Floor\left \lfloor \frac{5803}{50}\right \rfloor + 2 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:

Spread move: multiply 118 by 3072/4096, and pokeRound the result. 118*3072/4096 = 88.5, which is pokeRounded to 88. Weather: multiply 88 by 6144/4096, and pokeRound the result. 88*6144/4096 = 132, which doesn’t need to be pokeRounded in this case. Random factor: 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.

Damage = Floor\left \lfloor \frac{Current Damage \times \left ( 100 - Random Factor \right )}{100} \right \rfloor

Damage = Floor\left \lfloor \frac{132 \times \left ( 100 - 15 \right )}{100} \right \rfloor

Damage = Floor\left \lfloor 112.2 \rfloor

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.

STAB: Multiply each damage roll by 6144/4096 and pokeRound. So 112*6144/4096 = 168, and 132*6144/4096 = 198. Type effectiveness: Divide each damage roll by 2, and floor the result. So 168/2 = 84, and 198/2 = 99. 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:

252+ SpA Primal Kyogre Water Spout (150 BP) vs. 252 HP / 252+ SpD Amoonguss in Heavy Rain: 84-99 (38 – 44.7%) — guaranteed 3HKO (84, 84, 85, 87, 87, 88, 90, 90, 91, 93, 93, 94, 96, 96, 97, 99) back to top Final Modifiers Final modifiers are chained together in this order, and the end result is applied in step 9 of the general damage modifiers.

Screens 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.

Reflect: if the move is using the Attack stat; Light Screen: if the move is using the Special Attack stat; Aurora Veil: applies for moves using either the Attack or the Special Attack stat. 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).

Neuroforce – If the move was super effective, multiply by 5120/4096 (1.25x). Sniper – If the move was a critical hit, multiply by 6144/4096 (1.5x). Tinted Lens – If the move wasn’t very effective, multiply by 8192/4096 (2x). Multiscale / Shadow Shield – If the defender is at full HP, multiply by 2048/4096 (0.5x). Fluffy (contact moves) – If the move is a contact move, multiply by 2048/4096 (0.5x). Friend Guard – If an ally has Friend Guard, multiply by 3072/4096 (0.75x). Solid Rock / Filter / Prism Armor – If the move is super effective, multiply by 3072/4096 (0.75x). Metronome (item) – Multiply by the value in this table, where n is the number of times the current move was used successfully and consecutively. 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 Fluffy (Fire-type moves) – If the move is Fire-type, multiply by 8192/4096 (2x). Expert Belt – If the move is super-effective, multiply by 4915/4096 (1.199951171875x). Life Orb – Multiply by 5324/4096 (1.2998046875x). Resist Berries – If the move is super-effective and corresponds to the appropriate resist Berry, or the move is Normal-type and the Berry is Chilan Berry, multiply by 2048/4096 (0.5x). Doubled-damage moves – Multiply by 8192/4096 (2x) if one of the following conditions is met: Minimize: if the the move is Body Slam, Dragon Rush, Flying Press, Heavy Slam, Malicious Moonsault, Steamroller, or Stomp; Dig: if the defender is underground from Dig and the move is Earthquake; Dive: if the defender is underwater from Dive and the move is Surf or Whirlpool. Example 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.

\small CombinedModifier = NormalRound(\frac{OldCombinedModifier \times NextModifier}{4096})

Always start with 4096 as our first OldCombinedModifier. The first final modifier we have is Reflect (2732).

\small CombinedModifier = NormalRound(\frac{4096 \times 2732}{4096})

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).

\small CombinedModifier = NormalRound(\frac{2732 \times 2048}{4096})

This evaluates to 1366. Continuing, we apply Friend Guard (3072).

\small CombinedModifier = NormalRound(\frac{1366 \times 3072}{4096})

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).

\small CombinedModifier = NormalRound(\frac{1025 \times 5324}{4096})

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):

Minimum damage: (144*1332)/4096 = 46.828125, which is pokeRounded to 47. Maximum damage: (171*1332)/4096 = 55.6083984375, which is pokeRounded to 56. As you can see, 47-56 is the damage we get from the damage calculator.

252 Atk Life Orb Mega Rayquaza Dragon Ascent vs. 4 HP / 0 Def Shadow Shield Lunala through Reflect with Friend Guard: 47-56 (22 – 26.2%) (47, 48, 48, 49, 49, 50, 50, 51, 52, 52, 53, 53, 54, 54, 55, 56) back to top Moves with Custom Base Power 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.

Speed-based For Speed calculations, the Speed used for the attacker and the defender is the Speed after all Speed modifiers have been applied.

Gyro Ball: Default 1 BP. If the attacker’s Speed is 0, the initial base power is 1. Otherwise, use this formula: \small Base Power = Floor\left \lfloor \frac{25 \times DefenderSpeed}{AttackerSpeed} \right \rfloor

If the base power of Gyro Ball is greater than 150, make it 150.

Electro Ball: Default 1 BP. If the defender’s Speed is 0, the initial base power is 40. Otherwise, use this formula to determine relative Speed S. \small S = Floor\left \lfloor \frac{AttackerSpeed}{DefenderSpeed} \right \rfloor

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 Weight-based 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.

Low Kick / Grass Knot: Default 1 BP. Use the lookup table with the defender’s weight to determine the base power. 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 Heavy Slam / Heat Crash: Default 1 BP. Use this formula to determine relative weight W: \small W = Floor\left \lfloor \frac{AttackerWeight}{DefenderWeight} \right \rfloor

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 HP-based Eruption / Water Spout: Default 150 BP. Use this formula to determine base power: \small Base Power = Floor\left \lfloor \frac{150 \times CurrentHP}{MaximumHP} \right \rfloor

Flail / Reversal: Default 1 BP. Use this formula to determine relative HP P: \small P = Floor\left \lfloor \frac{48 \times CurrentHP}{MaximumHP} \right \rfloor

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 Crush Grip / Wring Out: Default 1 BP. Use this formula to determine the base power: Base Power = Floor\left \lfloor \frac{pokeRound(\frac{120 \times 100 \times Floor\left \lfloor \frac{currentHP \times 4096}{maximumHP} \right \rfloor}{4096})}{100} \right \rfloor

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-based 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.

Return: Default 1 BP. Use this formula to determine the base power: \small Base Power = Floor\left \lfloor \frac{Happiness\times 10}{25} \right \rfloor

A Smeargle or Ditto at base happiness (e.g. from a trade placed directly in the box) will have 28 BP when using Return.

Frustration: Default 1 BP. Use this formula to determine the base power: \small Base Power = Floor\left \lfloor \frac{(255-Happiness)\times 10}{25} \right \rfloor

A Smeargle or Ditto at base happiness (e.g. from a trade placed directly in the box) will have 74 BP when using Frustration.

Counter-based Fury Cutter: Default 40 BP. Use this formula to determine base power: Base Power = 40 \times 2^{Counter}

Where Counter is the number of times Fury Cutter has been used successfully and consecutively, with a maximum of 2.

Rollout / Ice Ball: Default 30 BP. Use this formula to determine base power: Base Power = DefaultBP \times 2^{Counter + Defense Curl}

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 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.

Spit Up: Default 1 BP. Multiply 100*Stockpile to determine base power, where Stockpile indicates the number of times Stockpile has been used, with a maximum of 3. Stat boosts-based 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).

Stored Power / Power Trip: Default 20 BP. Use this formula to determine base power: Base Power = 20 + 20 \times Attacker Stat Boosts

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.

Punishment: Default 1 BP. Use this formula to determine base power: Base Power = 60 + 20 \times Defender Stat Boosts

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.

Dichotomous Base Power Acrobatics: If the attacker currently does not have a held item, Acrobatics is 110 BP; if it does currently have a held item, Acrobatics is 55 BP. Assurance: If the defender has taken any damage this turn (e.g. Life Orb recoil, set a Substitute, damage from an ally’s move), Assurance is 120 BP; otherwise, Assurance is 60 BP. Avalanche / Revenge: If the defender has already damaged the attacker this turn, Avalanche / Revenge is 120 BP; otherwise, it is 60 BP. Grass / Fire / Water Pledge: If an ally has successfully used a different Pledge move, this Pledge move is 150 BP; otherwise, this Pledge move is 80 BP. Gust / Twister: If the defender is in the charging turn of Bounce, Fly, or Sky Drop, Gust / Twister is 80 BP; otherwise, Gust / Twister is 40 BP. Hex: If the defender is burned, paralyzed, asleep, poisoned, badly poisoned, or frozen, Hex is 130 BP; otherwise, Hex is 65 BP. Payback: If the defender has already taken its action for the turn, except switching, Payback is 100 BP; otherwise, Payback is 50 BP. Pursuit: If the defender is attempting to switch out via manual switching or via a switching move (e.g. Parting Shot or Volt Switch), Pursuit is 80 BP; otherwise, Pursuit is 40 BP. Round: If another Pokemon on the field has successfully used Round this turn, Round is 120 BP; otherwise, Round is 60 BP. Smelling Salts: If the defender is paralyzed, Smelling Salts is 140 BP; otherwise, Smelling Salts is 70 BP. Stomping Tantrum: If the attacker’s previous move failed, Stomping Tantrum is 150 BP; otherwise, Stomping Tantrum is 75 BP. A list of all possible candidates for Stomping Tantrum to double in base power can be found on this Smogon forum post; a list of tested conditions for Stomping Tantrum to double in BP can be found on my pastebin. Wake-Up Slap: If the defender is asleep, Wake-Up Slap is 140 BP; otherwise, Wake-Up Slap is 70 BP. Weather Ball: If the weather is not Strong Winds, but there is weather, Weather Ball is 100 BP; otherwise, Weather Ball is 50 BP. Water Shuriken: If the attacker is Ash-Greninja and the attacker’s Ability is Battle Bond, Water Shuriken is 20 BP; otherwise, Water Shuriken is 15 BP. Item-based Fling – Default 1 BP. See the Bulbapedia article on Fling for a chart of base powers that correlate with each item. Natural Gift – Default 1 BP. See the Bulbapedia article on Natural Gift for a chart of base powers that correlate with each Berry. Other Beat Up: Default 1 BP. Beat Up strikes the defender once for every Pokémon in the attacker’s party that is not fainted, burned, poisoned, badly poisoned, asleep, paralyzed, or frozen, in the order that those Pokémon are currently in the party. Use this formula to determine base power for each strike: \small Base Power = Floor\left \lfloor \frac{Base Attack}{10} \right \rfloor + 5

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.

Echoed Voice: Default 40 BP. The base power is determined by the number of times Echoed Voice was used consecutively, though the counter for increasing Echoed Voice’s base power can only increase once per turn, even if multiple Pokémon use Echoed Voice. If Echoed Voice is executed but deals no damage (e.g. used into a Ghost-type, misses, blocked by Protect, etc), the counter still increases. Use this lookup table to determine the base power. Number of Times Base Power 1 40 2 80 3 120 4 160 5 or more 200 Hidden Power: Always has a fixed base power of 60 BP as of Generation VI. The Hidden Power type is determined by a calculation done with the Pokémon’s IVs; notably, a Transformed Pokémon can have a different Hidden Power type than the Pokémon it copies, because Hidden Power is calculated “on the fly”, to to speak. The IVs used in Hidden Power calculation are the IVs before Bottle Caps are applied. View this pastebin for a breakdown of all possible Hidden Power IV combinations for each type. Magnitude: Default 1 BP. The game generates a random number 0 ≤ n ≤ 100, then determines a Factor for Magnitude using this lookup table: 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:

Base Power = 10 + 20 \times Factor

Present: Default 1 BP. The game generates a random number 0 ≤ n < 80. If n < 40, the base power is 40, if 40 ≤ n < 70, the base power is 80, and if 70 ≤ n < 80, then the base power is 120. Triple Kick: Default 10 BP. Each hit has an independent accuracy check, but assuming all strikes connect, the first strike is 10 BP, the second strike is 20 BP, and the third strike is 30 BP. Trump Card: Default 1 BP. The base power is determined by how much PP Trump Card will have after usage (including Pressure), according to this lookup table: 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.

back to top

Base Power Modifiers 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.

Aura Break – If the move is Fairy-type and Fairy Aura is active, or the move is Dark-type and Dark Aura is active, multiply by 3072/4096 (0.75x). Rivalry – If the attacker and the defender have opposite genders (one is male, the other is female), multiply by 3072/4096 (0.75x). If the attacker and the defender have the same gender (both are male or both are female), multiply by 5120/4096 (1.25x). If either the attacker or defender is genderless, Rivalry will not apply. 1.2x Abilities – Multiply by 4915/4096 (1.199951171875‬x) if one of the following conditions is met: -ate Abilities: if the move is Normal-type and the Ability is Galvanize, Aerilate, Pixilate, or Refrigerate; Normalize: applies even if the move is already Normal-type; Iron Fist: if the move is a punching move; Reckless: if the move is a move that has recoil or is Jump Kick / High Jump Kick, but not Struggle. Battery – If the ally has Battery and the move is special, multiply by 5325/4096 (1.300048828125x). 1.3x Abilities – Multiply by 5325/4096 (1.300048828125x) if one of the following conditions is met: Sheer Force: if the move is capable of being boosted by Sheer Force; Sand Force: if the weather is Sand and the move is Rock-, Ground-, or Steel-type; Analytic: if the attacker moved last in the turn; Tough Claws: if the move makes contact. Auras – Multiply by 5448/4096 (1.330078125x) if Aura Break is not active and one of the following conditions is met: Fairy Aura: if the move is Fairy-type; Dark Aura: if the move is Dark-type. 1.5x Abilities – Multiply by 6144/4096 (1.5x) if one of the following conditions is met: Technician: if the move’s base power to this point is less than or equal to 60. The move base power modifiers so far are “temporarily chained” to determine if BP ≤ 60. For example, if a Marshadow’s Hidden Power is boosted by Battery, the Technician boost will not apply. Flare Boost: if the attacker is burned and the move is special; Toxic Boost: if the attacker is poisoned/badly poisoned and the move is physical; Strong Jaw: if the move is a biting move; Mega Launcher: if the move is an aura or pulse move. Heatproof – if the move is Fire-type, multiply by 2048/4096 (0.5x). Dry Skin – if the move is Fire-type, multiply by 5120/4096 (1.25x). 1.1x Items – Multiply by 4505/4096 (1.099853515625x) if either of the following conditions is met: Muscle Band: if the move is physical; Wise Glasses: if the move is special. 1.2x Items – Multiply by 4915/4096 (1.199951171875x) if one of the following conditions is met: Plates / Type-enhancing generic items / Type enhancing Incenses that match the appropriate move type; Adamant Orb: if the move is Steel- or Dragon-type and the attacker is Dialga; Lustrous Orb: if the move is Water- or Dragon-type and the attacker is Palkia; Griseous Orb: if the move is Ghost- or Dragon-type and the attacker is Giratina; Soul Dew: if the move is Psychic- or Dragon-type and the attacker is Latios or Latias. Normal Gem – if the move is Normal-type, multiply by 5325/4096 (1.300048828125x). Solar Beam / Solar Blade – if there is non-Sunny, non-Strong Winds weather, multiply by 2048/4096 (0.5x). Me First – if the effect is successful, multiply by 6144/4096 (1.5x). Knock Off – if the defender has an item removable by Knock Off, multiply by 6144/4096 (1.5x). Using Knock Off into Sticky Hold will still result in increased damage; the item just won’t be removed. Helping Hand – for each Helping Hand, multiply by 6144/4096 (1.5x). Multiple Helping Hands are possible via Instruct. Charge – if Charge was used on the previous turn and the move is Electric-type, multiply by 8192/4096 (2x). Double-powered moves – Multiply by 8192/4096 (2x) if one of the following conditions is met: Facade: if the attacker is poisoned, badly poisoned, burned, or paralyzed; Brine: if the defender’s current HP is less than or equal to Floor(Defender’s HP / 2); Venoshock: the defender is either poisoned or badly poisoned; Retaliate: if a Pokémon on the attacker’s team fainted on the previous turn. Note that if a partner faints in a double battle on the same turn Retaliate is used, Retaliate’s base power is not affected. Fusion Bolt / Fusion Flare: if the opposite Fusion move was used successfully this turn. Terrain (defensive) – Multiply by 2048/4096 (0.5x) if the defender is grounded and either of the following conditions is met: Grassy Terrain: if the move is Earthquake, Bulldoze, or Magnitude; Misty Terrain: if the move is Dragon-type. Terrain (offensive) – Multiply by 6144/4096 (1.5x) if the attacker is grounded and one of the following conditions is met: Electric Terrain: if the move is Electric-type; Grassy Terrain: if the move is Grass-type; Psychic Terrain: if the move is Psychic-type. Sport – Multiply by 1352/4096 (0.330078125x) if either of the following conditions is met: Mud Sport: if the move is Electric-type; Water Sport: if the move is Fire-type. 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).

Example 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.

\small Base Power = Floor\left \lfloor \frac{Happiness\times 10}{25} \right \rfloor 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:

Zap Plate (4915/4096) Helping Hand (6144/4096) Charge (8192/4096) Electric Terrain (8192/4096) Mud Sport (1352/4096) \small CombinedModifier = NormalRound(\frac{OldCombinedModifier \times NextModifier}{4096})

Always start with 4096 as our first OldCombinedModifier. The first BP modifier we have is Zap Plate (4915).

\small CombinedModifier = NormalRound(\frac{4096 \times 4915}{4096})

Which evaluates to 4915. Next, we plug in 4915 as our old modifier, and Helping Hand (6144) as our next BP modifier.

\small CombinedModifier = NormalRound(\frac{4915 \times 6144}{4096})

This evaluates to 7372.5. Remember, chained modifiers use normal rounding, so this rounds up to 7373. Our next BP modifier is Charge (8192).

\small CombinedModifier = NormalRound(\frac{7373 \times 8192}{4096})

This comes out to be an even 14746. Next up is Electric Terrain (6144).

\small CombinedModifier = NormalRound(\frac{14746\times 6144}{4096})

This calculation also evaluates to a nice, even number: 22119. Our last BP modifier to apply is Mud Sport (1352).

\small CombinedModifier = NormalRound(\frac{22119\times 1352}{4096})

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,

\small Base Power = pokeRound(\frac{85\times 7301}{4096})

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.

back to top

Attack Modifiers 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:

Unaware: if the defender has Unaware, do not apply any attack boosts in your calculation, either positive or negative. Foul Play: use the defender’s starting Attack stat and the defender’s Attack boosts, but only apply attack modifiers if it is applicable to the attacker using Foul Play (e.g. the attacker must hold Choice Band to boost Foul Play’s power, not the defender). Critical hit: ignore negative attack boosts. For example, a +1 critical hit Leaf Blade into a Pokémon with Unaware will be treated as a +0 critical hit Leaf Blade.

Attack boosts/drops: multiply the starting attack by the appropriate attack boost/drop modifier, and floor the result. 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.)

Hustle: multiply the current attack by 6144/4096 (1.5x), and pokeRound the result. This calculation is done completely outside of the chained attack modifiers. 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.

0.5x Offensive Abilities – Multiply by 2048/4096 (0.5x) if either of the following conditions is met: Slow Start: If the move is physical, or the move is a Z-move and the move is special; Defeatist: If the attacker’s current HP is less than or equal to Floor(Attacker’s HP / 2). Flower Gift – Applies if either the attacker or an ally has Flower Gift. If the weather is sunny and the move is physical, multiply by 6144/4096 (1.5x). 1.5x Offensive Abilities – Multiply by 6144/4096 (1.5x) if one of the following conditions is met: Guts: if the attacker is asleep, paralyzed, burned, poisoned, or badly poisoned and the move is physical; Overgrow: if the attacker’s HP is less than or equal to Floor(Attacker’s HP / 3) and the move is Grass-type; Blaze: same as Overgrow, but for Fire-type moves; Torrent: same as Overgrow, but for Water-type moves; Swarm: same as Overgrow, but for Bug-type moves; Flash Fire: if the attacker was previously hit by a Fire-type move and the move is Fire-type; Solar Power: if the weather is sunny and the move is special; Plus: if an ally also has Plus or Minus, and the move is special; Minus: if an ally also has Plus or Minus, and the move is special; Steelworker: if the move is Steel-type. 2x Offensive Abilities – Multiply by 8192/4096 (2x) if one of the following conditions is met: Huge Power: if the move is physical; Pure Power: if the move is physical; Water Bubble: if the move is Water-type; Stakeout: if the defender switched in during this turn. 0.5x Defensive Abilities – Multiply by 2048/4096 (0.5x) if either of the following conditions is met: Thick Fat: if the move is Fire- or Ice-type; Water Bubble: if the move is Fire-type. Choice items – Multiply by 6144/4096 (1.5x) if either of the following conditions is met: Choice Band: if the move is physical; Choice Specs: if the move is special. Pokémon-specific items – Multiply by 8192/4096 (2x) if the attacker listed is a “base species” (that is, it’s not a Ditto/Smeargle/Mew Transformed into the species) and one of the following conditions is met: Thick Club: if the Pokémon is Cubone, Marowak, Alolan Marowak, or Totem Alolan Marowak, and the move is physical; Deep Sea Tooth: if the Pokémon is Clamperl and the move is special; Light Ball: if the Pokémon is Pikachu, any cap Pikachu, or any cosplay Pikachu. 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).

Example 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.

\small CombinedModifier = NormalRound(\frac{OldCombinedModifier \times NextModifier}{4096})

Always start with 4096 as our first OldCombinedModifier. The first BP modifier we have is Flash Fire (6144).

\small CombinedModifier = NormalRound(\frac{4096\times 6144}{4096})

Which evaluates to 6144. Our next modifier is Thick Fat (2048).

\small CombinedModifier = NormalRound(\frac{6144\times 2048}{4096})

This comes out to be an even 3072. So, take our starting Special Attack of 108 and apply a modifier of 3072.

\small Special Attack = pokeRound(\frac{108\times 3072}{4096})

This becomes a nice, even 81 final Sp. Atk.

back to top

Defense Modifiers Calculating defense is very similar to calculating attack, except there are less modifiers for defense than there are for attack.

Unaware: if the attacker has Unaware, do not apply any defense boosts in your calculation, whether positive or negative. Chip Away / Sacred Sword: do not apply any defense boosts in your calculation, either positive or negative. Psyshock / Psystrike / Secret Sword: use the starting Defense stat of the defender, rather than the starting Special Defense stat. Wonder Room: swap the starting defense stats, but do not swap the defense boosts (e.g. if Defense is 210 and Sp. Def is 160 and you had a +3 Defense boost, now you have a Defense of 160, a Sp. Def of 210, and an unchanged +3 in Defense). Critical hit: ignore positive defense boosts. For example, a critical hit Sacred Sword at -1 Defense is treated as a critical hit Sacred Sword at +0 Defense.

Defense boosts/drops: multiply the starting defense by the appropriate defense boost/drop modifier, and floor the result. 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.)

Sandstorm + Rock-type – if the move targets Special Defense, multiply the current defense by 6144/4096 (1.5x), and pokeRound the result. This calculation is done completely outside of the chained defense modifiers. 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.

Flower Gift – Applies if either the defender or an ally has Flower Gift. If the weather is sunny and the move targets Special Defense, multiply by 6144/4096 (1.5x). 1.5x Abilities – Multiply by 6144/4096 (1.5x) if either of the following conditions is met: Marvel Scale: if the attacker is asleep, paralyzed, burned, poisoned, or badly poisoned and the move targets physical Defense; Grass Pelt: if the Terrain is Grassy Terrain and the move targets physical Defense. Fur Coat – if the move targets physical Defense, multiply by 8192/4096 (2x). 1.5x Items – Multiply by 6144/4096 (1.5x) if either of the following conditions is met: Eviolite: if the Pokémon is unevolved and has the potential to evolve; Assault Vest: if the move targets Special Defense. 2x Items – Multiply by 8192/4096 (2x) if either of the following conditions is met: Deep Sea Scale: if the Pokémon is Clamperl in its base species, and the move targets Special Defense; Metal Powder: if the Pokémon is Ditto in its base species and not Transformed into another Pokémon, and the move targets physical Defense. 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.

Example 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.

back to top

Speed Modifiers 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:

Speed boosts/drops: multiply the starting speed by the appropriate speed boost/drop modifier, and floor the result. 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:

2x Abilities – Multiply by 8192/4096 (2x) if one of the following conditions is met: Chlorophyll: if the weather is sunny; Swift Swim: if the weather is rain; Sand Rush: if the weather is sand; Slush Rush: if the weather is hail; Surge Surfer: if the terrain is Electric Terrain; Unburden: if the Pokémon lost its held item while active on the field and does not currently have an item. Quick Feet – If the Pokémon is asleep, burned, frozen, paralyzed, poisoned, or badly poisoned, multiply by 6144/4096 (1.5x). Slow Start – If the Pokémon has not yet been on the field for 5 turns, multiply by 2048/4096 (0.5x). Quick Powder – If the base species is an unTransformed Ditto, multiply by 8192/4096 (2x). Choice Scarf – Multiply by 6144/4096 (1.5x). Iron Ball / Macho Brace / Power EV items – Multiply by 2048/4096 (0.5x). Tailwind – Multiply by 8192/4096 (2x). Pledge Swamp from Grass + Water Pledge – Multiply by 1024/4096 (0.25x). 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,

Paralysis: if the Ability isn’t Quick Feet, multiply by 2048/4096, and floor the result. 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:

If Trick Room is in effect, set the Speed to 10,000 – current Speed. If the Speed is greater than 8191, subtract 8192. This will be the Speed stat used for the purposes of turn order.

Example 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.

back to top

Weight Modifiers 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:

Autotomize: For every instance of Autotomize, subtract 100 kg from the weight. If the weight would drop below 0.1 kg, make it 0.1 kg. Heavy Metal: multiply the weight by 2. There is no weight maximum; it can go beyond 999.9 kg. Light Metal / Float Stone: divide the weight by 2 (if either effect) or 4 (if both effects). Truncate any weight to the nearest tenth of a kilogram (that is, a weight of 10.25 kg would become 10.2 kg, 10.24 kg would become 10.2 kg, and 10.26 kg would become 10.2 kg). 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.

back to top

Special Cases 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).

Counter: if the user of Counter was hit by a physical move this turn, deal 2x the amount of damage taken from that physical move to that original attacker. Mirror Coat: if the user of Mirror Coat was hit by a special move this turn, deal 2x the amount of damage taken from that special move to that original attacker. Metal Burst: if the attacker was damaged by a move this turn, deal 1.5x the amount of damage taken from that move, and floor the result. Bide: store the damage taken from all moves dealt to the attacker for 2 turns, then deal 2x the amount of damage taken from the sum of those earlier damages. 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.

Super Fang / Nature’s Madness: deal damage equal to defender’s HP / 2, then floor the result. Guardian of Alola: deal damage equal to defender’s HP * (3/4), then floor the result. If the defender is protected by a protecting move, instead deal damage equal to defender’s HP * (3/16), then floor the result. Moves dependent on the attacker’s HP

Final Gambit: deal damage equal to the attacker’s HP. Endeavor: deal damage equal to (defender’s HP – attacker’s HP). If the defender’s HP is less than or equal to the attacker’s HP, don’t deal damage. If the defender has a Substitute, use the HP of the Pokémon itself to determine Endeavor’s damage, not the HP of the Substitute. Set-damage moves

Sonic Boom: deal 20 damage. Dragon Rage: deal 40 damage. Other

Seismic Toss / Night Shade: deal damage equal to the attacker’s level. OHKO moves: deal damage equal to the defender’s HP. If the defender has a Substitute, deal damage equal to the Substitute’s HP instead. Psywave: generate a random number r such that 0 ≤ r ≤ 100. Then, use this formula to determine damage: Damage = Floor \left \lfloor \frac{user's Level \times (r + 50)}{100} \right \rfloor

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.

back to top

Damage Overflow 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:

Multiply 699,080 * 6,144 = 4,295,147,520‬. If you were representing 4,295,147,520‬ in binary, you’d need 33 bits to do so: 1 0000 0000 0000 0010 1100 0000 0000 0000. Because 4,295,147,520 is greater than 32 bits, we need to force it to exist within 32 bits. To do this, we basically throw away any bits that aren’t in the right-most 32 bits (that is, we keep the 32 least significant bits). After dropping that leading 1, we end up with just 0000 0000 0000 0010 1100 0000 0000 0000, which is in ordinary decimal is 180,224. For our purposes, we also could just take 4,295,147,520 modulo 4,294,967,296. (4,295,147,520 % 4,294,967,296) also equals 180,224. Finally, we divide 180,224 by 4096 and pokeRound the result. 180,224/4096 = 44. 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):

After multiplying Level * Attack * Base Power in the base damage formula; During the application of any general damage modifier; After multiplying Current Damage * (100 – Random Factor) when generating the random damage roll. 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.

back to top

A One-Turn Setup for Maximum Damage Since damage caps at 65,535, it is much easier to engineer setups that deal maximum damage. Consider this one-turn setup:

The attacker Kyurem-B is at level 100 with 192 Attack EVs and a neutral nature (424 starting Attack). It holds a Lum Berry, and has only 230 happiness, giving it a 92 BP Return. Its ally Butterfree is faster than Kyurem-B, has the Ability Compound Eyes, and the move Swagger. An opposing Woobat is at level 1 with 4 or 5 starting Defense. It has the Ability Simple. Its ally Galvantula is also faster than Kyurem-B, has the Ability Compound Eyes, and the move Screech. With these 4 Pokémon, you can set up maximum damage on turn 1:

Galvantula uses Screech on its ally Woobat. Woobat’s Defense drops to -4 because of Woobat’s Simple Ability. Butterfree uses Swagger on its ally Kyurem-B. Lum Berry cures Kyurem-B of its confusion, but it gets +2 Attack out of the deal. Kyurem-B uses Return onto Woobat. Let’s review why this works! Starting with our variables for base damage, we have level, BP, Attack, and Defense:

Level: we’re level 100, so Floor[(2*100)/5] + 2 = 42. Base Power: 230 happiness on Kyurem-B means Return is 92 BP. There aren’t any other modifiers to BP. Attack: Kyurem-B was originally at 424 Attack, but that was doubled with the +2 from Swagger. 424*(4/2) = 848. Defense: Whether you start with 4 or 5, -4 Defense means Woobat’s Defense is multiplied by 2/6. Floor(4*2/6) = Floor(5*2/6) = 1. Plugging in our variables to the base damage formula, we get this: Base Damage = Floor\left \lfloor \frac{Floor\left \lfloor \frac{42\times 92 \times 848}{1} \right \rfloor}{50}\right \rfloor + 2

Base Damage = Floor\left \lfloor \frac{3276672}{50}\right \rfloor + 2

Base Damage = Floor\left \lfloor 65,533.44\right \rfloor + 2

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.

back to top

Conclusion 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.