1. Welcome to Smogon Forums! Please take a minute to read the rules.
  2. Click here to ensure that you never miss a new SmogonU video upload!

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

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

  1. X-Act

    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

    Joined:
    Feb 17, 2006
    Messages:
    4,675
    I prefer it as I wrote it, so that the formula looks simpler if anything.
  2. chaos

    chaos
    is a member of the Site Staffis a Battle Server Administratoris a Programmeris a Live Chat Contributoris a Contributor to Smogonis an Administratoris a Tournament Director Alumnusis a Researcher Alumnus
    Owner

    Joined:
    Dec 18, 2004
    Messages:
    10,612
    it's x-act's guide, just go with the modN stuff. please htmlize :)
  3. ryubahamut

    ryubahamut
    is a Site Staff Alumnusis a Programmer Alumnusis a Forum Moderator Alumnusis a Contributor Alumnus

    Joined:
    Jan 18, 2007
    Messages:
    999
    it's in progress, i am going to post it tomorrow

    sorry for the delay :(
  4. chaos

    chaos
    is a member of the Site Staffis a Battle Server Administratoris a Programmeris a Live Chat Contributoris a Contributor to Smogonis an Administratoris a Tournament Director Alumnusis a Researcher Alumnus
    Owner

    Joined:
    Dec 18, 2004
    Messages:
    10,612
    (no its not, that is queued for deletion)
  5. ryubahamut

    ryubahamut
    is a Site Staff Alumnusis a Programmer Alumnusis a Forum Moderator Alumnusis a Contributor Alumnus

    Joined:
    Jan 18, 2007
    Messages:
    999
    i got really busy with things, what with examinations and all, and will upload this by later tonight.
  6. chaos

    chaos
    is a member of the Site Staffis a Battle Server Administratoris a Programmeris a Live Chat Contributoris a Contributor to Smogonis an Administratoris a Tournament Director Alumnusis a Researcher Alumnus
    Owner

    Joined:
    Dec 18, 2004
    Messages:
    10,612
    don't sweat it
  7. david stone

    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

    Joined:
    Aug 3, 2005
    Messages:
    5,152
    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).
  8. X-Act

    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

    Joined:
    Feb 17, 2006
    Messages:
    4,675
    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.
  9. eric the espeon

    eric the espeon maybe I just misunderstood
    is a Forum Moderator Alumnusis a Researcher Alumnusis a CAP Contributor Alumnusis a Tiering Contributor Alumnusis a Contributor Alumnus

    Joined:
    Aug 7, 2007
    Messages:
    3,694
  10. david stone

    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

    Joined:
    Aug 3, 2005
    Messages:
    5,152
    DeepSeaScale is before Sandstorm.

    Huge Power / Pure Power is before ally's Flower Gift
  11. .River

    .River

    Joined:
    Jun 24, 2007
    Messages:
    1,274
    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.
  12. Theorem

    Theorem

    Joined:
    Aug 23, 2008
    Messages:
    1
    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.
  13. X-Act

    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

    Joined:
    Feb 17, 2006
    Messages:
    4,675
    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.

    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.

    The one on the site is the latest updated with the latest knowledge. This one here is outdated.
  14. timw06

    timw06

    Joined:
    Jun 27, 2007
    Messages:
    543
    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.
  15. MetalKid

    MetalKid

    Joined:
    Aug 5, 2005
    Messages:
    247
    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!
  16. X-Act

    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

    Joined:
    Feb 17, 2006
    Messages:
    4,675
    Which sites? The Smogon site's item page correctly says that they're boosted by 20%.
  17. MetalKid

    MetalKid

    Joined:
    Aug 5, 2005
    Messages:
    247
    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?
  18. david stone

    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

    Joined:
    Aug 3, 2005
    Messages:
    5,152
    Yes. You cannot just add Life Orb and have Reckless consider your move a recoil move.
  19. MetalKid

    MetalKid

    Joined:
    Aug 5, 2005
    Messages:
    247
    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?
  20. MetalKid

    MetalKid

    Joined:
    Aug 5, 2005
    Messages:
    247
    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!
  21. X-Act

    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

    Joined:
    Feb 17, 2006
    Messages:
    4,675
    I don't know, I didn't test Iron Fist.

    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.

    Flower Gift boosts the Attack of the ally.

    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.
  22. MetalKid

    MetalKid

    Joined:
    Aug 5, 2005
    Messages:
    247
    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...)
  23. X-Act

    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

    Joined:
    Feb 17, 2006
    Messages:
    4,675
    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.
  24. MetalKid

    MetalKid

    Joined:
    Aug 5, 2005
    Messages:
    247
    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?
  25. RBG

    RBG Trying to get my Smods back D:
    is a Site Staff Alumnusis a Smogon Social Media Contributor Alumnusis a Super Moderator Alumnusis a Live Chat Contributor Alumnusis a Researcher Alumnusis a Tiering Contributor Alumnusis a Battle Server Moderator Alumnus

    Joined:
    Jan 27, 2008
    Messages:
    3,409
    You floor after every operation.

Users Viewing Thread (Users: 0, Guests: 0)