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

X-Act

np: Biffy Clyro - Shock Shock
is a Site Staff Alumnusis a Programmer Alumnusis a Live Chat Contributor Alumnusis a Researcher Alumnusis a CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus
#51
A million thanks! I'm looking at those numbers right now.

Hmm. Peterko, this means that this uses the same x0.75 as for Surf, right? So that means that test is a success. :)

EDIT: Added Stomp information as a move with varying BP. Also, moves that hit both foes use the same x0.75 modifier as that used for moves that hit all Pokemon in 2vs2.

EDIT 2: Added freshly-researched information about Trump Card and Spit Up.
 

Peterko

Never give up!
is a Researcher Alumnusis a Contributor Alumnus
#52
this will be added the next time X-Act is on

Stockpiled 1 Spit Up = 100 BP
Stockpiled 2 Spit Up = 200 BP
Stockpiled 3 Spit Up = 300 BP

spit up ignores the random number between 85 and 100 in the damage formula, you will only do max damage

Trump Card:
5 PP : 40 BP
4 PP : 50 BP
3 PP : 60 BP
2 PP : 80 BP
1 PP : 200 BP

info about spit up and trump card posted in the research topic

http://www.smogon.com/forums/showthread.php?p=529704#post529704
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Staff Alumnusis a Programmer Alumnusis a Live Chat Contributor Alumnusis a Researcher Alumnusis a CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus
#53
Okay. We're at the point where if the Pokemon in question doesn't change its type (via Color Change, Camouflage, etc.) and/or ability (via Skill Swap, etc.), the damage formula is complete, to the best of our knowledge.

Thanks to everyone who has made this possible... although Peterko gets at least 95% of the thanks.
 
#54
That's awesome guys! Though knowing GameFreak, there's bound to be something down the road that will be found and need fixing :P

One question, with the stat modifiers, how is the rounding done? Like, if a Pokémon with 123 Attack got a +1 modifier, the stat would be 184.5 Obviously, we can't have a .5 stat, so the game would have to round it. I would assume the rounding would be done traditionally (ie. up if it's 5 or above, down for the rest), but with GameFreak you never know. I mean, it could be something obscure for all I know, like "always round down if a stat is being raised" and vise versa or something like that. It probably doesn't make much difference in the long run, but I'd just like to know.
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Staff Alumnusis a Programmer Alumnusis a Live Chat Contributor Alumnusis a Researcher Alumnusis a CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus
#55
One question, with the stat modifiers, how is the rounding done? Like, if a Pokémon with 123 Attack got a +2 modifier, the stat would be 184.5 Obviously, we can't have a .5 stat, so the game would have to round it. I would assume the rounding would be done traditionally (ie. up if it's 5 or above, down for the rest), but with GameFreak you never know. I mean, it could be something obscure for all I know, like "always round down if a stat is being raised" and vise versa or something like that. It probably doesn't make much difference in the long run, but I'd just like to know.
First of all, 123 attack gets to 184 with a +1 modifier, not +2.

Secondly, note: the stat would become 184. Pokemon uses what is called integer division in mathematics. You can read more about integer division here. It uses integer division for every calculation, basically.

In reality, Pokemon does not multiply by decimals, either. For example, in the example for the +1 stat modifier above, the game doesn't really multiply by 1.5. What it really does is multiply by 3, and then "integer divide" by 2. (That's why I wrote 3/2 next to the modifier). We prefer to multiply by 1.5 and then "round down" (technically, use the floor function) the answer because it's easier that way, for us humans.

Also, it does make a lot of difference. Just ask those people who would love to outspeed certain things. A difference of 1 in speed can make a hell of a lot of difference. That's why Speed IVs are arguably the most important ones to get 31 in.
 
#56
First of all, 123 attack gets to 184 with a +1 modifier, not +2.

Secondly, note: the stat would become 184. Pokemon uses what is called integer division in mathematics. You can read more about integer division here. It uses integer division for every calculation, basically.

In reality, Pokemon does not multiply by decimals, either. For example, in the example for the +1 stat modifier above, the game doesn't really multiply by 1.5. What it really does is multiply by 3, and then "integer divide" by 2. (That's why I wrote 3/2 next to the modifier). We prefer to multiply by 1.5 and then "round down" (technically, use the floor function) the answer because it's easier that way, for us humans.

Also, it does make a lot of difference. Just ask those people who would love to outspeed certain things. A difference of 1 in speed can make a hell of a lot of difference. That's why Speed IVs are arguably the most important ones to get 31 in.
Woops, sorry, by bad. I did mean +1, I'm not a total idiot, for some reason I put +2. Also, yeah, I guess it would make a difference in Speed, but for the actual damage formula, 1 point in Attack won't do a lot of harm. Good to know about the rounding thing.
 
#58
Alright, I'll get started on updating my D/P Damage Calculator to use the information you've found. I'll have to give credit to you guys for putting such a big thing together. I wonder if I can figure out how to work with Ajax so that the group boxes can auto fill with stuff specific to the Pokemon you select without having to postback the entire damn page...


Edit:
Oh man, this is going to take forever... lol...
 

david stone

Fast-moving, smart, sexy and alarming.
is a Site Staff Alumnusis a Programmer Alumnusis a Super Moderator Alumnusis a Live Chat Contributor Alumnusis a Researcher Alumnusis a Contributor Alumnusis a Battle Server Moderator Alumnus
#59
Does Guts + Burn truly bypass the Attack drop, or does it like still divide for the drop, then multiply to remove it, or does it do some other strange method?
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Staff Alumnusis a Programmer Alumnusis a Live Chat Contributor Alumnusis a Researcher Alumnusis a CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus
#60
A Guts Pokemon is not negatively affected by Burn... it is actually affected positively (it just gets the Guts boost and not the Burn drop).
 

Peterko

Never give up!
is a Researcher Alumnusis a Contributor Alumnus
#64
LOOL I told X-Act he shouldn´t write it that way :D :D :D

Façade - BP = 140 if the user is Paralyzed, Poisoned, or Burned, BP = 70 otherwise.
 
#68
You might want to add a calculation for Fury Cutter, Ice Ball and Rollout:

Fury Cutter:

Base Power = 10*(2^(n-1))
Where 'n' equals Fury Cutter number.

Ice Ball and Rollout (If Defense Curl has been used):

Base Power = 60*(2^(n-1))
Where 'n' equals Ice Ball/ Rollout number.

Ice Ball and Rollout (If Defense Curl has not been used):

Base Power = 30*(2^(n-1))
Where 'n' equals Ice Ball/ Rollout number.


Hope I helped :D.

EDIT:

Also, concerning the calculations of Punishment..

60+(20*Number of opponent's positive Stat modifiers)

By Stat Modifier you mean the -6 to +6 (in this case, 1 to 6)

Let's look at it from 6 positive Stat Mods:

60+(20*6)
60+120
180

You also say that it is capped at 200. This I don't see as the max number is actually 200, so it wouldn't go any higher anyway.

For those of you who don't know why it is 200 and not 180, it's because the number 6 (positive stat mods) actually includes the number 1 which would not change a value when multiplying any amount of numbers.

In plain English:

Lets say that we were using Punishment to the extent of 1 Positive Stat Mod. You would straight away think of the following formula:

60+(20*1)
60+20
80

As you can see there was no change to the BP.

Which means if you did have 6 Stat Mods it would actually use the following formula:

60+(20*7)
60+140
200

That is it's full potential.

Before I finish, I also need to state what happens if there are no positive Stat Mods. Normally you would`yse the following formula:

60+(20*0)
60+0
60

So, for 0 Stat Ups, is the power 0, and for 6 Stat Ups, is the Power 200?

EDIT:

Just realised, if what I have said about Punishment can be confirmed then you can use the following formula, and instead of adding 1 to the Stat Mod number, leave it as it is.

What I mean is, above I said that if you were to check the BP for Punishment with 6 Stat Mods, you would have to use the number 7, instead of 6.

Now, you can use 6 for 6 Stat Mods so there is no confusion:

60+(29*(n+1))
Where 'n' equals the number of positive Stat Mods.

it's not much of a difference, but it helps.
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Staff Alumnusis a Programmer Alumnusis a Live Chat Contributor Alumnusis a Researcher Alumnusis a CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus
#69
You might want to add a calculation for Fury Cutter, Ice Ball and Rollout:

Fury Cutter:

Base Power = 10*(2^(n-1))
Where 'n' equals Fury Cutter number.

Ice Ball and Rollout (If Defense Curl has been used):

Base Power = 60*(2^(n-1))
Where 'n' equals Ice Ball/ Rollout number.

Ice Ball and Rollout (If Defense Curl has not been used):

Base Power = 30*(2^(n-1))
Where 'n' equals Ice Ball/ Rollout number.


Hope I helped :D.
That is fine, but I think it's easier explained the way it's written in the guide.

... Punishment stuff ...
Umm, Punishment takes care of all the positive stat changes of the foe, not just one of them. That's why its power could exceed 200 if it is not programmed such that 200 is the highest damage allowed.
 
#70
So then what are the positive Stat Changes that the opponent can have?

It can have a max of 6 level increments but thats all I can think of, which gives it a total of 200 power.


Also, I found an error in your formula when inputting it in Excel:

You say that after each operation you need to round the number down to a significance of 0 (0dp).

Following the BODMAS rule you calculate what's embedded in brackets and then use the operating signs.

So:

Damage Formula = ((((((Level × 2 ÷ 5) + 2) × BasePower × [Sp]Atk ÷ 50) ÷ [Sp]Def) × Mod1) + 2) × CH × Mod2 × (R ÷ 100) × STAB × Type1 × Type2 × Mod3

Look at what's in bold. Let's say the Random Number was between 85 and 99. you do the division and you get any number between .85 and .99 . You round that number down to 0, and I guess you see the problem there.. Then you do 'x CH x Mod2 x 0, and your final answer will be.. 0.

I know there is something I am missing because after a bit of tweaking in Excel, I got past this so it is probably a Mathmatical error on my side, you can't blame me, I'm only 14...

Anyway, hope you can tell me what I did wrong from there..
 
#71
I'm pretty sure he meant the formula to be:
Damage Formula = ((((((Level × 2 ÷ 5) + 2) × BasePower × [Sp]Atk ÷ 50) ÷ [Sp]Def) × Mod1) + 2) × CH × Mod2 × R ÷ 100 × STAB × Type1 × Type2 × Mod3

That is, the division removes the last two digits from the previous result. Perhaps a more clear way of writing it would be:
((((((((Level × 2 ÷ 5) + 2) × BasePower × [Sp]Atk ÷ 50) ÷ [Sp]Def) × Mod1) + 2) × CH × Mod2 × R ÷ 100) × STAB × Type1 × Type2 × Mod3)

In such case, you round down after every sub-expression.
 

david stone

Fast-moving, smart, sexy and alarming.
is a Site Staff Alumnusis a Programmer Alumnusis a Super Moderator Alumnusis a Live Chat Contributor Alumnusis a Researcher Alumnusis a Contributor Alumnusis a Battle Server Moderator Alumnus
#72
.River, if my Salamence uses Dragon Dance 6 times, it has +6 Attack and +6 Speed. This is a total of 12 stat increases (6 + 6).
 
#73
Oh man, I thought it meant only for the attacking stat (my bad..)

Oh yeah, using that, in one of the modifiers it multiplies Life Orb with TVT.

In most cases TVT will be left as 1 so it will be 1.3 x 1 = 1.3 . Round that down to 1, so does that mean that Life Orb doesn't actually do anything?

EDIT:

Same with the Modifier where Expert Belt resides.
 

X-Act

np: Biffy Clyro - Shock Shock
is a Site Staff Alumnusis a Programmer Alumnusis a Live Chat Contributor Alumnusis a Researcher Alumnusis a CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus
#74
I fixed the damage formula slightly.

However, it must be said that the damage formula as listed here is always 'wrong', in the sense that it never uses decimals. So it never really multiplies by 0.5, or by 0.75, or by 1.5 or whatever.

I also fixed the variable moves list a bit with confirmed information.
 
#75
I fixed the damage formula slightly.

However, it must be said that the damage formula as listed here is always 'wrong', in the sense that it never uses decimals. So it never really multiplies by 0.5, or by 0.75, or by 1.5 or whatever.

I also fixed the variable moves list a bit with confirmed information.
So does this mean when putting Life Orb and such into account, it will never work?