Programming Showdex - An Auto-Updating Damage Calculator Built into Showdown!

copying damage calc on stours does nothing, you can click it as many times as you want but it will never copy
Hmm... are you on HTTP or HTTPS when you're visiting Smogtours? Also, which browser are you using?

We've come across this bug before, but it was because we were on HTTP instead of HTTPS. Seems to not want to copy to the user's clipboard on HTTP sites, probably as a built-in security measure.
 
  • Like
Reactions: Ara
Hi, loving this tool! Been working fine as a Chrome extension on Windows 10. I was trying it out on my laptop (Macbook Pro M1 Max) as an extension in Ungooogled Chromium and while it loaded and I could adjust all the settings and even see trainer data (name & ELO) in-battle, none of the pokemon or sets or anything else filled in. I am currently unable to test regular Chrome on my laptop to see if that works, but I did test it out on Ungoogled Chromium on my Windows PC and it seemed to work fine right off the bat. So my guess is there may be some issue interacting with the Apple Silicon architecture? Perhaps something similar to the apparent issue with Chromebooks? Just wanted to put this out there.
First time ever hearing about the Ungoogled Chromium project, interesting! Is this the one you're talking about?

From what you've described, seems to be an issue with the mechanism that downloads sets. Can you try and disable all of the options that download sets to see if at least all the Pokémon load?

Showdex doesn't mess with any OS-/architecture-specific calls and only interfaces with the browser via WebExtension APIs.

I'm thinking it could be an issue with some Chromium browsers not fully implementing the Manifest V3 (MV3) spec, particularly chrome.runtime.sendMessage(), which is used to call fetch() on the browser's side to get around a security policy that prevents injected JavaScript from calling fetch() directly (not the case with MV2). Since the sendMessage() never returns when filling in the Pokémon, the Calcdex endlessly hangs waiting for a response.
 
possible bug? weavile doesn't have icicle crash in its learnset.
Nice find!

We pull the learnsets directly from Showdown (via BattleTeambuilderTable.learnsets) and after checking what Showdown has loaded, seems that Icicle Crash is in fact missing from its learnset:

Code:
> BattleTeambuilderTable.learnsets.weavile
JSON:
{
  ...
  "icebeam": "45678pqg",
  "icepunch": "45678pqg",
  "iceshard": "45678g",
  "iciclespear": "8g",
  "icywind": "45678pqg",
  "irontail": "45678pqg",
  "knockoff": "45678pq",
  "laserfocus": "78q",
  ...
}
May be a bug with Showdown itself, or I'm not reading the learnsets correctly. I'll post a Showdown bug report and see what happens.

---

Edit: On closer inspection, seems that the Teambuilder has no issues recognizing Icicle Crash as part of Weavile's learnset, so it's probably not a Showdown bug. I'll look into the Teambuilder code to see how they pull this data.
 
Last edited:
First time ever hearing about the Ungoogled Chromium project, interesting! Is this the one you're talking about?

From what you've described, seems to be an issue with the mechanism that downloads sets. Can you try and disable all of the options that download sets to see if at least all the Pokémon load?

Showdex doesn't mess with any OS-/architecture-specific calls and only interfaces with the browser via WebExtension APIs.

I'm thinking it could be an issue with some Chromium browsers not fully implementing the Manifest V3 (MV3) spec, particularly chrome.runtime.sendMessage(), which is used to call fetch() on the browser's side to get around a security policy that prevents injected JavaScript from calling fetch() directly (not the case with MV2). Since the sendMessage() never returns when filling in the Pokémon, the Calcdex endlessly hangs waiting for a response.
Yes that is indeed the correct project. I like the utility of Chrome but I hate Google; this is a nice solution. I've tried your setting suggestions and unfortunately it does not seem to fix the issue. It does seem weird that it worked fine when I tested it on my PC, so its possible I have some weird hidden settings that may be affecting it. Though your thought about sendMessage seems like it might be it.


Since I have you, I just wanted to share some thoughts/ideas/suggestions.

I really like the automatic filling of revealed moves/items (I do believe, or so it seems, that the moves reveal the lowest usage % first, which is really a nice touch thank you), but I think it would be more helpful if instead of just filling in that slot, it tried to switch the whole set (save other revealed moves) to one with that move. Though I guess not that many pokemon have multiple Smogon sets, and the usage data doesnt show parings of moves. So if say Tangrowth was revealed to use sleep powder, then the whole set should adjust from the AV Smogon set to the rocky helmet one. Or vice versa if it was revealed Tangrowth did not have a rocky helmet.

On that note in particular, while moves like life orb and rocky helmet get revealed and populate the item field, if a set with such an item is filled in and it is revealed the pokemon does not have that item, it should at least switch to the next most common item as per usage. For example, I was against Slowbro and after hitting it with a contact move, I did NOT take rocky helmet damage. Thus I presumed it was boots as thats the next most common item, but Showdex did not update the item slot can kept it as rocky helmet.

Another example of this is with damage rolls. A banded set might load in but then when the mon does less than the range, it shouldn't continue to say it is banded. it should pick the next most common item if applicable (not already revealed that it cant be, like LO or lefties). Obviously it is impossible to tell sometimes because of the damage ranges but this would include 1.2x boosting items.

Likewise if the damage roll is related to the EVs rather than an item (since you know your EVs, getting hit would likely be the cause of an opponent's item (I mean who runs something like banded without EV investment), and hitting the opponent would be a matter of their EVs (or Assault Vest I guess)). So for example if I hit Volcanion with EQ and it does less than expected, then it is probably running the Bulky set from doubles OU and it should repopulate. Or at the very least adjust some EVs based on Showdown usage. (The natures should probably also be sorted by usage.)


I was using AV Melmetal against Zapdos and I wanted to go for Earthquake to predict the Roost, but there was no way for me to see how much damage it would do since it was just N/A since Zapdos has the flying type. Perhaps where the pokemon's type is shown you can click the type to change it or make it grey out and not be calculated in damage/STAB? Flying types are certainly the most common use here but other times when it would be helpful include: soak, removal of forest's curse / trick-or-treat (via switch in and out), burn up, among other moves/circumstances.
On a similar note, being able to select an move of yours and/or your opponents that would adjust the calculation of the other's. I.e. click Zeraora's plasma fists so the calculation on a normal move goes from damage to N/A, or clicking on Landorus' Smack Down so then his EQ will calculate damage against a flying type. This could be another way to implement calculating for Roost/Burn Up/Soak/etc.


Some smaller things:

I'd like to be able to see my/opponent's EVs, but not the IVs. (Perhaps someone else would like the reverse.) Separating these into two opions in the settings would be nice. The more settings the better IMO, and you can always put in "Advanced Settings" to keep the main page clean, or put the "Interface" and "Tooltips" and whatnot into separate pages as you add more settings.

The N/A damages for status moves is nice, but for actual moves that do zero damage it'd be nice to be able to have a 0% or other symbol as an option, and the same goes with moves that would heal (water vs. water absorb, etc.); it'd be nice for that to be coloured or something along with the other damage ranges (i.e. sharing the colouration from the NHKOs).

I like that it already checks for hazard damage but perhaps being able to have it show the damage "+ haz" or something because just looking at the damage might not be clear. Or perhaps the damage from hazards should be an option to add directly to the % damage range instead of just affecting the NHKO)

It would be especially nice in unrated battles like tournaments if where the ELO is normally shown it can search the players rank for that format and display it anyway.

I know you can hover over the %HP for the actual value/range, but having the option to have it displayed next to and/or instead of the % would be nice.

Just like you have a link to the analysis page, it'd be nice if you could have a link to the Porydex page for the mon as well. As for the ELO, I'm not sure which one you grab for the showdown usage, though it looks like you get it from the 1695 one, but it'd be nice to pick which one from the settings (or have it synced with the players ELO). For example I only look at the 1825 usages, so I'd like to me able to use see those.


I think that's everything I had on my mind for now. Sorry to bombard you like this, and I certainly don't want to sound annoying, I just really appreciate what this tool has to offer and so I wanted to give my two cents, and of course bring up any bugs. Thank you.


EDIT: One more thing while I was playing today. I couldn't find any place to import a set into the calc. I thought maybe it'd be under the SET dropdown list but I guess just having an IMPORT button next to COPY (maybe renaming it to EXPORT would be more consistent with the other settings).
 
Last edited:
As for the ELO, I'm not sure which one you grab for the showdown usage, though it looks like you get it from the 1695 one, but it'd be nice to pick which one from the settings (or have it synced with the players ELO). For example I only look at the 1825 usages, so I'd like to me able to use see those.
Just for clarification, the numbers in the usage stats refer to Glicko, not ELO. Shouldn't affect your idea though, it's public info just like the ELO of a player.
 
First off, thank you for taking the time to share all your feedback with us, this is awesome. We discussed all your ideas and what's do-able from the tech side of things, so here's what I got.
I really like the automatic filling of revealed moves/items (I do believe, or so it seems, that the moves reveal the lowest usage % first, which is really a nice touch thank you), but I think it would be more helpful if instead of just filling in that slot, it tried to switch the whole set (save other revealed moves) to one with that move.
LOL well actually it doesn't work like that, but I'm glad it seems to work like that, since that hopefully means it's performing close to your expectations. It really only struggles in situations where you would decide to use either one or the other STAB move, but not both, as you need the other move slots for some other utility/coverage moves. The algorithm we use to decide what move to replace is as follows: Any status move -> Any non-STAB move -> Any STAB move. So it will only replace a STAB move if there are no other status or non-STAB moves to replace first.

The reason we chose that implementation is because it's not really helpful to see the damage & KO% for status moves obv, so might as well replace those first. Then replace non-STAB moves as those are less likely than STAB moves, but if there are no other options, just replace the first move in the list at that point, since the computer can't intuitively know that you sometimes leave out Mach Punch when you already have Close Combat in favor of U-turn, which isn't STAB, but is important for momentum and thus more logical to keep. We aren't necessarily trying to make it perfect in deciding what move to replace, as the user will need to course correct in the more nuanced situations. We just wanted to make it more convenient in situations where it's pretty obvious.

Also as you mentioned, we don't always have access to the Showdown Usage stats for a Pokemon/format. And we don't currently have access to those usage stats outside of the "Showdown Usage" set, as that was a temporary solution for now. Eventually we plan to add a setting where you can see the Showdown Usage %'s displayed outside of that set, so you can view them even when you're using the Smogon sets. We'll keep this in mind for the future, and we could potentially implement it if it's reasonable/makes sense after making the stats available outside the Showdown Usage set.
So if say Tangrowth was revealed to use sleep powder, then the whole set should adjust from the AV Smogon set to the rocky helmet one. Or vice versa if it was revealed Tangrowth did not have a rocky helmet.
We agree, this is what we intended for the "Auto" button above Set to do (tho it's currently disabled). We're still figuring out the best way to go about it. The AV example is a pretty obvious situation (for humans) where if they use a status move, you know 100% it's not the AV set. But there are a lot of other situations where it's not as obvious. Some questions we're thinking about are: should it be based on the moves i.e. if they use a move that's not in the current set, do a look-up to see if the move is in any other sets and auto-switch to that set if it exists. Defog on Corviknight is a good example, as an offense Corv set definitely won't have Defog on it. In your example, it was based on the move and item, which means accounting for a lot of edge cases and unique interactions. For example, if Clef uses an attacking move and doesn't take recoil damage from Life Orb, should it auto-switch to a non-Life Orb set? Thanks to Magic Guard, we would need to add a special case for this, and as you can imagine with Pokemon, this could get really extensive and hard to keep accurate.

All that to say, it's important to us that we find a solution that works reliably and that doesn't require too much maintenance or extra patchwork. But this is definitely a feature we plan to implement!
On that note in particular, while moves like life orb and rocky helmet get revealed and populate the item field, if a set with such an item is filled in and it is revealed the pokemon does not have that item, it should at least switch to the next most common item as per usage. For example, I was against Slowbro and after hitting it with a contact move, I did NOT take rocky helmet damage. Thus I presumed it was boots as thats the next most common item, but Showdex did not update the item slot can kept it as rocky helmet.
Thanks for bringing this up actually, we’ve been thinking about this a lot and recently we’ve had a change of heart regarding this feature, which we’ve had suggested a few times already. At first we were willing to implement it, though after thinking about it more, we realized that it would be rather complicated, since there are a lot of little gotchas like Magic Guard, Sheer Force, etc. Not to mention all the different checks we would need to do, and how each one would need to have its own criteria. For example, Leftovers seems to be a pretty simple thing to detect, i.e. if they don’t get Leftovers recovery at the end of the turn, then they don’t have Leftovers. But that doesn’t work if they have full HP. There’s a lot of stuff like that to consider.

However after thinking about it further and seeing the response from some people on Youtube who felt that Showdex could be seen as cheating/ruining the game, we decided that it’s probably best to hold off on any more big features that remove the need for the player to adjust things manually. We’ve removed the vast majority of repetitive and tedious work from using the calc, so there should be plenty of time to manually change the item. Basically we don’t want the calc to auto-pilot everything for the player, but rather, require them to think about and adjust the item based on their own intuition.

Of course we’re open to discussion on this topic, and we’re not opposed to it completely. We would rather wait a while though and see how people feel about it over time. The last thing we want is for Showdex to be banned or restricted, that’d be really sad! I’ve said this before, but competitive integrity is really really important to us. There are already people who feel that Showdex is like “having the computer play for you”, which I completely disagree with ofc, but I can understand where they’re coming from, and I wouldn’t want to make the situation worse by adding even more features that lessen the need for player input.
Another example of this is with damage rolls. A banded set might load in but then when the mon does less than the range, it shouldn't continue to say it is banded. it should pick the next most common item if applicable (not already revealed that it cant be, like LO or lefties). Obviously it is impossible to tell sometimes because of the damage ranges but this would include 1.2x boosting items.

Likewise if the damage roll is related to the EVs rather than an item (since you know your EVs, getting hit would likely be the cause of an opponent's item (I mean who runs something like banded without EV investment), and hitting the opponent would be a matter of their EVs (or Assault Vest I guess)). So for example if I hit Volcanion with EQ and it does less than expected, then it is probably running the Bulky set from doubles OU and it should repopulate. Or at the very least adjust some EVs based on Showdown usage. (The natures should probably also be sorted by usage.)
In terms of analyzing damage rolls, this is something we actually are pretty firmly against doing. I think in its current form, Showdex makes it pretty dang easy to figure out if someone is using a Choice item, and it doesn’t need to get even easier. That type of deductive reasoning is something we don’t want the calc to do for you, as that’s the player’s responsibility to figure out. That’s part of becoming a good player, is knowing to look out for & think about that stuff. I don’t want to remove that skill element from the game.

In regard to displaying the Showdown Usage stats for Natures, we were actually considering doing that. The reason we held off was because there are a lot of natures that have like 0.0332% usage or something super small like that, and it made the list crazy long. However after thinking about it, we might include it as a feature but filter out anything that's below 1% usage to avoid that problem. Let me know if that sounds good to you!
I was using AV Melmetal against Zapdos and I wanted to go for Earthquake to predict the Roost, but there was no way for me to see how much damage it would do since it was just N/A since Zapdos has the flying type. Perhaps where the pokemon's type is shown you can click the type to change it or make it grey out and not be calculated in damage/STAB? Flying types are certainly the most common use here but other times when it would be helpful include: soak, removal of forest's curse / trick-or-treat (via switch in and out), burn up, among other moves/circumstances.
On a similar note, being able to select an move of yours and/or your opponents that would adjust the calculation of the other's. I.e. click Zeraora's plasma fists so the calculation on a normal move goes from damage to N/A, or clicking on Landorus' Smack Down so then his EQ will calculate damage against a flying type. This could be another way to implement calculating for Roost/Burn Up/Soak/etc.
We actually have a feature for this in the upcoming patch, as we now allow you to change your Pokemon's types by clicking on it and making a new selection.
I'd like to be able to see my/opponent's EVs, but not the IVs. (Perhaps someone else would like the reverse.) Separating these into two opions in the settings would be nice. The more settings the better IMO, and you can always put in "Advanced Settings" to keep the main page clean, or put the "Interface" and "Tooltips" and whatnot into separate pages as you add more settings.
I totally agree, I think this would be a great feature. We'll look to include this in the next next patch or two. And yeah we'll definitely need to think of a good way to include as many settings as possible while also not making it overwhelming. Our settings page in general needs to be cleaned up soon, we've just been waiting until we've added a lot of the settings so we know how to organize it best with what we’ve got.
The N/A damages for status moves is nice, but for actual moves that do zero damage it'd be nice to be able to have a 0% or other symbol as an option, and the same goes with moves that would heal (water vs. water absorb, etc.); it'd be nice for that to be coloured or something along with the other damage ranges (i.e. sharing the colouration from the NHKOs).
Interesting, I hadn’t thought about this. We decided to display “Immune” for attacking moves that do 0% damage (0% can only result from an immunity as every attack does minimum 1 damage otherwise), and “N/A” will be reserved for only status moves, so the distinction is more clear. We’re including that feature in the patch we’re releasing this week, so you’ll see it in action soon.

In terms of healing moves, unfortunately we don't know how much it would heal since the Honko damage calc doesn't tell us that info. We're simply plugging the battle data into calc.pokemonshowdown.com for you and displaying it, so we can't derive anything that isn't provided by that API natively. If all you wanted was an indication that it would heal them (as opposed to just an immunity), we can consider implementing that, but it’s not a huge priority as compared to other features.
I like that it already checks for hazard damage but perhaps being able to have it show the damage "+ haz" or something because just looking at the damage might not be clear. Or perhaps the damage from hazards should be an option to add directly to the % damage range instead of just affecting the NHKO)
I don't think there's enough space to put "+ haz" next to the damage percent. If you have a bigger screen, you might think there’s a ton of space for it, but a lot of people have smaller screens, so we’re very cautious about adding things to the UI. I agree it's not initially clear that hazards damage is being accounted for (or even that you can hover over the damage % numbers to see the full calc text in a tooltip). I would like to figure out a better way to make it more apparent, but that will take some consideration. In terms of having an option to add the hazards damage directly to the %, unfortunately it would be tough to implement.
It would be especially nice in unrated battles like tournaments if where the ELO is normally shown it can search the players rank for that format and display it anyway.
Can you elaborate more on this? When you’re playing in tournaments, what format are you in? And are you playing on the main PS site, or on Smogtours? Depending on the situation, we could potentially do what you’re asking, but it depends!
Just like you have a link to the analysis page, it'd be nice if you could have a link to the Porydex page for the mon as well.
We could do this actually, and it sounds like a pretty good idea. We would allow you to open the Porydex page instead of opening the Smogon page (configured in settings). However we still need to figure out some quirks with this, as I’m guessing you want to view this page (https://www.porydex.com/stats/2022-09/gen-8-ou/1825/pokemon/dragapult) instead of this one (https://www.porydex.com/dex/ss/pokemon/dragapult). In order to use the first link, we would need to specify the date (2022-09), the format, and the ELO. But then, what if they haven’t released the stats for that month yet? For example, they haven’t released the stats for October yet, so the page would look like this: https://www.porydex.com/stats/2022-10/gen-8-ou/1825/pokemon/dragapult. Thankfully the page still loads, so that’s okay, but unfortunately we can’t really detect whether it’s blank, so we can’t default to the last month where stats are available (tho it’d be nice if we could easily do that). The format is problematic tho, cause what do we do in formats where stats aren’t available? It’s a lot of work to build a web scraper to detect these things programmatically, so we need to find a reliable and simple way to account for these situations. An idea could be to enable this for only specific formats and use the Smogon link for everything else. Lastly, the ELO, is probably the easiest one, as we could detect what ELO you’re in and choose whatever ELO is closest. And we could include a setting for manually setting it to a certain ELO if you want to do that.
If you have any better ideas for this, let me know, but those are our initial thoughts.
As for the ELO, I'm not sure which one you grab for the showdown usage, though it looks like you get it from the 1695 one, but it'd be nice to pick which one from the settings (or have it synced with the players ELO). For example I only look at the 1825 usages, so I'd like to me able to use see those.
This is a pretty good idea actually, but we have no idea what ELO it's using currently lol. pre might know, as we're using the pkmn.cc APIs for providing that data, and it doesn't specify what ELO it pulls from. Here's a link to the GitHub.
One more thing while I was playing today. I couldn't find any place to import a set into the calc. I thought maybe it'd be under the SET dropdown list but I guess just having an IMPORT button next to COPY (maybe renaming it to EXPORT would be more consistent with the other settings).
Great idea, we’ll look to add this in a future patch!
I think that's everything I had on my mind for now. Sorry to bombard you like this, and I certainly don't want to sound annoying, I just really appreciate what this tool has to offer and so I wanted to give my two cents, and of course bring up any bugs. Thank you.
No worries, we love hearing feedback, it's super helpful to hear. Feel free to keep sharing your thoughts, we love discussing ideas and explaining our thought process.

To be clear, we’re always open to debate, and we’re not firmly against implementing any changes (rarely we’re strongly against something, but even if we are, that doesn’t mean we won’t consider it). If you disagree with anything I've said here, feel free to let me know!
 
Last edited:
The algorithm we use to decide what move to replace is as follows: Any status move -> Any non-STAB move -> Any STAB move.
Makes sense. I figured that could be another possibility, but I was hopeful from what I saw in my limited testing. For the calculator side of things it makes sense to list 4 attacks. But I think this has the potential to replace not just the casusal usage of Porydex, so being able to see the common sets without opening Porydex is nice. Perhaps this can be a 3 option setting; current implementation, 4 most common attacks, most common set + change lease used move with reveal. I look forward to improvements in the usage sets.

it's important to us that we find a solution that works reliably and that doesn't require too much maintenance or extra patchwork
Indeed; trying to solve for all edge cases is impossible, especially in pokemon. Perhaps just having multiple good-enough algorithms as options allows users to use what they want when.

There’s a lot of stuff like that to consider.
Makes sense, though with leftovers and sludge you can just add an " || !atFullHealth" or something to the check. I definitely understand not adding all use cases, but I think some common ones that don't have common edge cases, like obviously not taking helm damage would be nice. But yeah I definitely get not making it fully automated. Showdex's implementation just seems so smart in some places that it feels off when it's absent in others.

Let me know if that sounds good to you!
Yeah damage rolls are the most complex of these smart-adjustments so I don't really expect it to happen. Just thought I'd throw it out there.
As for the natures though, yeah you can definitely just cut off those lower % ones, or even just list the top 5 or 6 or so that the usage data does with EV+nature sets.

If all you wanted was an indication that it would heal them (as opposed to just an immunity), we can consider implementing that, but it’s not a huge priority as compared to other features.
Yeah I just meant some sort of indication. And being able to have both that and the damage ranges be coloured like the NHKO text is.

unfortunately it would be tough to implement.
I guess because Showdex doesn't actually preform any of the calcs itself, so it can't adjust the formatting of the calcs?

Can you elaborate more on this?
Yeah, just like, if I'm in an tour in the OU room on PS main, not Smogtours, or if I just challenged someone, or any other time when something is unrated, like Unrated Randoms. If I type in chat /rank [name] (or /ladder, whatever) it'll give me the ELO for the current format (or of course I could specify the format in the command). Point is in an unrated battle like a tour, challenge, or what have you, you can't see their ELO by hovering over their name or where you load it in in Smogdex, but I can still check their actual ELO via command. It's just something I always check before I start a battle, rated or unrated, so it'd be nice not to have to type out the whole command every battle.

If you have any better ideas for this, let me know, but those are our initial thoughts.
https://www.porydex.com/stats/[month]/[format]/[ELO]/pokemon/[pokemon]
Yes the stats usage. I mean if you load up https://www.porydex.com/stats/2022-09 it shows all the formats that have this as an option. You probably only need to manually copy this table once a generation. Then if the user is in the format it knows what to put into [format]. [ELO] would be a setting with the values in the table as options, either fixed or the player's ELO rounded. [Pokemon] is obvious. As for month, I don't know the exact day Porydex updates but I think last month was the 10th or something; you could probably just use the previous month if its <15th, or something, then the few days of possible discrepancy it'd be fine to leave blank, especially since once you are there you can just click on the button to go to the last month. (In fact since its a single button-press for the user, you probably don't even need to roll it back for the first 2 weeks if you don't want to, just go to current month.)

it doesn't specify what ELO it pulls from. Here's a link to the GitHub.
From what I can tell, it seems the default action pulls by rounding some crazy victoryChance statistic to the nearest GXE/ELO that works. But from the usage example on the page you linked, its as simple as defining a variable and putting it as the 4th entry ("cutoffs") in the Stats.update() method.

Great idea, we’ll look to add this in a future patch!
We actually have a feature for this in the upcoming patch, as we now allow you to change your Pokemon's types by clicking on it and making a new selection.
Awesome!

If you disagree with anything I've said here, feel free to let me know!
Certainly will continue to do.


Another thing I noticed is some settings I change don't take effect until the next battle (or as with the downloading sets, if I uncheck the option, the sets don't disappear). Not sure what you think should be done or not done around this.


I'm sure I'll post here again as I find more things to say. :heart:
 
Patch 1.0.6 is now live!
You can read the full patch notes here. This patch includes a lot more support for custom OMs and edge cases with the ability to change a Pokemon’s typing, edit move properties & base stats and increase EVs/IVs past traditional limits (thanks Clastia for the suggestion). The added benefit is that in standard play, you can manually set the BP of a move like Beat Up or turn off your Flying Type when Roosting to name just a few use cases.

We’ve added a Win/Loss counter to the HelloDex to provide you with a bit of fun utility (dw you can always reset it by refreshing the page). When an attacking move does 0% dmg, we now display “IMMUNE” instead of “N/A” and “?” instead of “N/A” for moves such as Mirror Coat for which dmg can’t be determined since they require input (thanks Iodyne for the suggestion). And you can now use shift+left/right arrow keys for moving Showdown’s panels.

We also added some more settings like “Show Win/Loss Counter” and toggles for when you want move, typing, or base stat editing to be enabled. The default setting is “Meta”, which only enables editing options for custom OM formats to avoid cluttering the UI when playing in standard formats like OU where you don’t usually need them.

Lastly, this patch includes a ton of bug fixes such as:
  • Fixed cut off set names like “-out Attacker”
  • Fixed missing sets for transformed Pokemon like Mimikyu-Busted, Zygarde-Complete, etc.
  • Fixed Behemoth Blade & Bash not replacing Iron Head after transforming into Zacian-Crowned & Zamazenta-Crowned
  • Fixed disabled Edit button for your Pokemon’s stats in older gens & missing options in the items dropdown for Gen 2 battles
  • And more!
Gen 9 is right around the corner, which means new battle mechanics, and unfortunately Showdex won’t work until the PS calc is updated with the new gen mechanics/data. Not to mention there definitely won’t be any Smogon sets or Showdown Usage sets to display in the beginning. Keith will also be taking a much deserved vacation, so we’ll have to wait until he’s back and everything is settled before we can deploy a fix for Scarlet & Violet. We plan to deploy a small patch before Gen 9 releases, and our initial thoughts are to disable the calc in Gen 9, because it might crash or be inaccurate. The idea being that it’s prob better to show nothing rather than show inaccurate calcs or crashes. Totally open to everyone’s thoughts on that situation, thank you so much for all your support and feedback.

We’re excited as hell for Gen 9 and learning the new calcs and especially all the mechanics that are gonna add a million new edge cases and bugs :woop:
As always, we love hearing your feedback and we hope you enjoy!
 

pre

pkmn.cc
This is a pretty good idea actually, but we have no idea what ELO it's using currently lol. pre might know, as we're using the pkmn.cc APIs for providing that data, and it doesn't specify what ELO it pulls from. Here's a link to the GitHub.
From what I can tell, it seems the default action pulls by rounding some crazy victoryChance statistic to the nearest GXE/ELO that works. But from the usage example on the page you linked, its as simple as defining a variable and putting it as the 4th entry ("cutoffs") in the Stats.update() method.
AFAICT you are not in fact using pkmn/stats in the showdex (at least not directly) - that is what computes the stats and reports for https://www.smogon.com/stats/, the data you're actually using for stats is generated by this script (I should note that "some crazy victoryChance statistic" is in fact exactly how weighted usage stats are defined to be computed by Antar, and relies on Glicko-2, not GXE or Elo). Furthermore, the stats cutoffs you are talking about (1695 vs. 1825) are not ELO (which is also not "ELO", but instead "Elo"), but are instead once again referring to Glicko-2 ratings.

As for which Glicko-2 cutoffs the data from https://data.pkmn.cc/stats is based on... that varies. Not only does the cutoff vary, but also the month that the stats in question are actually from varies as well! The short answer is its using the 1630/1695 cutoff (this varies based on both format and date) for the latest month that has "enough" data (less popular formats are added and removed from Pokémon Showdown regularly). This idea comes from Honko, and is how the PS calc populates its usage based sets. 1630/1695 is chosen instead of 1760/1825 because the 1630/1695 stats are what is actually used by Smogon for tiering, and thus are probably the single most definitive "stats" Smogon offers.

https://data.pkmn.cc/stats is an opinionated source of usage stats data and does/will not support selecting different cutoffs. Someone could certainly fork the script I linked above and have it generate additional or different output for the cutoffs of their choice for given formats and host the data from their own domain, but honestly the 1760/1825 stats probably aren't what you want to be looking at unless you're already playing at the very top of the ladder (which if you are, awesome, good job! most people are not in that situation, however).

We could do this actually, and it sounds like a pretty good idea. We would allow you to open the Porydex page instead of opening the Smogon page (configured in settings). However we still need to figure out some quirks with this, as I’m guessing you want to view this page (https://www.porydex.com/stats/2022-09/gen-8-ou/1825/pokemon/dragapult) instead of this one (https://www.porydex.com/dex/ss/pokemon/dragapult). In order to use the first link, we would need to specify the date (2022-09), the format, and the ELO. But then, what if they haven’t released the stats for that month yet? For example, they haven’t released the stats for October yet, so the page would look like this: https://www.porydex.com/stats/2022-10/gen-8-ou/1825/pokemon/dragapult. Thankfully the page still loads, so that’s okay, but unfortunately we can’t really detect whether it’s blank, so we can’t default to the last month where stats are available (tho it’d be nice if we could easily do that). The format is problematic tho, cause what do we do in formats where stats aren’t available? It’s a lot of work to build a web scraper to detect these things programmatically, so we need to find a reliable and simple way to account for these situations. An idea could be to enable this for only specific formats and use the Smogon link for everything else. Lastly, the ELO, is probably the easiest one, as we could detect what ELO you’re in and choose whatever ELO is closest. And we could include a setting for manually setting it to a certain ELO if you want to do that.
If you have any better ideas for this, let me know, but those are our initial thoughts.
https://www.porydex.com/stats/[month]/[format]/[ELO]/pokemon/[pokemon]
Yes the stats usage. I mean if you load up https://www.porydex.com/stats/2022-09 it shows all the formats that have this as an option. You probably only need to manually copy this table once a generation. Then if the user is in the format it knows what to put into [format]. [ELO] would be a setting with the values in the table as options, either fixed or the player's ELO rounded. [Pokemon] is obvious. As for month, I don't know the exact day Porydex updates but I think last month was the 10th or something; you could probably just use the previous month if its <15th, or something, then the few days of possible discrepancy it'd be fine to leave blank, especially since once you are there you can just click on the button to go to the last month. (In fact since its a single button-press for the user, you probably don't even need to roll it back for the first 2 weeks if you don't want to, just go to current month.)
It is in fact a lot of work to figure out how to know which date to link to for stats for any given format - thankfully you should be able to piggyback on the same logic powering https://data.pkmn.cc/stats - you can fetch https://raw.githubusercontent.com/pkmn/smogon/master/smogon/latest.json which tracks the last date any given format had any stats data and how many battles were played, as well as the best date for that format (the date which as described above is the last date the format in question had "enough" battles to be sufficiently useful).
 
Bro Apple is cringe, ty thou. I would also use an unsigned version as I have used unofficial apps on Mac before so consider that if you want,
I agree, but what can you do :(

Hmm, if that's the case, I'll plan on building a binary for Safari in one of the upcoming versions.
 
any chance the tool stops showing very old sets like twave boots pult? thank you so much for all your hard work.
Great suggestion!

At the moment, we don't have much control over the downloaded sets, so they're being shown as-is pretty much. This is something we may be able to do once we setup our own Pokémon set APIs in the future.

I'll note down your suggestion though to help me design the APIs when we cross that bridge. Thanks!
 
No. As you can see in the image, it didn't update with Stealth Rock.
View attachment 464255
This bug is so bizarre, I keep spectating games in Gen 5 (this is Gen 5 right?) and it seems to work perfectly :( you definitely have the "Auto-Fill Revealed Moves" setting ON in the settings right? If there's any other info you could provide, like if you changed anything manually or adjusted something, let me know as it might help
 
I guess because Showdex doesn't actually preform any of the calcs itself, so it can't adjust the formatting of the calcs?
Yup, Showdex is basically a "middleman" between Showdown and the Honko calc (@smogon/calc, to be exact), filling in the inputs for you from the battle data. In terms of the raw calculation logic itself, there is no difference between Showdex and Honko's. The extra features and fixes included in Showdex (e.g., toggling Multiscale, handling Illusion & Imposter, applying hazards to inactive Pokémon only, etc.) only change how Showdex reports the data to the Honko calc, which is the reason for some discrepancies between the two.

We basically call the calculate() function exposed from @smogon/calc, which essentially returns the matchup description (e.g., "252 Atk Weavile Knock Off ... -- guaranteed 2HKO") that are then split into parts to display them in the Calcdex.

As you've noticed, the NHKO value includes hazards, but the damage range does not, which is a feature of @smogon/calc, not Showdex. You'll notice this when you go on the O.G Damage Calculator and apply hazards.

Very trivial to simply add hazard damage to the damage ranges (i.e., convert the strings into numbers then add, ez), but the difficulty is reimplementing the gen-specific mechanics that apply hazards since @smogon/calc doesn't publicly expose those functions (e.g., Spikes wouldn't apply if the opposing Pokémon is Flying, has Magic Guard, has Heavy-Duty Boots, etc. — and that's only for Gen 8).

Alternatively (now that I'm thinking about it), could just detect if the matchup description has "2 layers of Spikes" in it (for instance) to apply the hazard damage (as to avoid reimplementing the aforementioned hazard mechanics), but would need a better way of representing the hazard damage only applying once. So we arrive at the "+ haz" UI problem.

tl;dr: Definitely doable, but requires the big think as to keep the UI uniform and clean.

Another thing I noticed is some settings I change don't take effect until the next battle (or as with the downloading sets, if I uncheck the option, the sets don't disappear). Not sure what you think should be done or not done around this.
Most settings should immediately apply on-the-fly, but ones that occur only during Calcdex initialization don't. Specifically:
  • Calcdex » Open When – Applies on a per-battle basis since Calcdex initialization only happens once, which is when the battle first opens (whether playing or spectating). Changes to this setting only apply for battles after since the current battle has already been initialized.
  • Calcdex » Open As – Similar to Open When, the Calcdex injection occurs during initialization. Completely different injection routines for the Tabbed Panel and Battle Overlay options, so it'll take some extra work to "uninject" (e.g., remove the Battle Overlay container and Open Calcdex button) and then "re-inject" with the updated setting (e.g., create a new side panel room and render the Tabbed Panel container). (Also could seriously lag if you have multiple Calcdexes open since they'd be all simultaneously running the re-injection routines.)
  • Calcdex » Auto-Swap ... Pokémon – This setting is read from and applied when the Calcdex initializes. As to not override your auto-swap choice mid-battle, this setting won't be applied again until the next battle. Allowing this setting to be on-the-fly will constantly enable or disable auto-swapping to this value, which can seem broken. (For example, if I disabled Auto-Swap My Pokémon and I turn on auto-swapping during the battle, it would immediately disable again because of the setting.)
  • Calcdex » Show ... EVs/IVs – This setting is read from and applied to each Pokémon when the Calcdex initializes. Each Pokémon has its own toggle state for its stats table, so you'll notice that if you hit Edit for one Pokémon (assuming you have this setting disabled), it'll still say Edit (instead of Hide) for another.
Only exception to the Calcdex initialization is this setting:
  • Calcdex » Download ... Sets – When previously disabled, enabling this after the Calcdex has initialized will cause the sets to start downloading (which seems to be "on-the-fly"), but then cached in memory via RTK (Redux Toolkit). When you disable this option again during the same battle, since the sets are cached, they'll still remain (not "on-the-fly", as you've discovered). However, battles after won't download the sets if not already cached (e.g., you open a battle of a different gen).
I didn't bother to make these settings update immediately since I'm assuming most people would set it and forget it (or not even set it at all). To make these settings update on-the-fly will require a lot of additional work since these don't apply in the "React world", but in the vanilla jQuery environment that Showdown runs in. Doable, but time consuming.

Hopefully that makes sense!
 
Very trivial to simply add hazard damage to the damage ranges (i.e., convert the strings into numbers then add, ez), but the difficulty is reimplementing the gen-specific mechanics that apply hazards since @smogon/calc doesn't publicly expose those functions (e.g., Spikes wouldn't apply if the opposing Pokémon is Flying, has Magic Guard, has Heavy-Duty Boots, etc. — and that's only for Gen 8).

Alternatively (now that I'm thinking about it), could just detect if the matchup description has "2 layers of Spikes" in it (for instance) to apply the hazard damage (as to avoid reimplementing the aforementioned hazard mechanics), but would need a better way of representing the hazard damage only applying once. So we arrive at the "+ haz" UI problem.
Yeah I guess its possible to parse through the strings. But honestly the more I think about it it's fine how it is. How would the calc even know if you wanted to test against a mon switching in vs not without adding an unnecessary button. And then people will want status damage too and it'll just be too much. It's fine how it is.

Hopefully that makes sense!
Yep, does indeed. I like the "on the fly" appearance of the download sets. Possibly having the option to hide them afterward (in the same game) could be nice but for the most part I'm fine with how the settings function, just wasn't sure how it was all intended, but it makes sense now.
 

Ara

Ara
Hmm... are you on HTTP or HTTPS when you're visiting Smogtours? Also, which browser are you using?

We've come across this bug before, but it was because we were on HTTP instead of HTTPS. Seems to not want to copy to the user's clipboard on HTTP sites, probably as a built-in security measure.
yeah i switched and it worked
 
feel bad for making a 1-liner here but I don't know what I'm talking about so lol. smogon sets just don't import into the calc for me, they have a little loading animation.

edit: this is what I'm referring too
1668644709151.png

I reset to default settings and reinstalled as well and still have this issue. Any solutions?
 
Last edited:
feel bad for making a 1-liner here but I don't know what I'm talking about so lol. smogon sets just don't import into the calc for me, they have a little loading animation.

edit: this is what I'm referring too
View attachment 466248
I reset to default settings and reinstalled as well and still have this issue. Any solutions?
No worries, your screenshot is helpful enough!

Seems that the sets started downloading, but never finished. Usually should finish downloading within a few seconds at most, so something's wrong if it's hanging like that. There shouldn't be anything wrong with your settings if the loading animation appears (would be more concerning if it didn't).

If you could provide me with the following info, that would help me out a lot!
  • OS (Windows, macOS, Ubuntu, Android on a Samsung Smart Fridge, etc.)
  • Browser (Chrome, Firefox, Opera, etc.)
  • Showdex version (e.g., v1.0.6)
  • Format (though it looks like gen81v1 based on your 3 Pokémon)
Lastly, does it ever stop loading? (Would be fair to say no if it's still loading after 30 seconds.)

Thanks!
 
No worries, your screenshot is helpful enough!

Seems that the sets started downloading, but never finished. Usually should finish downloading within a few seconds at most, so something's wrong if it's hanging like that. There shouldn't be anything wrong with your settings if the loading animation appears (would be more concerning if it didn't).

If you could provide me with the following info, that would help me out a lot!
  • OS (Windows, macOS, Ubuntu, Android on a Samsung Smart Fridge, etc.)
  • Browser (Chrome, Firefox, Opera, etc.)
  • Showdex version (e.g., v1.0.6)
  • Format (though it looks like gen81v1 based on your 3 Pokémon)
Lastly, does it ever stop loading? (Would be fair to say no if it's still loading after 30 seconds.)

Thanks!
Edit:
Windows
Chrome
1.0.6
All formats
Never loads period
 
Last edited:

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

Top