• The moderator of this forum is jetou.
  • Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon, and make sure you take some time to read the global rules.

Programming Pokémon Showdown Damage Calculator

While entry hazards are toggled, in addition to displaying %KO after hazards, is it feasible for phasing moves to display how many phasings will KO?

Also, can the calculator's output be given a more nuanced tense? If a mon's HP after the next hit isn't greater than a turn of sand chip, it's a KO after 1 Hit & 1 sand chip. Yet the calculator calls this a guaranteed 2HKO even if it's not guaranteed that a 2nd hit will ever happen.

with Leftovers held & Sand toggled (1 chip=full/16), the events headsup will be:
Turn 1: 1st Option
Turn 1: 1st Hit (full-dam1)
100 % GTOneHitKO if full>max, else
100 % OneHitKO unless full>min, thence
100 % = OneHitKO % + GTOneHitKO %.
Turn 1: 1st Sand (full-dam1-chip)
100 % GTOneHitSandKO if full>max+chip, else
100 % OneHitSandKO unless full>min+chip, thence
100 % = OneHitSandKO % + GTOneHitSandKO %.
Turn 1: 1st Leftovers (full-dam1)
Turn 2: 2nd Option
Turn 2: 2nd Hit (full-dam1-dam2)
100 % GTTwoHitKO if full>2*max, else
100 % TwoHitKO unless full>2*min, thence
100 % = TwoHitKO % + GTTwoHitKO %.
Turn 2: 2nd Sand (full-dam1-dam2-chip)
100 % GTTwoHitSandKO if full>2*max+chip, else
100 % TwoHitSandKO unless full>2*min+chip, thence
100 % =TwoHitSandKO % + GTTwoHitSandKO %.
Turn 2: 2ndLeftovers (full-dam1-dam2)
Turn 3: 3rd Option
...

my head hurts after pondering the output's tense, but I think there's an inconsistency about the reference point in each turn period. like i think the calculator sometimes calculates the odds to KO over time in the moment after a move has hit but before the turn has ended which is a point where the player has no options, so that calculation is out of phase with the actual times that players can make decisions.
 
Last edited:
The following Gen 3 sets have the wrong hidden power IVs since they don't need the 31st IV to push beyond 252 EVs:

Bug:
Golem: OU Choice Band; UU Choice Band.
Trapinch: NU Choice Band.
Sandslash: UU Swords Dance, Choice Band.
Graveler: NU Choice Band.
Forretress: OU Standard; Ubers Support.
Donphan: OU Choice Band.
Tyranitar: OU Bulky Dragon Dance.
Armaldo: OU Rapid Spin, Knock Off, Choice Band.
Groudon: Ubers Choice Band.
Rayquaza: Ubers Choice Band.

Flying:
Gyarados: OU Standard, Rest.
Raichu: RU Mixed Sweeper.
Feraligatr: Physical Sweeper.
Jumpluff: OU Offensive; UU Swords Dance.
Sceptile: OU Swords Dance Mixed Sweeper.
Ariados: ZU Agility.
Dragonite: OU Standard Dragon Dance, Choice Band, Offensive Dragon Dance.
Gligar: UU Swords Dance + Salac.
Altaria: UU Dragon Dance.
Tropius: NU Swords Dance (PU Swords Dance does run max speed); ZU Physically Defensive

there may be mistakes in some of the special hidden power types, but those are harder for me to find with control-f since possibly minimizing attack causes so many variations.


I've written a few spreadsheet formulas that may be useful, I'll see if I can track down my most refined versions of them:
OPTIMAL_IVS( [Species], [HidPow_Type], [set_HP], [set_Atk], [set_Def], [set_SpA], [set_SpD], [set_Spe] ) = let(

[array {h, a, d, c, e, s}], { [set_HP], [set_Atk], [set_Def], [set_SpA], [set_SpD], [set_Spe] },
[array { [base stats }] , [lookup base stats],
[array { hv, av, dv, cv, ev, sv }], [formula I wrote somewhere that calculates total IVs & EVs to obtain the target stats that even optimizes nature, distributes remaining EVs, & readjusts the build if the hidden power is changed],
av, index( [^], 2 ), dv, index( [^], 3 ), cv, index( [^], 4 ), ev, index( [^], 5 ), sv, index( [^], 6 ),

phys_types, { "fig", "fly", "poi", "gro", "roc", "bug", "gho", "ste" },
spec_types, { "fir", "wat", "gra", "ele", "psy", "ice", "dra", "dar" },
hpt, iferror( iferror( match( left( [HidPow_Type], 3 ), phys_types, 0 ), - match( left( [HidPow_Type], 3 ), spec_types, 0 ) ), 0 ),

output, makearray( 6, 1, lambda( r, c, ifs(
hpt=1, if( r>2, 30, 31 ),
hpt=2, if( sv=94 , if( r<6, 30, 31 ), if( r>3, 30, 31) ),
hpt=3, if( or( r<3, r=6 ) , 31 , 30 ),
hpt=4, if( or( r<4, r=6 ) , 31 , 30 ),
hpt=5, if( or( r<3, r=4 ) , 31 , 30 ),
hpt=6, ifs( r=4 , 31, sv=94, if( or( r=1, r=6 ), 31, 30 ), 1, if( r>4, 30, 31 ) ),
hpt=7, if( or( r=if( av<dv, 2, 3 ), r=5 ) , 30 , 31 ),
hpt=8, if( ev=94 , if( or( r=1, r=5 ), 31, 30 ) , if( r=5, 30, 31 ) ),
hpt=-1, if( r=if( av=94, 3, 2 ), if( av<31, 2, 30 ), if( isodd( r ), 31, 30 ) ),
hpt=-2, ifs( or( r=1, r=5 ), 31, or( av=94, dv=94 ), if( r<4, 31, 30 ), 1, if( r=6, 31, 30 ) ),
hpt=-3, ifs( r=4, 30, r=if( av=94, 3, 2 ), if( av<31, 2, 30 ), 1, 31 ),
hpt=-4, if( cv=94, ifs( r=2, if( av<31, 2, 30 ), or( r=3, r=6 ), 30, 1, 31 ), ifs( r=2, if( av<31, 3, 31 ), r=4, 30 , 1, 31 ) ),
hpt=-5, ifs( r=6, 30, av>dv, if( r=3, 30, 31 ), 1, if( r=2, if( av<31, 2, 30 ), 31 ) ),
hpt=-6, ifs( and( av<31, dv=94 ), ifs( r=2, 3, r=6, 30, 1, 31 ), sv=94, ifs( r=2, if( av<31, 3, 30 ), r=3, 30, 1, 31 ), 1, if( r=6, 30, 31 ) ),
hpt=-7, if( r=if( av=94, 3, 2 ), if( a<31, 2, 30 ), 31),
hpt=-8, if( r=2, if( av<31, 3, 31 ), 31 ) ,
(av<31)*(r=2), 0,
1, 31 ) ) ), output )
 
Last edited:
The way the Showdown Calc calculates multi-hit moves is wrong, or at least very weird. Im using Nerd of Now here to demonstrate but like you can hand calculate the chances, which I did for the Urshifu ones

2 examples here, the first is Nerd of Now second is Showdown Damage Calc

252+ Atk Urshifu-Rapid Strike Surging Strikes (3 hits) vs. 244 HP / 132 Def Flutter Mane on a critical hit: 138-165 (85.7 - 102.4%) -- 1.98% chance to OHKO
(46, 46, 48, 48, 48, 49, 49, 51, 51, 51, 52, 52, 52, 54, 54, 55)

252+ Atk Urshifu-Rapid-Strike Surging Strikes (3 hits) vs. 244 HP / 132 Def Flutter Mane on a critical hit: 138-165 (85.7 - 102.4%) -- approx. 18.8% chance to OHKO
Possible damage amounts: (138, 138, 144, 144, 144, 147, 147, 153, 153, 153, 156, 156, 156, 162, 162, 165)

and

252 Atk Ogerpon Bullet Seed (5 hits) vs. 244 HP / 132 Def Flutter Mane: 135-165 (83.8 - 102.4%) -- 0.02% chance to OHKO
(27, 27, 28, 28, 28, 28, 30, 30, 30, 30, 30, 31, 31, 31, 31, 33)

252 Atk Ogerpon Bullet Seed (5 hits) vs. 244 HP / 132 Def Flutter Mane: 135-165 (83.8 - 102.4%) -- approx. 6.3% chance to OHKO
Possible damage amounts: (135, 135, 140, 140, 140, 140, 150, 150, 150, 150, 150, 155, 155, 155, 155, 165)

Showdowns calc takes the first damage value and assumes its doing the same damage for the rest of the hits, thus inflating OHKO chances. With Urshifu for example, 3 of the scenarios deal over 161 damage to flutter. Theres a 3/16 chance its 54 or 55, which x3 is 162 and 165 damage, which OHKOes 18% of the time. Damage is calculated per hit, Nerd of Now does it that way and has the true damage chance. If you by hand calculate the first Urshifu calc, its 1.8%.

Screenshot 2025-01-11 at 12.07.18.png
Screenshot 2025-01-11 at 12.07.39.png
 
Boosted Knock Off seems to be calculated with 97 BP, despite the calc saying it's 97.5 BP.
I've modified Throat Chop's base power to 97 in the following screenshots:
1736578918359.png

1736578959776.png

The two have identical damage rolls.
Update: Boosted Knock Off is 97 BP in-game. The text is wrong, but the damage calc is correct.
 
Last edited:
Boosted Knock Off seems to be calculated with 97 BP, despite the calc saying it's 97.5 BP.
I've modified Throat Chop's base power to 97 in the following screenshots:
View attachment 703618
View attachment 703619
The two have identical damage rolls.
Update: Boosted Knock Off is 97 BP in-game. The text is wrong, but the damage calc is correct.

This is not quite accurate.
Screenshot 2025-01-11 235918.png

Screenshot 2025-01-11 235905.png

In all calcs here, Hold Back is modified to be a 97 BP Dark-type move if you want to run it yourself.

Knock Off ingame is not technically 97.5 BP but instead is a 65 BP move with a 6144/4096 modifier if the conditions for bonus damage are met. This is applied alongside other modifiers applied to base power, such as Tough Claws, Toxic Boost, Supreme Overlord, or type-specific items like Blackglasses, prior to rounding.

Screenshot 2025-01-12 001646.png

Screenshot 2025-01-12 001656.png


If the item boost from Knock Off is the only BP modifier, then it will have rolls identical to a 97 BP move due to how the damage formula rounds here, but other modifiers that apply to the base power (NOT something like STAB, type effectiveness, or Choice Band, which apply later on after a rounding step occurs) can result in it behaving differently from a 97 BP move.
 
Back
Top