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

#### MetalKid

You floor after every operation.
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?

#### RBG

##### Trying to get my Smods back D:
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?
The Mods are just there so the formula isn't longer and biigeer than it has to look.

Damage Formula Article said:
It should be immediately mentioned that after successfully performing an operator (an operator being +, -, × or ÷), you need to "round down" the number to the nearest whole number before performing the next one. In simple terms, this means to remove all the numbers to the right of the decimal point every time the answer is a decimal before proceeding with the next arithmetic operation.

#### MetalKid

Oh, I see... I would floor (helping hand * base power) then take that result and multiply by the item, flooring that result, etc. Right?

#### MetalKid

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?

#### X-Act

##### np: Biffy Clyro - Shock Shock
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?
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.

#### MetalKid

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?

#### X-Act

##### np: Biffy Clyro - Shock Shock
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.

#### MetalKid

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?

#### X-Act

##### np: Biffy Clyro - Shock Shock
Well, if they override things, you just don't multiply or multiply the relevant thing? Why should they be mentioned?

#### MetalKid

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.

#### MetalKid

(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!

#### RBG

##### Trying to get my Smods back D:
(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!
Intimidate is a stat modifier, so it falls in the -1, -2, -3 ect for attack

#### MetalKid

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!

#### Archer

Also, does Rain and Sunlight provide the additional 1.5x boost?

Edit: I remember testing this with Smeargle in Netbattle (Eruption VS Weather Ball under Sunny Day), and found that Eruption did more Power in the Sunlight.

So I guess, Sunny Day and Rain Dance do not provide an additional 1.5x boost, but then again, that was for the ADV Generation. I can't test the DPP gen. due to Shoddy/NBS not working for me. It may be a good idea to provide this information.
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?

#### david stone

##### Fast-moving, smart, sexy and alarming.
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.

#### MetalKid

Which ability will end up taking precedence? Wonder Guard or Mold Breaker? Would Mold Breaker cause Wonder Guard to not function? Thanks!

#### Veedrock

Mold Breaker negates Wonder Guard.

Mold Breaker Page said:
If this Pokémon attacks and the target's ability would prevent the effects of the attack from taking place, or hinder the effects of the move, the ability is temporarily nullified while the attack is in progress. Abilities nullified are: Battle Armor, Clear Body, Damp, Dry Skin, Filter, Flash Fire, Flower Gift, Heatproof, Hyper Cutter, Immunity, Inner Focus, Insomnia, Keen Eye, Leaf Guard, Levitate, Lightningrod, Limber, Magma Armor, Marvel Scale, Motor Drive, Oblivious, Own Tempo, Sand Veil, Shell Armor, Shield Dust, Simple, Snow Cloak, Solid Rock, Soundproof, Sticky Hold, Storm Drain, Sturdy, Suction Cups, Tangled Feet, Thick Fat, Unaware, Vital Spirit, Volt Absorb, Water Absorb, Water Veil, White Smoke, Wonder Guard. Dry Skin's increase in damage when hit by a Fire move is also ignored.
Also from Shedinja's analysis:

Shedinja's Analysis said:
Let’s go through the complete list of everything that can kill Shedinja.

Fire / Flying / Dark / Ghost / Rock moves, non-Fighting / Normal attacks from a Mold Breaker Pokémon, Poison, Burn, Leech Seed, Confusion damage, Sandstorm, Hail, Spikes / Stealth Rock, Nightmare, Darkrai’s Bad Dreams, Life Orb recoil, Double-Edge recoil, Struggle, Struggle recoil, Destiny Bond, Perish Song, Aftermath, Rough Skin, Future Sight / Doom Desire, Ghost-type Curse, Jaboca/Rowap Berry recoil, and absorbing health against a Pokémon with Liquid Ooze.