• The moderators of this forum are Austin and pre.
  • Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon.

Other Excel Based Damage Calculator (Fixed Calc in edited post)

For convenience, 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 showdown 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.

The spreadsheet is pretty basic. You enter the values for the variables in the blue cells, like STAB, boosts, etc, and the offensive and defensive stats for each mon and it gives you a min and max roll. I just can't get my min/max to match showdown's results.

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%.
 

pre

shaving yaks and herding cats
is a Battle Simulator Administratoris a Programmeris a Super Moderator
Builder
Nice work, a loser. I would suggest going off of DaWoblefet's article and not putting 100% faith in either Pokemon Showdown or the official damage calculator getting things right on. While they code should be correct in like 95%+ cases (probably 99%+), there are still several subtle known issues related to rounding or other things that haven't been fixed yet, and it's entirely possible you actually implemented things correctly (and we'd be happy if you wanted submit patches for any fixes!)
 
Thanks to both of you! This article looks very helpful already. I figured I was off due to rounding, and I had no idea about pokerounding lol.

Edit: I've updated since reading that article and the calculator is working much better now! I've implemented pokerounding into the script on google sheets and am coming up with answers that match showdown's calcs. Only thing I'm realizing is that for the same example in my OP, looks like showdown's calc is cutting off the percentage at 99.3% and not rounding from the hundredth place decimal. My calc is getting 99.38% but rounding up to 99.4%.

Updated calc here if you want to see. Lots of the modifier calcs are hidden in rows 32-77 if you wanna dig around in there.
 
Last edited:

DaWoblefet

Demonstrably so
is a Smogon Social Media Contributoris a Top Researcheris a Tiering Contributoris a Battle Simulator Moderator
Edit: I've updated since reading that article and the calculator is working much better now! I've implemented pokerounding into the script on google sheets and am coming up with answers that match showdown's calcs. Only thing I'm realizing is that for the same example in my OP, looks like showdown's calc is cutting off the percentage at 99.3% and not rounding from the hundredth place decimal. My calc is getting 99.38% but rounding up to 99.4%.
Yeah, for some reason they floor the decimal rather than rounding when displaying the percentage of damage. I personally don't like that decision very much. My ideal representation personally would be your normal school rounding, done to two decimals, but in any case, the PS calc representation is just a matter of formatting and not an error in calculation.
 

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

Top