Programming Pokémon Showdown Damage Calculator

Colteor

Free old gens in WCOP
is a Pre-Contributor
RoAPL Champion
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)
 

Eledyr

Le vilain petit Wooloo
is a Site Content Manageris a Top Social Media Contributoris a Community Leaderis a Community Contributoris a Tiering Contributoris a Top Contributoris a Smogon Media Contributoris a Dedicated Tournament Host
Translations Leader
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
 

Ununhexium

I closed my eyes and I slipped away...
is a Community Contributoris a Smogon Discord Contributoris a Contributor to Smogonis a Smogon Media Contributoris a Social Media Contributor Alumnusis a Forum Moderator Alumnus
any chance you could add a feature to add a turn of Protect as an option to accumulate extra Leftovers / Black Sludge / Poison Heal recovery? for example it may have a 10% chance to 2HKO but if you Protect in the middle it would drop to 0
 

SparksBlade

is a Tournament Directoris a Community Leaderis a Community Contributoris a member of the Battle Simulator Staffis a Top Dedicated Tournament Host
Community Leader
double post cos completely different purpose+don't want any devs to miss it due to an edit

A button in damage calc to deactivate all special conditions. Instead of unselecting rain+light screen+2 spikes etc, just a button to put all of those back to default. I suggest including dynamax, crits, z moves, and the number of hits for multi hit moves in this as well.
 

Martin

A monoid in the category of endofunctors
is a Smogon Discord Contributoris a Forum Moderator Alumnusis a Community Contributor Alumnusis a Contributor Alumnus
Magic Guard isn't currently programmed to ignore Sticky Barb for some reason:

252 SpA Choice Specs Dragapult Shadow Ball vs. 252 HP / 0 SpD Clefable: 178-211 (45.1 - 53.5%) -- guaranteed 2HKO after Sticky Barb damage

There doesn't appear to be any info regarding the interaction with MG on the Showdown/Smogon dexes, but MG users seem to be immune in battles on Showdown and Bulbapedia says that it is ignored by Magic Guard, so I figure it's just an unintended omission.

=================

Also lmk if part of this is an actual mechanic that I don't know about, but the damage calc will ALWAYS give Zacian, Zamazenta, Zacian-C, and Zanazenta-C +1 regardless of whether they have Intreped Sword/Dauntless Shield or not and, regardless of whether this is supposed to happen, Dauntless currently does not work correctly.

To check whether this was just a bug that arises when removing the ability, I manually edited Cobalion's stats to match those of Zamazenta-C and had the two use Close Combat on each other and non-DS Zama-C had the same damage calc as Cobalion:

252+ Atk Zamazenta-Crowned Close Combat vs. +1 64 HP / 0 Def Cobalion: 312-368 (91.4 - 107.9%) -- 50% chance to OHKO
252+ Atk Cobalion Close Combat vs. +1 64 HP / 0 Def Zamazenta-Crowned: 312-368 (91.4 - 107.9%) -- 50% chance to OHKO

I then checked against a blank set Zama-C and it appears the +1 is still said "vs +1 Zamazenta-Crowned" even when Dauntless Shield wasn't on it in the first place:

0 Atk Zamazenta-Crowned Close Combat vs. +1 0 HP / 0 Def Cobalion: 236-278 (72.6 - 85.5%) -- guaranteed 2HKO
0 Atk Cobalion Close Combat vs. +1 0 HP / 0 Def Zamazenta-Crowned: 236-278 (72.6 - 85.5%) -- guaranteed 2HKO

I tried going to Aboma and then back to Zama in case it was just a bug going from one Zac set to another and it persisted.

I then removed Dauntless Shield from the Cobalion and checked the Zama CC calc again. The +1 vanished from the text but the damage stayed the same:

0 Atk Zamazenta-Crowned Close Combat vs. 0 HP / 0 Def Cobalion: 236-278 (72.6 - 85.5%) -- guaranteed 2HKO

I then manually applied +1 Def and the damage decreased as expected:

0 Atk Zamazenta-Crowned Close Combat vs. +1 0 HP / 0 Def Cobalion: 158-188 (48.6 - 57.8%) -- 95.7% chance to 2HKO

Finally, I checked regular Zamazenta and, like Zama-C, the +1 text without any real boost was automatically applied regardless of whether it had Dauntless Shield or not.

TL;DR:
  • Zamazenta and Zamazenta-C have been hard-coded to have the effect of Dauntless Shield applied to the calc text but the output is otherwise unaffected
  • Dauntless Shield automatically applies the +1 calc text but the boost isn't ever substituted into the output formula
I've not done a comparison with a fake Zacian/Zacian-C for Intreped Sword, but I assume it's been implemented in the same way considering the same text bug appears for both Zacs regardless of whether they have Intreped Sword or not. The damage seems to work correctly for these though.
 
Last edited:

Greybaum

GENTLEMAN, THIS IS DEMOCRACY MANIFEST
is a Community Contributoris a Tiering Contributoris a Contributor to Smogon
Multiscale and Shadow Shield currently do not reduce damage if the "Stealth Rock" button is selected, even if Heavy Duty Boots are worn. The same is true for Spikes, provided the pokemon in question is not immune to them (i.e. not a Flying-type).
On a side note could these abilities get a checkbox like Intimidate has?
 
The calculator considers multi-hits moves (eg. Dual Wingbeat) entirely halved by attack-reducing berries (eg. Coba Berry) instead of halving only the first hit.

252+ Atk Ninjask Dual Wingbeat (2 hits) vs. 0 HP / 0 Def Coba Berry Ninjask: 210-248 (79.8 - 94.2%) -- approx. 2HKO
This should deal around 120% (40+80%) or more in reality.
Lost a Same Solo tournament because of it :c
Code:
Ninjask @ Coba Berry
Ability: Speed Boost
EVs: 252 Atk / 4 Def / 252 Spe
Jolly Nature
- Acrobatics
- Bug Bite
- Agility
 
Last edited:
The Calculator doesn't seem to take into account the effects of the Utility Umbrella, and how it both negates sun/rain boosted moves against the holder and makes Weather Ball a 50bp normal move against the holder.
 

Ehmcee

A Spoopy Ghost
is a Pre-Contributor
On a similar note, a dynamaxed weather ball is supposed to turn into a max move of the corresponding weather type, however it stays as max strike on dynamaxed pokemon.
 
Request, is it possible to add to the all vs one and one vs all calc a way to calculate only custom sets? to make it easier to calc for formats like BSS factory, 1v1, and OM?
 

Delta 2777

Machampion
is a Tiering Contributor Alumnusis a Contributor Alumnusis the Smogon Tour Season 10 Champion
Forgive me if I'm not using the exactly correct technical terms here:

For the random battles damage calculator, the calculator will not work over certain connections. This is because it appears some content is not served entirely via https, and certain connections/VPNs (including the one I use) block requests that don't use https. You can see a screenshot attached from the Chrome developer console demonstrating with the issue.

I'm aware there are ways to get around this issue on my end, but they are fairly inconvenient, and was hoping if this isn't too difficult of a fix that something could be done here. Thanks.
 

Attachments

Neuroforce:
220 Atk Neuroforce Necrozma-Ultra Photon Geyser vs. 0 HP / 0 SpD Toxapex: 288-338 (119.5 - 140.2%) -- guaranteed OHKO
220 Atk Necrozma-Ultra Photon Geyser vs. 0 HP / 0 SpD Toxapex: 288-338 (119.5 - 140.2%) -- guaranteed OHKO

1.25x on super effective hits doesn't register, please fix, thanks.
 
Can someone verify whether the halving nature of strong winds is calculated before or after wonder guard? I have the feeling that it is before, considering that this custom game (where corviknight had both a wacan berry and wonder guard) did not get affected by thunderbolt under strong winds, but the damage calc says otherwise. This is because the damage calc currently puts the strong winds check after the wonder guard check.
Screen Shot 2021-04-01 at 9.18.23 PM.png

Neuroforce:
220 Atk Neuroforce Necrozma-Ultra Photon Geyser vs. 0 HP / 0 SpD Toxapex: 288-338 (119.5 - 140.2%) -- guaranteed OHKO
220 Atk Necrozma-Ultra Photon Geyser vs. 0 HP / 0 SpD Toxapex: 288-338 (119.5 - 140.2%) -- guaranteed OHKO

1.25x on super effective hits doesn't register, please fix, thanks.
I patched this a few months ago, but it looks like the site hasn't updated its code in a while.
 
Normalize is making Struggle act like a Normal move when it probably shouldn't.

Normalize Mew Struggle vs. Arceus-Ghost: 0-0 (0 - 0%) -- possibly the worst move ever
252+ Atk Silk Scarf Normalize Mew Struggle vs. 252 HP / 252 Def Mew: 85-102 (21 - 25.2%) -- 0% chance to 4HKO
252+ Atk Mew Struggle vs. 252 HP / 252 Def Mew: 40-48 (9.9 - 11.8%) -- possible 9HKO
 
While having a discussion in the BS room i decided to go check some Rivalry calcs and it looks they're bugged this gen? Whereas they look right in XY. (didn't check SM)
Screenshot_2021-04-07-15-06-32-1.png

Screenshot_2021-04-07-15-06-10-1.png

some raw calcs
252 Atk Life Orb Rivalry nerfed Haxorus Close Combat vs. 140 HP / 0 Def Abomasnow: 380-447 (106.7 - 125.5%) -- guaranteed OHKO

252 Atk Life Orb Rivalry buffed Haxorus Close Combat vs. 140 HP / 0 Def Abomasnow: 354-419 (99.4 - 117.6%) -- 93.8% chance to OHKO

252 Atk Life Orb Haxorus Close Combat vs. 140 HP / 0 Def Abomasnow: 471-556 (132.3 - 156.1%) -- guaranteed OHKO
 
Rivalry is showing that pokemon that share a gender with the target (male pokemon vs male pokemon), do less damage than when they attack a pokemon with a different gender (male vs female)
 
https://replay.pokemonshowdown.com/gen8ou-1320198594-jzsprexoyeo85ouoed7qhshuktpedmrpw

It's a calc bug. Zamazenta's on switch in boost is not calculated in the calc. Proof is in the replay and in the calc itself. The tested sets were the ones that are in the calc.
The ranges : +6 252+ Atk Linoone Stomping Tantrum vs. +1 64 HP / 0 Def Zamazenta-Crowned: 346-408 (101.4 - 119.6%) -- guaranteed OHKO
It is supposed to ohko but it deals 69% damage to the zamazenta. Which is the range at "+2"
+6 252+ Atk Linoone Stomping Tantrum vs. +2 64 HP / 0 Def Zamazenta-Crowned: 232-274 (68 - 80.3%) -- guaranteed 2HKO
 
So two issues:
  1. Utility umbrella not ignoring rain's damage boost
  2. Celesteela's "OU usage" set is seems mixed up, the movesets are the typical protect,leech seed set yet the EVs are max spa and max speed with modest as if it's the meteor beam set.
 
sand is misimplemented in adv


1607229493363.png


this ones correct cause it correctly implements sand in the turn order, so it records this as being a sure 2hko


1607229403756.png


which isnt reflected here, sulcalc implements these slightly more niche, harder to catch things p well;

making some more small tweaks to account for more niche stuff like would be great

sorry to bother, awesome tool overall, thanks for all the hard work
 

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

Top