PokéBase - Pokémon Q&A

# What is the actual pokémon damage formula?

5,827 views

Bulbapedia states that the pokémon damage formula is `floor(((2 * L + 10) / 250) * (A / D) * B + 2)`: However, when I was reading the source code of Pokémon Showdown I found that the damage formula that they are using is `floor(floor(floor(2 * L / 5 + 2) * B * A / D) / 50) + 2` before multiplying the modifier.

Do these two equations always produce the same answer? If not then which one is the correct one?

Woah (filler) o.0

They equal the same thing. If you care about how they are the same, you present the first +2 as +10/5, like so:

`= (2 * L / 5 + 2) * B * A / D) / 50) + 2`
`= ((2 * L + 10) / 5) * B * A / D) / 50) + 2`

And then you can multiply the /5 and the /50 to make it /250 in the first bit, and then present the `B * A * D` bit as `(A * D) * B`, like so:

`= ((2 * L / 10) / 5) * B * A / D) / 50) + 2`
`= ((2 * L + 10) / 250) * B * A / D) + 2`
`= ((2 * L + 10) / 250) * (A / D) * B + 2`

And now it's exactly like Bulbapedia's formula! You can substitute the same values into each formula to confirm that they both equal the same thing. Sorry if that was a bad explanation. It's not easy explaining math in words. It's not even important anyway.

Sometimes people like changing a formula to make it look neater. Bulbapedia's equation format looks nice when it is presented how it is in that image, but Showdown's equation format is good when you must keep your equation to one line, like in coding.

Hope I helped. :)

edited
Hope you don't mind the change I made, markdown was reading the asterisks as text formatting and it made the equations look odd.
I am but sad I have one upvote to give.
Oh I never saw that. Thank you.
Your reasoning is wrong. It doesn't take rounding into account. For example, consider a level 51 pokémon with 125 attack using a 100 base power move on a pokémon with 112 defense. Using the equation `floor(floor(floor(2 * L / 5 + 2) * B * A / D) / 50) + 2` gives the answer 51. However, using the equation on Bulbapedia gives the answer is 52.
Yeah rounding is a thing, which obviously isn't a problem normally but metagames like LC and whatnot rely heavily on rounding to optimise, so it'd be nice to specify accuracy.

...