Programming Pokémon Showdown Damage Calculator

FriendOfMrGolem120

aka. FOMG
is a Forum Moderatoris a Community Contributoris a Contributor to Smogonis a Battle Simulator Moderatoris a defending SPL Champion
Moderator
The damage calculator says that in Gen 2, Hydro Pump from a level 50 Starmie is a guranteed OHKO against a full health level 50 Marowak, displaying the roll like this: Starmie Hydro Pump vs. Marowak: 158-186 (95.1 - 112%) -- guaranteed OHKO
Interestingly enough, if you take off Hidden Power from Marowak (which only adjusted the attack and physical defense DVs), it shows more accurate odds: Starmie Hydro Pump vs. Marowak: 158-186 (95.1 - 112%) -- 71.8% chance to OHKO
CalcError.png
 

cherryb0ng

formerly Makkususu
The damage calculator says that in Gen 2, Hydro Pump from a level 50 Starmie is a guranteed OHKO against a full health level 50 Marowak, displaying the roll like this: Starmie Hydro Pump vs. Marowak: 158-186 (95.1 - 112%) -- guaranteed OHKO
Interestingly enough, if you take off Hidden Power from Marowak (which only adjusted the attack and physical defense DVs), it shows more accurate odds: Starmie Hydro Pump vs. Marowak: 158-186 (95.1 - 112%) -- 71.8% chance to OHKO
I noticed this with other calcs as well, though I don't recall which ones. I may provide examples in the future of the percentage of KO threshold misrepresenting the amount of a pokemon's health a certain attack depletes
 

Martin

cute cute
is a Forum Moderatoris a Live Chat Contributoris a Contributor to Smogon
Moderator
You may have given a reason for why the calculator does this instead of calculating correctly in the past that I can't find, in which case I apologise, but the way multi-hit moves interact with Multiscale/Shadow Shield on the calculator is currently incorrect. This was reported twice in 2019, first by DaWoblefet in July as part of a big Parental Bond fix and then later by DrPumpkinz in November in relation to Icicle Spear in a report that appears to have been buried. I also checked the old thread in IS and there wasn't anything about it in there.

I was doing some calcs of Double Iron Bash vs Multiscale Dragonite and thought the numbers looked wrong, so I checked each hit independently using a modified Iron Head and it was doing what I thought: if the Pokémon's HP is at 100%, Multiscale/Shadow Shield will weaken both hits of the move instead of only weakening the first, resulting in an output which is 3/5 of the correct value:

Tested: Melmetal (OU Protect) vs Dragonite (OU Dragon Dance)
Calculator output: 144–172 (unfavourable chance to 2HKO)
Correct output: (80+160)–(95+190) = 240–285 (guaranteed 2HKO)

After checking this, I checked a few other multi-hit moves and got the following results:

Tail Slap: Incorrect
Tested: 252 Atk Cinccino Tail Slap (5 hits) vs. 0 HP / 0 Def Multiscale Dragonite: 85-105 (26.3 - 32.5%)
Calculator output: 85–105 (guaranteed 4HKO)
Correct output: (17+4(34))–(21+4(42)) = 153–189 (favorable chance to 2HKO)

Triple Axel: Incorrect
Tested: 252 Atk Cinccino Triple Axel (40 BP) (3 hits) vs. 0 HP / 0 Def Multiscale Dragonite: 222-264 (68.7 - 81.7%) -- approx. 2HKO
Calculator output: 222–264 (guaranteed 2HKO)*
Correct output: (38+148+224)–(46+176+264) = 410–486 (guaranteed OHKO)

*it also seems to calculate it as 40,40,40 instead of 20,40,60. This would cause problems even if Multiscale did work correctly, as the first hit would need to be half of a 20 BP hit: not half of a 40 BP hit.

Parental Bond: Correct
Tested: 252+ Atk Parental Bond Kangaskhan-Mega Double-Edge vs. 0 HP / 0 Def Multiscale Dragonite
Calculator output: 163–193
Correct output: (109+⌊0.25(219)⌋)–(129+⌊0.25(258)⌋) = 163–193

Surging Strikes: Incorrect
Tested: 252 Atk Choice Band Urshifu-Rapid-Strike Surging Strikes (3 hits) vs. 0 HP / 4 Def Shadow Shield Lunala on a critical hit:
Calculator output: 279–327
Correct output: (51+2(102))–(60+2(121)) = 255–302

As you can see, while this was corrected on Parental Bond following DaWob's bug report, no other multi-hit moves that I tested work correctly, resulting in large inaccuracies with the damage outputs. Especially considering that both Melmetal and Dragonite currently reside in the same tier, this issue needs fixing with regards to both the Multiscale interaction and how Triple Axel and Triple Kick have their damage calculated. I haven't tested any other generations, but I'm going to presume that the code was ported forward and that the bug, therefore, persists backwards.

Also, while I'm still thinking about it, it'd be nice if, after fixing Triple Axel/Triple Kick, you could to add the option to check how much damage they would do if they only hit once or twice, as each hit has that trolly independent accuracy check that cancels any subsequent attacks when it fails.
 
Last edited:
Maybe this is a problem only in old generations. I found the bug when I was using the gen 4 calculator.
yeah that's it, tried it myself and the damage didn't change at all, works in every other gen. Probably related to how it's a smaller damage modifier in gen 4 than every other gen. (I believe 10% boost per attack in gen 4 and 20% in the rest)
 
It's not a bug from Showdown! exactly, more like a bug I discovered onto the damage calculator, about the Utility Umbrella mechanics. It's supposed to ignore effects from rain/sun, especially damage boosts/nerfs, and that's where it's broken : the calculator don't count it. Playing Ubers, rain is especially important and an important calc is broken so :
calc broken.JPG
What actually should be calculated is : 252 SpA Choice Specs Kyogre Water Spout (150 BP) vs. 240 HP / 0 SpD Eternatus: 213-251 (44.2 - 52.1%) -- 17.2% chance to 2HKO
You can find a replay showing that Showdown! itself does the good damage calculation there, I used the 252 Spa / 252 Spe Specs Timid Kyogre against a 252 HP / 252 SpA Modest Eternatus in both teams. The only thing that I changed is the Utility Umbrella on Eledyyr's Eternatus, and we can
see the reduced damages taken.
 
Last edited:
The calculator behaves incorrectly for some pokemon with damage-boosting abilities (e.g. Iron Fist, Adaptability). It seems to be that if the pokemon has an ability like this in its first slot, the calculator will apply that ability if "(other)" is selected (including from selecting a blank set). See screenshots:
Screenshot 2021-02-24 175017.png
Screenshot 2021-02-24 175041.png
 

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

Top