[on site] The Complete Damage Formula for Diamond & Pearl

obi

formerly david stone
is a Site Content Manager Alumnusis a Programmer Alumnusis a Senior Staff Member Alumnusis a Smogon Discord Contributor Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
I prefer it as I wrote it, so that the formula looks simpler if anything.
But if you perform the operations as described, you will not always get the correct answer.

For example, let's assume a Pokemon with 100 Attack is using a neutral Explosion on a Pokemon with 300 Defense. It's 2v2 and Reflect is in effect.

(taking out all the x1)

Damage = 100 × 2 ÷ 5 + 2 × 250 × 100 ÷ 50 ÷ 300 × Mod1 + 2

Or, simplified even more...

Damage = 70 * Mod1 + 2

Doing it by breaking it up as I suggested gives a value of 36 for the damage, which I suspect is the correct result. Doing it as written in the guide gives 2 (2/3 * .75 = .5, which rounds down to 0, and 70 * 0 = 0, then you add 2).

Or, let's say I'm using Heat Wave in 2v2 and Sunny Day is in effect. 201 Attack and 109 Defense, neutral and no STAB. The simplified formula for that would be

Damage = 153 * Mod1 + 2

Doing as I suggested gives 173. Doing as written gives 2 or 154, depending on how you read it. A loose reading could give 174, which is close, but not accurate (and if you were to further compound this with making it 4x effective, and possibly adding more multipliers, this could get magnified).
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
Damage = 70 * Mod1 + 2

Doing it by breaking it up as I suggested gives a value of 36 for the damage, which I suspect is the correct result. Doing it as written in the guide gives 2 (2/3 * .75 = .5, which rounds down to 0, and 70 * 0 = 0, then you add 2).
No. The damage would be

70 x 2/3 x 0.75 + 2 = 36

You don't round down Mod1 itself. I never said that. I said to round down after every multiplication and division performed.

If you round down Mod1, Mod2 and Mod3, most of the time you end up with 0, 1 or 2. Of course I didn't mean that. Come on.

I wrote that example in the guide in as clear a way as possible, in a step-by-step fashion. I think I tried to explain the process exactly, but tried also to make it simple even for people that are not that good at maths. I appreciate the fact that the majority of people that read this article don't have a high mathematical background. If people can do better, by all means go ahead.
 

obi

formerly david stone
is a Site Content Manager Alumnusis a Programmer Alumnusis a Senior Staff Member Alumnusis a Smogon Discord Contributor Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
DeepSeaScale is before Sandstorm.

Huge Power / Pure Power is before ally's Flower Gift
 
I have a couple of questions which are stopping me from finishing a Javascript version of this.

1. Each time you say to *Mod1 or /[SP]Def there's two ways to go about it.

Let's go with SP.Def:

Current Battle Damage = 50 (example)
SPDef Modifier = 25
Damage now = 50 / 25, then round down = 2.

But you could go about it a different way. If you do current damage / the first modifier in the sp.def part, then the second modifer etc.

Which way that I suggested is correct, or have I completely lost it? I've read through this thread about 5 times so far, and read through the full analysis on the website and here so many times but nothing suggests this.

Thanks,
Viral.
 
First of all, thanks for the formula, X-Act and Peterko.

I have a couple of questions regarding the order of operations.

The first one is the same as River's.
If we actually ignore the bodmas rule (as stated), we'll obtain
Code:
value / Stat * SM * Mod * SX
Should we replace the * in the spDef formula by /, or should we calculate the (Stat * SM * Mod * SX) first?


Secondly, in the Section 2: Base Power and its modifiers:
if we actually use 3/2 instead of 1.5, it should be BasePower = BP * HH * ..., right?

By the way, when was the on site version updated? Maybe it should contain the "last updated" date? Is it up to date with the current knowledge?

Thanks in advance for the replies.
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
If we actually ignore the bodmas rule (as stated), we'll obtain
Code:
value / Stat * SM * Mod * SX
Should we replace the * in the spDef formula by /, or should we calculate the (Stat * SM * Mod * SX) first?
For SpA and SpD, you should calculate the stat completely first (Stat * SM * Mod * SX), then use it for the division. For the others, you just work from left to right.

Secondly, in the Section 2: Base Power and its modifiers:
if we actually use 3/2 instead of 1.5, it should be BasePower = BP * HH * ..., right?
I don't follow. If you use 3/2 instead of 1.5, you should multiply by 3, then divide by 2, then continue with the other modifiers.

By the way, when was the on site version updated? Maybe it should contain the "last updated" date? Is it up to date with the current knowledge?
The one on the site is the latest updated with the latest knowledge. This one here is outdated.
 
As you wrote, I've to round down after every multiplication and division performed.
In Pokemon the rule is always; round down (floor) the result whenever you hit a decimal so that's after every multiplier using none-integers.
 
Hey, you mention that all type-boosting items multiply the base power by 1.2... However, all the item descriptions say it is 10%... Which is correct? Thanks!
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
Which sites? The Smogon site's item page correctly says that they're boosted by 20%.
 
Oh, didn't realize they had it posted... :) I just was checking vs Serebii, even tho that is usually a bad thing to do.

Dammit, this sux... Now I have to have seperate item descriptions for 3rd gen vs 4th gen in my database... ugh... :(

Reckless - Whenever this Pokémon uses a move with recoil, including Hi Jump Kick and Jump Kick, the base power is increased by 20%. Struggle is not boosted. Does not apply to Life Orb.

What does "Does not apply to Life Orb." mean? If Life Orb is in play, it boosts the damage by 30% and does not apply this 20%?

For Iron Fist Ability, moves Dizzy Punch, Dynamicpunch, and Shadow Punch are not mentioned. Do they get boosted 20%, too?
 

obi

formerly david stone
is a Site Content Manager Alumnusis a Programmer Alumnusis a Senior Staff Member Alumnusis a Smogon Discord Contributor Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
Yes. You cannot just add Life Orb and have Reckless consider your move a recoil move.
 
Unanswered Questions:

For Iron Fist Ability, moves Dizzy Punch, Dynamicpunch, and Shadow Punch are not mentioned. Do they get boosted 20%, too?

If you used Head Butt with Life Orb, then the damage would get increased by 50% (20% life orb + 30% from Reckless), right? The recoil would be the normal recoil damage + 10% of Max HP, too, right?

In section 3B: If there are two simultaneous boosts in the Attack stat, first apply the attacking pokemon's ability boost, then the allies ability boost. What is this referring to? No abilities boost ally stats for the Attack stat... Or was it meant to be special attack?
 
I have some more questions... No one seems to be answering them, so please read the above post and this one.

"If there are two simultaneous boosts in Mod, first apply the ability boost, then the item boost, and finally the Sandstorm boost."

This is just an example of the defense stat. Does this mean that you need to keep multiplying (or adding) all the numbers together, or just that which ever one is last takes precedence.

For example: Lets say Latias (lets say it is Rock type) has Marvel Scale, is poisoned, has Soul Dew, and Sandstorm is in play. Would this be either 3.375, 4.5, or 1.5 in the end? Thanks!
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
Unanswered Questions:

For Iron Fist Ability, moves Dizzy Punch, Dynamicpunch, and Shadow Punch are not mentioned. Do they get boosted 20%, too?
I don't know, I didn't test Iron Fist.

If you used Head Butt with Life Orb, then the damage would get increased by 50% (20% life orb + 30% from Reckless), right? The recoil would be the normal recoil damage + 10% of Max HP, too, right?
Headbutt isn't a recoil move. You mean Head Smash? (But Hitmonlee doesn't learn it.) Anyway, if Hitmonlee uses Hi Jump Kick and has Life Orb, the damage would be increased first by 20% and then by 30%. Meaning you first multiply by 1.2 and then by 1.3.

In section 3B: If there are two simultaneous boosts in the Attack stat, first apply the attacking pokemon's ability boost, then the allies ability boost. What is this referring to? No abilities boost ally stats for the Attack stat... Or was it meant to be special attack?
Flower Gift boosts the Attack of the ally.

"If there are two simultaneous boosts in Mod, first apply the ability boost, then the item boost, and finally the Sandstorm boost."

This is just an example of the defense stat. Does this mean that you need to keep multiplying (or adding) all the numbers together, or just that which ever one is last takes precedence.

For example: Lets say Latias (lets say it is Rock type) has Marvel Scale, is poisoned, has Soul Dew, and Sandstorm is in play. Would this be either 3.375, 4.5, or 1.5 in the end? Thanks!
Marvel Scale boosts Defense while the other two boost Special Defense. So your defense would be boosted by 1.5 times and your Special Defense would first be boosted by 1.5 times due to Soul Dew and then again by 1.5 times due to Sandstorm.
 
Flower Gift boosts the Attack of the ally.
So this means that during the Ability calculation, if someone has Huge Power, it would set it to 2.0. If a partner had Flower Gift, 2.0 would be multiplied by 1.5, giving 3.0 as the total result for the ability modifier?

(I swear this damage calculator programming is going to be the death of me...)
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Content Manager Alumnusis a Programmer Alumnusis a Smogon Discord Contributor Alumnusis a Top Researcher Alumnusis a Top CAP Contributor Alumnusis a Top Tiering Contributor Alumnusis a Top Contributor Alumnusis a Smogon Media Contributor Alumnusis an Administrator Alumnus
No, you don't multiply the 2.0 by 1.5; you first multiply the attack stat by 2, and then multiply the resulting attack stat by 1.5.

I know that it results in the same attack stat in this case, but sometimes it doesn't.
 
No, you don't multiply the 2.0 by 1.5; you first multiply the attack stat by 2, and then multiply the resulting attack stat by 1.5.

I know that it results in the same attack stat in this case, but sometimes it doesn't.
Seeing as how multiplication is transitive, I don't see how it could be different, unless you take Math.Floor after each iteration. However, I thought were were supposed to do that at the end of each of the different sections, not within each section?
 
Seeing as how multiplication is transitive, I don't see how it could be different, unless you take Math.Floor after each iteration. However, I thought were were supposed to do that at the end of each of the different sections, not within each section?
You floor after every operation.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top