# Talk:Damage

Does the Damage formula below account for critical hits? I don't see any area in it which does, would it be worth noting it?

Nothinhappened 22:03, 13 November 2009 (UTC)

It's noted in the damage modification section. A CH does 2x damage, after the formula has been applied. —darklordtrom 01:40, 15 November 2009 (UTC)

## held Item?

It isn't that clear the part that says that some held Items and Berries increase the damage inflicted in other Pokémon! I did understand the formula at the bottom of the page, but there isn't any clear explanation about it. Would someone, please? Exactly where/when would the "extra 20%" bonus of NeverMeltIce apply? YukitoOoO 22:09, 22 November 2009 (UTC)

## Move the formula to Modification?

It seems like a good thing to do, because a lot of the stuff here is repeated anyway, and most of what affects the formulas is in the Modification section anyway. Ztobor 03:55, 29 July 2010 (UTC)

## Mild contridiction in a very specific criteria

--Noltron200 17:28, 6 August 2010 (UTC)Noltron200

In this page, it says this "Critical is 2 for a critical hit, 1 otherwise. For Pokémon with Sniper, it is 3 for a critical hit. " in the series of bullet notes.

In the description of Sniper, in the Sniper(ability) page, it says this "Sniper multiplies the base power of an attack 1.5× during a critical hit. "

Becuase the damage equation goes " ...×base + 2)×Modifier ", the first source would multiply the +2 by two, meanwhile the second source would not, becuase it multiplies the move's base attack, and than is added by two.

Merely 2 points difference, but its something to consider.

## Double/Triple Battle?

In the other section of the formula, it states "other counts for things like held items, Abilities, field advantages, and whether the battle is a Double Battle or Triple Battle or not." What effect does being a double or triple battle have on damage? I understand targeting differences, but not damage. Can someone help me with this? (Arcalargo (talk) 15:30, 7 December 2014 (UTC))

Some moves, such as Flame Burst, which affect non-targeted Pokémon with indirect damage. There are also abilities such as Friend Guard that affect damage taken by allies. While it's not the double or triple battle itself that has any effect on damage, there are factors that only apply outside of single battles. --GuyPerfect (talk) 15:39, 7 December 2014 (UTC)
So to confirm, there isn't really anything about the double or triple battle itself. Its just abilities(which are already listed) that effect damage, correct? - unsigned comment from Arcalargo (talkcontribs)
I would imagine the damage part refers to the damage penalty that moves like Surf incur. Tiddlywinks (talk) 18:32, 7 December 2014 (UTC)
Derp, I missed that when I was reviewing damage, thank you(Arcalargo (talk) 18:34, 7 December 2014 (UTC))

## Zero damage?

Umm, well I was reading a bit about the damage formula and at some point the zero damage got my curiosity, since it was done in a Black/White version I wanted to try it on a X/Y version.

I tried this with a Lv 100 Steelix with 469 Defense, aditionally it has Reflect and x6 boost on Defense, againts a Zigzagoon Lv 2.

I didn't made the formula, knowing the advantage of type (Which make 0,50), Reflect and the Defense boost it SHOULD hit zero.

In the video I've seen a Lv 100 Celebi which can have a max of 328 plus a reflect and nothing more, so the max Defense it can have is of 492 (Adding the 50% of the Reflect), got hitted by Tackle from a Lv 4 Lillipup, I expect the Lillipup Attack would be around 5~9

Knowing that the set I used was obviously better I made the formula for this one, I don't know if I've done the formula correctly (If someone can help me, I'd be pleased), so here it go:

( 2 * 4 + 10 ) / 250 = 0,072, that's the first value.

5~9 / 492 = 0,010162602~0,018292683, that's the second value (Note it's 492 and not 328 because I'm adding the effect of Reflect, which is a 50% plus to 328).

All together it should be something like:

0,072 * 0,010162602~0,018292683 * 50 + 2 = 2,036585367~2,065853659

Then adding the multiplier of Modifier:

1,5 * 1 * 1 * 1 * 0,85~1 = 1,275~1,5

With the first result:

2,036585367~2,065853659 * 1,275~1,5 = 2,596646343~3,098780488

Celebi should receive at least 2 or 3 of damage if it rounded down.

So here's my questions:

1. Did I do something wrong in the formula?

2. Maybe it is only possible on Gen V and prior to it?

3. If the last Question is no, why my Steelix keep getting 1 damage?

4. It's some kind of joke or something? >____>

Yeah, I was really bored to do all this instead of my math HW >.>

MilesPikachu (talk) 18:47, 6 January 2015 (UTC)

## Is 'Base damage' just Power?

The Damage formula section keeps referring to the 'Base damage' of the attack, but it doesn't explain what this is. Based on this site, it seems like 'Base damage' is actually Power. If so, obviously it should be changed to say Power, but if not, there should be an explanation of what 'Base damage' is.

RolandRock (talk) 00:35, 21 January 2015 (UTC)

Some people use the phrase "base damage" to mean the damage before the modifier is applied. Stats1989 (talk) 01:39, 12 August 2016 (UTC)

## Attacks that hit multiple times?

How would attacks like Triple Kick or Bullet Seed that hit more than once effect the damage formula? --Rwars (talk) 15:58, 15 April 2015 (UTC)

They do not change the formula, each hit has its own critical hit chance/damage. There is a separate check before the critical check to see how many hits occur, but no modification to the damage formula itself. The odd one out in this case though is Triple Kick as its power increases with each hit, so the move's power part of the formula changes with each hit. (Arcalargo (talk) 16:05, 31 March 2016 (UTC))

## Damage Rounding

According to dragonflycave's page on battle mechanics, not counting machine rounding to the nearest 4096th, there are three times when damage is rounded down to the nearest integer before the final result is rounded down a fourth time. [This is based on the formula: damage = ((2*L/5 + 2)*A*P/D)/50 + 2) * multiplier, which is equivalent to the one we have now except for rounding.] One is after calculating (2*level/5 + 2), one is after multiplying this result by the attacker's offensive stat and the base power and dividing by defender's defensive stat, and one is after dividing this result by 50. Three things stand out about this process: First, that rounding down after multiplying level by 2/5 and adding a constant has the same effect as rounding level down to the nearest number that is either a multiple of 5 or two less than a multiple of 5. That is, the thresholds for when this will be rounded to a higher integer are at levels 3, 5, 8, 10, 13, 15, 18, 20, 23, 25, 28, 30, 33, 35, 38, 40 etc. Second, that the second rounding doesn't matter. If you round down to the nearest integer, then divide by 50 and round down to the nearest integer again, the result should be the same as if you just divided by 50 and rounded down after dividing by 50. And third, that the third rounding would have the same effect if it was performed at any time after dividing by 50 and before applying the modifier, since the rest is just adding constants. Thus, these three roundings appear to be able to be summarized as follows: level is rounded down to the nearest integer that ends in a 0, 3, 5, or 8, and base damage is rounded down before the modifier is applied. I am not taking into account the exact form in which the machine stores numbers, which is much more accurate in most cases than rounding to the nearest integer. Stats1989 (talk) 01:39, 12 August 2016 (UTC)

Well, yes, somehow. "Rounding down" after each division is just a way how Dragonflycave tries to express/explain that any division is actually a truncated integer division (rounding towards zero, cutting off any decimals) by the machine. (The statement about the level threshold is true.) The second "rounding" does matter, though, and you basically said it: ...as if you just divided by 50 and rounded down (...) (notice how you still need to actually "round down"). If I understand your third statement correctly, it is also not true: Suppose you have a value of 3.61 and want to multiply it by 2. It you first round down, then multiply, you will get 6, whereas if you first multiply, then round down, you will get 7.
(Also, if you haven't, please take a look at what I wrote at your talk page.) Nescientist (talk) 09:18, 12 August 2016 (UTC)

1. The second rounding is after multiplying the level multiplier by the stat effects and the base power of the move. The third rounding is after taking the result of the second rounding and dividing by 50. The second rounding would appear to not matter because if you take any number, round down, then divide by 50 and round down again, the result is the same as if you just divided by 50 and then rounded down. Rounding down twice in between calculating the level multiplier and applying the modifier (which is what happens with the second and third roundings) appears to be equivalent to rounding down once during this time. 2. If you re-read what I said, I said that applying the third rounding at any time after dividing by 50 but before applying the modifier is equivalent. In other words, rounding down before adding the +2 damage that is independent of stats is equivalent to rounding down after adding the +2 but before multiplying by type effectiveness etc. Obviously, you are correct that rounding after you multiply is different from rounding beforehand, but what I said is that it doesn't matter whether you round before or after adding the +2.

In summary, saying "round down once after calculating L*(2/5)+2, a second time after multiplying this result by A*P/D, and a third time after dividing this result by 50, then add 2 to the result, then multiply that result by multiplier" is equivalent to saying "round down once after calculating L*(2/5), then add 2 to the result, then multiply that result by A/D*P and add 2 to the result, then round down, then multiply by the multiplier." This is, in turn, equivalent to saying "Take floor of (L+5)*2/5, times (A/D)*P/50, round down, then add 2, then multiply the result by the multiplier." There are many ways to describe the formula and rounding (or at least the integer floor rounding, which is more important than the rounding to the nearest 4096th) accurately, so whichever is clearest and easiest to express visually is fine. I just think that we should either write the formula in a way that shows the integer flooring (or is consistent with the integer flooring), or mention it in the text. Unfortunately, at the moment we have a visual formula that doesn't show the rounding OR write it in a way that is consistent with how the rounding occurs, and the text doesn't mention the rounding either. If you look at how it is currently done in the Statistic page when discussing how a stat value is calculated in Gen I-II, the formula is written in a way that is inconsistent with the rounding (but consistent with how the formula for Gen III+ is written), but the value that is rounded by the game is still mentioned in the text. Stats1989 (talk) 13:43, 12 August 2016 (UTC)

I guess some of your statements are still imprecise (or rather badly worded), but let's just say we apparently all agree (and are dissatisfied) that the current state of the article is missing all rounding issues. That's why we (and I in particular) invested quite a lot of time trying to improve it (as can be seen from your talk page). So please be a little patient. (And from what I can tell by looking at it rather briefly, the stats page seems to be consistent with having integer division visualized/rewritten as division+flooring.) Nescientist (talk) 17:07, 12 August 2016 (UTC)

## Minimum 2 damage?

In the above discussions many people talked about rounding, but looking over the formula, I can see some very simple cases in which, no matter how I round, I always get minimum damage values greater than 1. For example, any STAB attack that hits with neutral effectiveness should should always hit with at least 2 damage, even if it was a level 1 Rattata using Tackle on a level 100 Avalugg. No amount of rounding can reduce the first half of the equation (factoring in level, stats, and base power) below 2, thanks to the +2 at the end, so if remaining modifiers increase the random value above 1, the damage shouldn't be able to go below 2 (which should be guaranteed with the 1.5x STAB multiplier). And yet, testing this theory in-game, I have easily found low-level Pokemon that can't do more than 1 damage with neutrally-effective STAB moves. The only explanation I can think of is if they apply the random value and floor before any other multipliers, but even then it should be very possible to get guaranteed 2+ damage from other multipliers, such as hitting with a 2x SE attack. Extrapolating from this, enough multipliers (let's say STAB, Choice Band/Specs boost, Terrain boost, and 4x effectiveness) should be able to raise the minimum damage well over 10, regardless of the actual attack power, stats, or level difference. Is there some explanation for my initial STAB question, and/or confirmation of such high minimum damages? --MASLEGOMAN (talk) 16:09, 12 December 2016 (UTC)

That's because this page doesn't use the actual formula with all the right placed to round. That's one of the reasons I made User:Nescientist/Damage, where everything should be in correct order (at least after Gen III, I think) and rounding issues are mentioned (at least) in prose. The random multiplier seems to precede STAB (explains your problem); Choice items' boosts boost "Attack" or "Special Attack", and Terrains boost "Power" (that's all inside the +2 thing). In both official and Bulbapedia wording (hopefully), if something is said to boost a stat, then those really boost the stat within the formula; only if it says it boosts damage, there's something within the formula. Hope that helps! Nescientist (talk) 17:35, 12 December 2016 (UTC)
Confirming that the random multiplier happens first does help, yes. I just wish the exact order was laid out on paper somewhere. Does this mean that each multiplier gets multiplied in and truncated individually? If so, then that would mean that, if the damage is reduced to 1, a series of 1.5 multipliers would effectively be ignored, depending on if they came before bigger multipliers or not. For example, if damage hits 1 and then STAB, Terrain, and Choice Band/Specs are applied, it would be floor(floor(floor(1 x 1.5) x 1.5) x 1.5) = 1. But if damage hit 1 and a super-effective multiplier of 2 (or 4) was applied FIRST, each of the other multipliers would increase the value: floor(floor(floor(floor(1 x 4) x 1.5) x 1.5) x 1.5) = 13. It would be even higher if the random value got applied later or last, and the initial damage started at 2. Thus we can get a guaranteed, level/stat/BP-irrelevant final damage of anything from 1 to 13+ depending entirely on the order in which the game factors in multipliers, so it seems a little important to clarify said order. --MASLEGOMAN (talk) 20:49, 12 December 2016 (UTC)
During the calculation, any operations are carried out on integers internally, such that effectively each division is a truncated integer division (rounding towards zero, cutting off any decimals), and any decimals are also cut off after each multiplication operation.
The order on the user page should be accurate. But again, Choice items are already used to create the Attack ("A") value, and terrains for "Power", those are not incorporated outside anything. I don't think <whatever>-independent minimum damage is really worth calculating, because the rest is just as much part of calculation. But you're of course right, order matters, and that's one of the benefits of the aforementioned userpage. (It's not exactly paper, so if you insist on that, feel free to write it down yourself. :P) Nescientist (talk) 22:25, 12 December 2016 (UTC)
Ok, so, to clarify, the order is: Weather -> Critical -> random -> STAB -> Type -> Burn -> other ? This would explain getting only 1 damage off a STAB attack from a level 1 (with there being a 1/16 chance of 2 damage). But are you also now saying that Choice items and Terrain boosts affect the attack stat and BP directly? On Showdown it says that a 4x SE STAB attack from a level 1 on a level 100 (min atk, max def) with Choice and Terrain would still hit a minimum damage over 10, but if you take Choice/Terrain out of the multipliers, and factor in the STAB going away (because of the aforementioned random value being multiplied first), the minimum damage should really only be 4, from the 4x SE ((low vals + 2) x 85/100 x 3/2 x 4 minimizes to 4 with int division). Is Showdown's order off, then? To be incredibly specific, I did: Pichu, level 1, attack-reducing nature with 0 IVs/EVs (Atk = 4), Choice Band, Electric Terrain, using Nuzzle (20BP) on a level 100 Gyarados with a defense-increasing nature and max IVs/EVs (Def = 282), and the damage range was 12-16. If the Choice and Terrain are calculated as you say, then the calculation would be (using the Bulbapedia formula, since I don't really understand the bits like "\right" on the user page): ((2x1+10)/250 x (4x1.5)/282 x (20x1.5) + 2) x .85 x 1.5 x 4 = (12/250 x 6/282 x 30 + 2) x .85 x 1.5 x 4 = 2 x .85 x 1.5 x 4 = 1 x 1.5 x 4 = 1 x 4 = 4. Sooo... Something is off here. Either the Choice/Terrain multipliers DO need to be in the multipliers, or the order of the multipliers is off, or Showdown is wrong. One of the three. --MASLEGOMAN (talk) 15:46, 14 December 2016 (UTC)
May I offer a fourth possibility: you used Showdown wrong...? I get
0- Atk Choice Band Pichu Nuzzle vs. 0 HP / 252+ Def Gyarados: 4-12 (1.2 - 3.6%) -- possibly the worst move ever
(4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 12)

Showdown also has a GitHub repository, and I just checked, they agree on what I told you about Choice items and terrains. You can check on whether they agree on the exact order, if you'd like, but I believe they agree on that as well. For that messy code on the userpage: it's currently TeX code, and not yet converted to an image and then uploaded; but you can just paste it here to read it, for example.
Anyway, it all comes down to: If you ever happen to encounter a max Def level 100 Gyarados, there may be better ideas than to equip a Choice Band to your level 1 Pichu in order to Nuzzle it down. Nescientist (talk) 18:30, 14 December 2016 (UTC)
Nope, you actually used Showdown wrong. Showdown clearly has a glitch where it doesn't update properly with every change (namely with Electric Terrain). If you set everything, then hit Electric Terrain, it gets the 4-12 damage you got. Then if you change something else, like altering a stat or changing from singles to doubles and back, it refreshes and says this:
0- Atk Choice Band Pichu Nuzzle vs. 0 HP / 252+ Def Gyarados: 12-16 (3.6 - 4.8%) -- possibly the worst move ever
(12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 16)

In fact, I actually forgot the Choice Band the first time I did this, and it still got 12-16, so I guess that proves that you were right about the Choice Band multiplier (at least in Showdown's logic). But the Electric Terrain Multiplier definitely isn't applied to BP or the attack stat. So with this new info in mind, it looks like Electric Terrain is being applied (in Showdown) BEFORE the random value, like so (with the initial damage of 2): 2 x 1.5 (terrain) x .85 (rand) x 1.5 (STAB) x 4 (SE) = 3 x .85 x 1.5 x 4 = 2 x 1.5 x 4 = 3 x 4 = 12. This would explain the jump in damage from 4 (without field) to 12 (with field), since without the field the random value would essentially negate the STAB bonus. So Showdown's order differs from yours, it seems. --MASLEGOMAN (talk) 22:34, 14 December 2016 (UTC)
I thought it didn't change because nothing had changed. It's interesting, though, because Showdown's damage calculator really does have an additional factor in between Weather and Critical (see here, line 518), whereas Showdown's battle engine powers up the base power (see here, line 4198). And that matches what the userpage and Bulbapedia have, and also that the this official website says Electric Terrain is "raising the power of any Electric-type moves" (and not damage dealt by them). Until proven otherwise, we just have to treat the official website more reliable than Showdown's damage calculator (especially when it's even contradicting their own battle engine). Nescientist (talk) 23:55, 14 December 2016 (UTC)
Ok, I did the experiment in the actual games. I had my friend use a level 1 Pichu (SpA 6, holding Choice Specs) use Thunder Shock (BP 40) on my level 50 Minior (SpD 120) and level 63 Wishiwashi (SpD 182). In both cases I got 2 damage per attack, with and without Electric Terrain out. When the same was tried on my level 32 Pelipper (SpD 53; admittedly not great but all I had on-hand), it consistently took 4 damage, regardless of terrain. So Showdown's calculator is wrong! The Pelipper calculation, entered into the calculator with the exact stats, items, and terrain, is quoted at 12-16 damage (the calculator doesn't actually have Thunder Shock, so I used Charge Beam, which is only 10 power higher, but it shouldn't matter, seeing as everything from Nuzzle to Volt Tackle yields the same results). When removing terrain, the calculator's prediction drops down to 4, which says to me that it doesn't know what order to calculate terrain in. I know at high levels this probably won't matter too much, but this might still be wiggling the end results a few HP higher than you'd truly see in the game, so it may be worth them looking into. --MASLEGOMAN (talk) 06:25, 16 December 2016 (UTC)
Thanks for testing. That's actually a neat way to find out whether something "affects damage" or "affects power" (although moderately hard to execute). I'm personally always interested in any explicit confirmation on which it is (for anything, especially on whatever wasn't there back in Gen V).
FYI, you can just manually adjust the power of any move within that calculator, so you can have a Thunderbolt with BP 40 or whatever you like. Nescientist (talk) 11:14, 17 December 2016 (UTC)

## Regarding stacking "other" effects (attn: Nescientist)

On my talk page, while discussing this page before it was overhauled, User:Nescientist informed me of the exact formula used for applying multiple "other" effects in the damage calculation. A quote follows, for anyone else wanting to follow this conversation:

• FYI, the complex stuff is that those modifiers aren't really just decimals, but 16-bit integers that are then divided by 0x1000, and they are appended as M'' = ((M * M') + 0x800) >> 12 (Quote from User:Nescientist taken from User talk:Felthry)

I have done some analysis, and I am now reasonably certain that this is exactly multiplying the two numbers. Using sixteen-bit integers divided by 0x1000 is exactly equivalent to using Q3.12 fixed-point numbers to represent the data. This means that a value of 1 would be indicated as 0b0001 0000 0000 0000 (split into 4-bit blocks for readability), while 2 would be 0b0010 0000 0000 0000 and 1/2 would be 0b0000 1000 0000 0000. Multiplying these two numbers in the standard manner would be M'' = (M * M') >> 12. This is true because each number is, in effect, X << 12, where X is the intended value; << 12 is equivalent to multiplying by 212, or 0x1000. Now, if each number is represented as X * 0x1000, this means that multiplying M * M' would be the same as multiplying (X * 0x1000) * (Y * 0x1000). Dividing by 0x1000, equivalent to a right shift by 12 bits (i.e. >> 12), makes this into (X * Y) * 0x1000, which is exactly (X * Y) in the Q3.12 format.

Now for the interesting bit. What they have with the 0x800 here is actually to make the end result round properly, as opposed to simply truncating it as the normal method would. This is equivalent to adding 1/8192 to your final result; this number is used because the resolution of a Q3.12 number is 1/4096. If the bit in position 0x800 (i.e. the 12th bit from the right) is 0, adding 0x800 will do nothing, and this extra bit will be truncated off, thus rounding down, when the right shift occurs. If this bit is 1, adding 0x800 would have the effect of rounding up, adding 1/4096 to the truncated value, as the addition would cause a carry into position 0x1000.

Thus, the formula M'' = ((M * M') + 0x800) >> 12 is exactly the way to multiply two Q3.12 numbers or indeed any two Qn.12 numbers, while rounding in the conventional manner to be as accurate as possible.

Sorry for the impromptu lesson in fixed-point arithmetic; I wanted to prove this result rigorously so that we can be absolutely certain that it holds up! In fact, this also holds for 2's-complement signed fixed-point numbers, but I won't bother proving that as the "other" value is never negative. --Felthry (talk) 16:24, 28 February 2017 (UTC)

## Please fix the page

Whoever changed this page, please revert it. The new form is difficult to read (and by that I mean difficult to look at) and lacks information that the previous one had. If any changes or new information acquired, it requires only an addendum and not complete overhaul of the page. - unsigned comment from ‎RecoverShield (talkcontribs)

I'm quite sure most of our pages would actually look cleaner, had we ceased updating and correcting them.
Maybe just try to look out for benefits as well: For example, I'd argue the fact that it now "lacks" information it used to have actually is a benefit, for the most part: it was repetitive information (and/or didn't quite belong here in the first place).
If you do have a specific concern and/or recommendation, please feel free to bring it up.
(Maybe this as a side note: of course, it's easier not to change something than to change it, or to do a small scale change rather than a large scale one. It's also easier for readers to adapt to a tiny "addendum" than an "overhaul". Anyway, even though general statements like "If X, then just Y is required not Z!" are easy to be made, to be effective in a specific case like this, I think they also require a specific understanding of what X is, and what Y and Z would entail. As seen on this talk page and elsewhere, very roughly speaking, I and others more or less favored Z in this case.) Nescientist (talk) 16:13, 13 March 2017 (UTC)