1. Welcome to Smogon Forums! Please take a minute to read the rules.

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

Discussion in 'Archives' started by X-Act, Jul 18, 2007.

1. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
Damage Formula = (((((((Level × 2 ÷ 5) + 2) × BasePower × [Sp]Atk ÷ 50) ÷ [Sp]Def) × Mod1) + 2) ×
CH × Mod2 × R ÷ 100) × STAB × Type1 × Type2 × Mod3

You would floor after each call, like BasePower, Att/def stat, etc... You would not floor within something like BasePower during

BasePower = HH × BP × IT × CHG × MS × WS × UA × FA
right? It would make no sense here because if you did Helping Hand, which is 1.5 and floored that, it would always be 1.0, resulting in no bonus ever.

Thus, when you look at this:

[Sp]Def = Stat × SM × Mod × SX

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

However, you would multiply everything out in for that Mod, returning the result, without flooring, then calculate the total stat (no flooring inside), and when you finally return the result for the def stat, you would floor right before it. Right?
2. ### RBGTrying to get my Smods back D:

Joined:
Jan 27, 2008
Messages:
3,407
The Mods are just there so the formula isn't longer and biigeer than it has to look.

3. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
Oh, I see... I would floor (helping hand * base power) then take that result and multiply by the item, flooring that result, etc. Right?

Joined:
Jan 27, 2008
Messages:
3,407
Exactly
5. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
The move Me First looks like it makes things very complicated. When figuring out the bonuses of things like Ability and Item modifiers for various parts of the formula, should Me First be used or should the Defending Pokemon's attack be used instead? Thanks!

For example, Me First is a Normal move... If the opponent used Bite, which is Dark, and Absol used Me First, would the move now get STAB, too?
6. ### X-Actnp: Biffy Clyro - Shock Shock

Joined:
Feb 17, 2006
Messages:
4,675
Yes, it would. The on battle text would go something like this:

Lucario used Me First!
Lucario used Hammer Arm!
It's super effective!
Lucario's Speed fell!
Rhydon fainted!

Hence it's as if Lucario used the move Hammer Arm with x1.5 power, with the speed drop and all. Since Lucario is a Fighting-type Pokemon, it boosts the move also due to STAB. So it gets a x1.5 boost due to STAB and a x1.5 boost due to Me First.
7. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
Holy crap... That makes my programming even harder now... Dammit... Oh wait, I can just put a checkbox in to say that you used that move instead, which just gives the 1.5x bonus automatically.

Hey, I'm getting close to finishing the code up for this thing... Are there some situations you have for the damage it causes so I have something to test against? Thanks!

Edit:

It looks like you are missing a few things when it comes to abilities. You never mentioned how to apply any of these abilities:

Levitate
Volt Absorb
Water Absorb
Motor Drive

I don't remember exactly, but I thought there was something that overrides the Levitate ability?

I would assume, though, that these are supposed to be applied during the Mod3 phase?
8. ### X-Actnp: Biffy Clyro - Shock Shock

Joined:
Feb 17, 2006
Messages:
4,675
Gravity overrides Levitate ability, but it also overrides the Flying typing.

Those 4 abilities would negate damage completely for Ground, Electric, Water, and Electric moves respectively.
9. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
Forgot to mention Wonder Guard, the Type changing plates of Arceus, Air Lock & Cloude Nine override weather, Battle Armor negates Critical Hits, etc... Lots of abilties affect the damage dealt, but they are not metioned... Is this on purpose?
10. ### X-Actnp: Biffy Clyro - Shock Shock

Joined:
Feb 17, 2006
Messages:
4,675
Well, if they override things, you just don't multiply or multiply the relevant thing? Why should they be mentioned?
11. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
If they aren't mentioned, people who are trying to apply the formula are not going to know about those things that automatically override everything unless they specifically look for them on their own.
12. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
(Since no one responded, I can't edit or no one will respond)

Where would Intimidate get placed in the order of things? During the Ability Modifier? If so, would it come before or after the Attacker's Ability? Thanks!
13. ### RBGTrying to get my Smods back D:

Joined:
Jan 27, 2008
Messages:
3,407
Intimidate is a stat modifier, so it falls in the -1, -2, -3 ect for attack
14. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
Oh my god, I feel stupid... Thanks...
15. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
I have a question on the move Me First. It says that it uses the opponent's move... If that is the case, should the base attack power be calculated based on the Opponent's move instead of Me First's AP? Me first is not mentioned in Section 2. Thanks!

Edit: Also, when applying effectiveness, do I use Me First's type or the attacker's move type? Thanks!
16. ### Archer

Joined:
Dec 22, 2007
Messages:
101
Eruption is 150 Power at full health, whereas Weather Ball is 100.
So if they have the same type, and get the weather boost...

150*1.5 > 100*1.5, no?
17. ### david stoneFast-moving, smart, sexy and alarming.

Joined:
Aug 3, 2005
Messages:
5,152
Moreover, you can never use Netbattle / Shoddybattle to test things. The developers don't have any extra information we don't have; in fact, they often use Smogon's dexes to find how to code things.
18. ### MetalKid

Joined:
Aug 5, 2005
Messages:
246
Which ability will end up taking precedence? Wonder Guard or Mold Breaker? Would Mold Breaker cause Wonder Guard to not function? Thanks!
19. ### Veedrock

Joined:
Oct 18, 2008
Messages:
2,779
Mold Breaker negates Wonder Guard.

Also from Shedinja's analysis: