Programming Pokémon Showdown Damage Calculator

pre

pkmn.cc
What i think is a bug with the +1 All Stats button
from what i understand it is supposed to emulate the effects of z-celebrate/hold hands/happy hour

When clicking on the button and then checking Stored Power, it shows its BP as 140 (and calcs 140 BP) when in game it should be 120. likely a bug not certain but im psure thats a mistake
^In addition, Stored Power damage is being negatively affected by negative stat changes, when those should not affect it.

E.g. If you have +2 attack, Stored Power does 60 instead of 20. If you have +2 attack and -2 defense, it should still do 60.
These should both be fixed (along with other moves which rely on the number of boosts).
 
Another bug:
193770


idrk how to explain but
if theres a mon in the calc (say Aerodactyl, but can be anything), your damage will calc off them and itll say their name in the calcs eg.
252+ Atk Donphan Rock Tomb vs. 0 HP / 4 Def Aerodactyl: 192-228 (63.7 - 75.7%) -- guaranteed 2HKO

with Aegislash-Shield, however, instead of saying vs. Aegislash-Shield it just says vs the previous mon that was in that slot.
the calcs still calc vs aegi-shield tho

So if i have a groudon in one slot and replace with aegislash-shield, im calcing v aegi but the text still says groudon

not sure if other mons have similar problems but i just encountered this
 
Two things regarding the GSC calculator:
1. DVs will not be imported to the calc as how you copied them from the teambuilder which is especially annoying for Hidden Powers since the type of those depends entirely on the DVs.
2. EVs (technically stat experience) can't be set at all (and thus also not imported how you have them in your team). Many players reduce the attack of pokemon without physical moves to lower the damage from hitting yourself in confusion. Sometimes you want to calculate the damage you do with Struggle or in confusion which currently can't be set at all in the calc.
 
Please use the package. The UI is not intended to be processed programmatically, you will have a much better time using the API directly.
not even for programs but manual usage and sorting/filtering to compare, the lack of a percentage is a pretty big wall block
 

Diophantine

Banned deucer.
At the time of writing this post, the damage calculator does not work for the Present glitch in Gen 2. While yes, this glitch only works with Gold and Silver (and not Crystal unless it's a link battle between Crystal and Gold/Silver) that is what Pokemon Showdown simulates. The correct Present mechanics are already implemented into Pokemon Showdown, and so it would be great to have this on the damage calc.
 
There's an error on Typhlosions page. If you pick the NU Typholosion, and change its item to none from Choice specs, it's attack drops as expected. But if you change it's the ability to none as well its attack shoots back up as if it has Choice specs still equipped.
 
Hello ! When you're using the calculator and you take a Pokemon whose set name is very long (like "Scizor-Mega (Monotype Offensive Swords Dance (Steel))," or the BSS Aegislash blade set ) there's a shift in the calculator page. It does that with Mozilla Firefox, but seems to be working fine using Microsoft Edge. Here's a screen
Capture.PNG
 
Hello, was just looking at acrobatics and aerial ace on mega scizor, and doing damage callcs against marshadow. Acrobatics says it will do 92% min (max attack adamant) but aerial ace says 75% min. I think acrobatics is not being correctly calculated due to scizor holding a mega stone over another item
When you click a sample set whose name ends in "-Mega", the item doesn't import properly. Manually changing the form to the mega form and manually changing the item to the mega stone both work just fine. It breaks only when it tries to import a mega evolved sample set from Smogon.
mega.png
 
  • Like
Reactions: pre

Austin

Schismatic
is a Programmeris a Community Contributoris a Forum Moderator Alumnusis a Battle Simulator Moderator Alumnus
I've got a question about the damage formula. I built my own calculator in a spreadsheet a while back but I've never been able to exactly match showdown's calcs. The min and max rolls will always be extremely close but a little bit off. My calculator is linked here (I've left this sheet open for edits so you can change things). I've looked through the github to try to find the exact damage formula used but I'm not really a programmer and kinda got lost in all the text.

Would anyone be able to check out my calculator and help me find out what is making my results slightly off? I feel like it has to come down to rounding somewhere and I've triple checked everything twice. The formula I'm using to get a damage percentage is shown below. This is getting me the results I show in the example below.

=(FLOOR.MATH(FLOOR.MATH(FLOOR.MATH(2*100/5+2)*BasePower*Attack/Defense)/50)+2)*Modifier/HP

Where the showdown calc gives this:
252+ SpA Life Orb Triage Charizard-Mega-Y Oblivion Wing vs. 252 HP / 252 SpD Kartana: 320-376 (99.3 - 116.7%) -- 87.5% chance to OHKO

My calculator gives the min roll as 99.0% and max roll as 116.5%.
This is for the PS calc, not to help you with your calc. You could post a thread in TP(after you’re read the section readme) or feel free to contribute to our calc :)
 

Heika

I may very well be the worst player on this site
is a Pre-Contributor
Not sure it is the place for this, but I'd like to suggest a change regarding how the "+1 all stats" works. Currently if you use this feature and then change the selected pokemon, it will remains enabled, granting +1 in all stats to a second pokemon, which is subjectively annoying, and objectively makes no sens since if you got an omniboosted pokémon and switch it out, the omniboost will vanish (not with Baton pass but it's more of an exception than a rule).
Tl:dr: the way it currently works is in my opinion really unintuitive and prone to lead people into misscalculations
 
Multiscale and Shadow Shield are resisting every hit of a multihit.

252 Atk Cloyster Icicle Spear (5 hits) vs. 0 HP / 0 Def Multiscale Dragonite: 340-420 (105.2 - 130%)

252 Atk Cloyster Icicle Spear (5 hits) vs. 0 HP / 0 Def Dragonite: 680-840 (210.5 - 260%)

I'm not 100% certain if this is actually a bug because I can't currently test it, but it doesn't seem right.
 

The Official Glyx

Banned deucer.
Suggestion: make the pokemon selection drop down lists present solely the species of the pokemon and nothing else after selecting which set you'd like to calc with. If you manually clicked the set, odds are you don't need to be reminded of what the name of the set is afterwards, which would also help prevent scenarios stemming from convoluted set names like below-
1573008124245.png
 
Hi! I'm here to report a calculator mistake in Gen 8 Battle Stadium Doubles.

Well, besides the immediate issue that there is still no Gigantamax.

https://replay.pokemonshowdown.com/gen8battlestadiumdoubles-1014558947

So, I have a Dynamax Gengar, and my opponent has a Dynamax Charizard. On turn 3, he uses Max Flare, and it takes 100% of my Dynamax Gengar's health. In spite of the Sun/Solar Power, something about that seemed very off to me.

I know PS's calc is still set to Gen 7, so I went over to Trainer Tower's calculator. https://damagecalc.trainertower.com

I put in all the options to make the scenario exactly as the one I had encountered, and sure enough, the calculator said the damage should have been 75.5%-88.8% for a Charizard with max SpA investment to my Gengar. That is under no circumstance a OHKO, as the Pokemon Showdown engine determined it to be.

Can someone please look into this? I'm playtesting for VGC, I would really appreciate it to be accurate!
First, contrary to what you stated in the replay, Gigantimaxing does not give more health. Both Dyna and Giga double your Pokemon's HP.

Second, how much bulk are you running on that Gengar? According to the calculator you linked, Charizard cleanly OHKOs a Dynamaxed Gengar with a standard offensive spread.

252 SpA Solar Power Charizard Max Flare (130 BP) vs. 0 HP / 4 SpD Gengar in Sun: 276-325 (204.4 - 240.7%) -- guaranteed OHKO

Keep in mind that with double the HP, an attack would need to do 200% to OHKO a Dynamaxed Pokemon.
 
Last edited:
Hi! I found out Monotype oldgens are written out of the calculator. Can we get a fix for this? This greatly affects us because we run many, many tours (including official ones) with oldgens. Our circuit playoffs start next week and the games are played in SM. We cannot afford to have the calc failing to provide sets during our most important individual tour. Thanks!

Quite frankly, I don’t see any reason to limit any tier to only current, not just Monotype. All the C&C teams put hours upon hours into writing and checking analyses, and to only allow certain tiers to have oldgen analyses using an entirely arbitrary basis is very strange.
Hello ! When you're using the calculator and you take a Pokemon whose set name is very long (like "Scizor-Mega (Monotype Offensive Swords Dance (Steel))," or the BSS Aegislash blade set ) there's a shift in the calculator page. It does that with Mozilla Firefox, but seems to be working fine using Microsoft Edge. Here's a screen View attachment 196836
Hi this happens to me on Chrome too. I’d take a screenshot but it looks exactly the same.
 

Ginger Princess

Girl moding so hard rn
is a Site Content Manager Alumnusis a Forum Moderator Alumnusis a Community Contributor Alumnusis a Top Contributor Alumnus
^ would like to add on to this, 1v1 as well lost all of our Gen 7 sets on calc that were published Gen 7, which is kind of crazy considering how important the extremely specific EVs of each set are for making accurate plays in the metagame. Gen 7 will be entering 1v1 Old Gens soon, and the support of the calc would be extremely beneficial for future 1v1 Classics and Old Gen tournaments. Don't want to reiterate, but there doesn't seem to be a reason at all to remove any of these old analyses, and I can't wait until this issue is resolved
 

pre

pkmn.cc
Removal of old gen sets for these metagames was a deliberate decision by Honko: https://github.com/smogon/damage-calc/issues/343#issuecomment-521694883. "...Balanced Hackmons, Monotype, 1v1, and CAP. The last four are only whitelisted for the current gen."

I see no problem including sets for old metagames with a new calc design where sets are lazily loaded on demand, but I am not a fan of forcing all users to download large amounts of super niche sets that they'll never use with the current architecture. At least in the short term I'm OK with extending the whitelist to include Gen 7 as well during this transitional period, but will draw the line at supporting generations further back than that until the calculator has been redesigned.
 
Removal of old gen sets for these metagames was a deliberate decision by Honko: https://github.com/smogon/damage-calc/issues/343#issuecomment-521694883. "...Balanced Hackmons, Monotype, 1v1, and CAP. The last four are only whitelisted for the current gen."

I see no problem including sets for old metagames with a new calc design where sets are lazily loaded on demand, but I am not a fan of forcing all users to download large amounts of super niche sets that they'll never use with the current architecture. At least in the short term I'm OK with extending the whitelist to include Gen 7 as well during this transitional period, but will draw the line at supporting generations further back than that until the calculator has been redesigned.
Monotype is literally an official tier and one of the largest communities on Smogon and PS. We also have one of the largest ladder usages amongst Smogon tiers as well. I completely disagree with the idea that we are “super niche” compared to certain metagames on the list that aren’t limited. This is a breaking change for our community.
 
Couldn't agree more with TDA. I really want to expand on the importance of the calc for 1v1 specifically. In this metagame, matchups are key as the battles are won and lost based on them and them alone. For new players, knowing what they have to EV to either live or beat is crucial for creativity and ease of access. We've published over 50 analyses, in part to show players what the EV benchmarks are going to be for metagame sets; this change makes it extremely inconvenient. Gen 7 is still relatively popular and playable on the ladder; as we start to head into 1v1 PL season where Gen 7 1v1 will play a major competitive role, we strongly urge the readdition of these sets until the new calc is released.
 

queso

too cheesy
is a Tiering Contributor
Hi, I was asked by the Help Chat to post here.

I wanted to calculate EVs for my pokemon but on lvl 50. As far as I know I get 1 stat point for exactly 8 EV points. When I have less than 8, it grants 0 stat points.

So I took Wash-Rotom and set the HP EVs to 172 (which is 21.5 when divided by 8). I thought it should give 21 extra HP but the calculator showed 22.

So my question is: Is the rounding wrong or is my assumption wrong?


Granted points should be something like:

C++:
//stat bonus calculation:
//to explain the code (which I think it does itself):
//floor is the rounding down function no matter what
// getHPEVs is a sample function to get EVs. Could have used an enum for the type but meh. We don't have coding lessons here. ;)
// multiply by 0.25 is the same as dividing by 4 (4 EV points are one stat point) but faster.
// then we have a factor that uses the quotient of the current level and the max level.
// I hope I don't have to say that getCurrentLvl and getMaxLvl should return doubles/floats
int bonus = (int)floor( getHPEVs() * 0.25 * (getCurrentLvl() / getMaxLvl()) );
if you have an odd iv number then the first 4 evs increase the stat by one, and then every 8 from then on. if you have even iv then it works as you described it. this is because at level 50 the sum of the ev/4 and the ivs are divided by two and then floored. (you can read more at https://www.smogon.com/dp/articles/mechanics_level50 or https://bulbapedia.bulbagarden.net/wiki/Statistic#Formula)
 

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

Top