pkmn / smogon Goto Github PK
View Code? Open in Web Editor NEWWrapper around Smogon's analyses and usage statistics
Home Page: https://data.pkmn.cc
License: MIT License
Wrapper around Smogon's analyses and usage statistics
Home Page: https://data.pkmn.cc
License: MIT License
Line 406 in 9237c43
This line is causing problems with Tauros and Vivillon under gen9.
Regular Tauros and Vivillon are not included in the Gen9 dex, so looking up gen.species.get(species.baseSpecies)
returns undefined
This causes us to crash at the !.cosmeticFormes
Maybe we want to just do gen.species.get(species.baseSpecies)?.cosmeticFormes?
and add Tauros
to the PREFIXES
? I'm not confident in the downstream effects of this, or I would have submitted a PR instead
Specific Species that I've encountered this with:
Places you've looked for an answer:
not applicable.
Ask your question:
I am the maintainer of another tool to fetch smogon's usage data (https://github.com/FelixRilling/smogon-usage-fetch) and was wondering if there is interest in me porting some features from that over into this project, as this one here seems to be more active.
For instance:
Example:
not applicable.
Zacian-C and Zama-C don't have sets in the dataset even though they are in the Smogon dex
Describe the bug:
require
does not work to resolve the module.
Example:
~/workspace/pkmn-cjstest
-> npm install smogon
added 1 package, and audited 2 packages in 2s
found 0 vulnerabilities
~/workspace/pkmn-cjstest
-> echo "const smogon = require('smogon');" > main.js
~/workspace/pkmn-cjstest
-> node main.js
node:internal/modules/cjs/loader:1035
throw new ERR_REQUIRE_ESM(filename, true);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/waleed/workspace/pkmn-cjstest/node_modules/smogon/build/index.mjs not supported.
Instead change the require of /home/waleed/workspace/pkmn-cjstest/node_modules/smogon/build/index.mjs to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/home/waleed/workspace/pkmn-cjstest/main.js:1:16) {
code: 'ERR_REQUIRE_ESM
}
Node.js v19.0.0
Expected behavior:
I expected for the package to resolve using require
and not need ES modules.
Additional context:
I'm assuming this is non-intentional because the commit to bundle ES modules seems to also intend to bundle cjs.
Describe the bug:
There seems to be missing analysis of sets and formats in gen8.json
of analyses (might hold true for other gens as well)
Example:
Zapdos Battle Stadium Singles Format
gen8analyses.json
"battlestadiumsingles": {"overview": "<p>This set is for one of the final Battle Stadium Singles metagames for this generation. If you feel there is anything wrong or missing, <a href=\"https://www.smogon.com/forums/threads/battle-stadium-series-13-analysis-contribution-thread.3707854/\">please post in this thread</a>.</p>", "sets": {"Dynamax Attacker": {}}},
gen8sets.json
"battlestadiumsingles": {
"Dynamax Attacker": {"moves": ["Hurricane", ["Thunderbolt", "Rising Voltage"], "Heat Wave", ["Roost", "Thunder Wave"]], "ability": "Static", "item": "Life Orb", "nature": "Timid", "evs": {"def": 4, "spa": 252, "spe": 252}},
"Defensive": {"moves": [["Volt Switch", "Thunderbolt", "Discharge"], "Hurricane", ["Heat Wave", "Eerie Impulse", "Thunder Wave"], "Roost"], "ability": ["Static", "Pressure"], "item": ["Rocky Helmet", "Sitrus Berry", "Wiki Berry"], "nature": "Bold", "evs": {"hp": 252, "def": 196, "spe": 60}},
"Defensive Kee Berry": {"moves": [["Discharge", "Thunderbolt"], "Hurricane", "Roost", ["Eerie Impulse", "Heat Wave"]], "ability": ["Static", "Pressure"], "item": "Kee Berry", "nature": ["Bold", "Timid"], "evs": {"hp": 252, "def": 196, "spe": 60}},
"Choice Attacker": {"moves": ["Thunderbolt", ["Volt Switch", "U-turn"], "Hurricane", "Heat Wave"], "ability": ["Static", "Pressure"], "item": ["Choice Scarf", "Choice Specs"], "nature": "Timid", "evs": {"def": 4, "spa": 252, "spe": 252}},
"Choice Scarf": {"moves": ["Thunderbolt", ["Volt Switch", "U-turn"], "Hurricane", "Heat Wave"], "ability": "Static", "item": "Choice Scarf", "nature": "Timid", "evs": {"def": 4, "spa": 252, "spe": 252}}
}
Expected behavior:
It was expected for each set to be present, along with the analysis description of that set if applicable.
Additional context:
This is a weird issue, I am unable to pinpoint what might be the case here. (Edit 2: It can be pinpointed to battlestadiumsingles format)
The sets json contains all relevant information, only the analysis json file has missing content.
Upon running a python check with comparison of analyses.json to its corresponding sets json file:-
for poke in sets: # gen8.json sets
for format_ in sets[poke]:
for set_ in sets[poke][format_]:
if format_ not in analyses[poke]: # gen8.json analyses
print('Missing format', poke, f)
break
elif set_ not in analyses[poke][format_]['sets']:
print('Missing set', poke, format_, set_)
Missing Formats:-
Lycanroc-Midnight pu
Morpeko pu
Rotom-Fan pu
Type: Null pu
Unfezant pu
Missing Sets:- (This ?might also have some clashing pokemon with formes pokemon issue raised by me at #7 )
Zapdos battlestadiumsingles Defensive
Zapdos battlestadiumsingles Defensive Kee Berry
Zapdos battlestadiumsingles Choice Attacker
Zapdos battlestadiumsingles Choice Scarf
Dragonite battlestadiumsingles Bulky Stall
Dragonite battlestadiumsingles Maranga Sweeper
Dragonite battlestadiumsingles Wallbreaker
Porygon2 battlestadiumsingles Offensive
Tyranitar battlestadiumsingles Dynamax Attacker
Tyranitar battlestadiumsingles Dragon Dance
Blaziken battlestadiumsingles Dynamax Special Attacker
Swampert battlestadiumsingles Stealth Rock Setter
Groudon battlestadiumsingles Swords Dance
Groudon battlestadiumsingles Bulk Up
Groudon battlestadiumsingles Choice Scarf
Mamoswine battlestadiumsingles Stealth Rock Setter
Palkia battlestadiumsingles Special Attacker
Palkia battlestadiumsingles Physical Attacker
Heatran battlestadiumsingles Stealth Rock Setter
Darmanitan-Galar battlestadiumsingles Gorilla Tactics
Ferrothorn battlestadiumsingles Choice Band
Landorus-Therian battlestadiumsingles Choice Attacker
Mimikyu battlestadiumsingles Kee Berry Sweeper
Mimikyu battlestadiumsingles Trick Room Setter
Tapu Koko battlestadiumsingles Physical Attacker
Celesteela battlestadiumsingles SubSeed
Celesteela battlestadiumsingles Special Sweeper
Necrozma-Dusk-Mane battlestadiumsingles Calm Mind
Cinderace-Gmax battlestadiumsingles Gmax Libero
Cinderace-Gmax battlestadiumsingles Sash
Cinderace-Gmax battlestadiumsingles Gmax Choice
Dragapult battlestadiumsingles Special Attacker
Dragapult battlestadiumsingles Dynamax Sweeper
Urshifu-Gmax battlestadiumsingles Choice Item
Urshifu-Rapid-Strike battlestadiumsingles 4 Attacks Dynamax User
Regieleki battlestadiumsingles Special Attacker
Maybe we can also have a few unittests that validate everything scraped is okay, by utilising the corresponding sets.json which has had no issues with scraping.
Edit: One major detail to note over here is that, my python code cannot confirm for those sets which are present in the analysis file without an analysis (description) to be consistent with the smogon site.
As can be seen in the example wherein zapdos analysis contains Dynamax Attacker set but is missing the written description of the strategy which does exist in its relevant site and was not displayed in my list of pokemon with missing sets.
Edit 2: I didn't notice the missing sets information I pasted here, seems like this is an issue with only battlestadiumsingles for missing sets.
There is possibly a scraping issue with regards to gmax pokemon
I have solely worked with analyses and sets of Sword Shield, thus all of the data below is for gen8.json
in analyses and sets.
"pokemon": {"ru": {"overview": "...", "sets": [...]}, "pu": {...}, ...}
In the analysis file, each pokemon has various formats. There is an analysis for the format (overview
, comments
, credits
, etc.).
Inside the format, there is also an analysis for each strategy (sets
key is always present) in the format (name
is always present and description
is present only if the analysis for the strategy is written).
The issue being that certain pokemon (listed in details) contain invalid formats (only in their analysis json and not in their sets json).
These formats can be noticed to be invalid as they don't actually have an analysis or a set on their corresponding smogon page.
The invalid format issue can be further segregated into two types:-
format
key (1v1 in below example) contains the poke's base-forme's 'format analysis' i.e. overview, credits, etc. however there is no sets
key."pokemon": {"1v1": {"overview": "...", "credits": "..."}, "anythinggoes": {"overview": "...", "sets": [...], "credits": "..."}, ...}
"pokemon": {"1v1": {}, "anythinggoes": {"overview": "...", "sets": [...]}, ...}
Smogon is wack to place both the gmax/forme and the poke's analysis in the same place but I'm sure you're using the export pokepaste to check which of the two's set it actually is
I did a small python check on gen8.json of analysis
for poke in dt:
for format_ in dt[poke]:
# and statement basically ensuring there is something in there and its not an empty dict
if not "sets" in dt[poke][format_] and dt[poke][format_]:
print(poke, format_)
Results Being:-
Venusaur vgc2022
Venusaur-Gmax vgc2021
Venusaur-Gmax nationaldexmonotype
Charizard vgc2022
Charizard vgc2021
Charizard-Gmax nationaldexmonotype
Snorlax battlestadiumsingles
Darmanitan-Zen 1v1
Zygarde balancedhackmons
Zygarde-Complete nationaldexag
Rillaboom battlestadiumsingles
Rillaboom vgc2022
Rillaboom vgc2021
Rillaboom-Gmax camomons
Rillaboom-Gmax godlygift
Rillaboom-Gmax nationaldex
Cinderace battlestadiumsingles
Cinderace-Gmax almostanyability
Cinderace-Gmax stabmons
Cinderace-Gmax nationaldexmonotype
Coalossal-Gmax zu
Urshifu-Gmax ubers
Urshifu-Gmax vgc2021
Urshifu-Gmax 1v1
Urshifu battlestadiumsingles
Urshifu-Rapid-Strike vgc2021
Urshifu-Rapid-Strike-Gmax cap
Urshifu-Rapid-Strike-Gmax stabmons
Urshifu-Rapid-Strike-Gmax godlygift
Urshifu-Rapid-Strike-Gmax nationaldex
These are all the pokemon and their formats that have an analysis with no set i.e. if you go to the json file and check urshifu-gmax 1v1, you'll find that it contains comments, credits, teams but no sets. If you go to its corresponding smogon page -> https://www.smogon.com/dex/ss/pokemon/urshifu/1v1/ although its already clearcut that gmax can't be used in 1v1 format, you'll notice that all sets are for urshifu not urshifu gmax. And for just confirmation sake if you go back to the analysis json file at urshifu
this time, you will find that the 1v1 sets are all properly present.
Why I believe the issue to be the case with analysis scraping only is that there is no 1v1 format in the corresponding sets.json for urshifu-gmax however there is a 1v1 format in its analyses json.
"vgc2020": {"sets": [{"name": "Choice Band"}, {"name": "Assault Vest"}]},
"nationaldexmonotype": {}
// no sets?? whys the format thereI did a small python check of gen8.json
of analyses once again
for poke in dt:
for format_ in dt[poke]:
# completely empty, no sets no credits nothing
if not dt[poke][format_]:
print(poke, format_)
Results Being:-
Venusaur battlestadiumdoubles
Venusaur-Gmax vgc2020
Venusaur-Gmax godlygift
Venusaur-Gmax 1v1
Snorlax-Gmax nationaldexru
Darmanitan balancedhackmons
Darmanitan-Zen nationaldexru
Zygarde-Complete mixandmega
Zygarde-Complete 1v1
Zygarde-Complete 2v2doubles
Rillaboom vgc2020
Rillaboom-Gmax 1v1
Rillaboom-Gmax 2v2doubles
Rillaboom-Gmax nationaldexmonotype
Cinderace vgc2020
Cinderace-Gmax 2v2doubles
Coalossal vgc2020
Hatterene vgc2020
Hatterene-Gmax godlygift
Urshifu vgc2020
Urshifu-Rapid-Strike vgc2020
Urshifu-Rapid-Strike-Gmax 1v1
Urshifu-Rapid-Strike-Gmax nationaldexuu
Urshifu-Rapid-Strike-Gmax nationaldexmonotype
These results are different from the results up above, with the similarity in both being that it deals with gmax/formes (in most)
What you will find however is that this issue is not present in their corresponding sets.json
Describe the bug:
BH battle-only formes are collapsed under the original forme
Example:
Mega Diancie's set (https://www.smogon.com/dex/sv/pokemon/diancie/bh/) is collapsed under Diancie with no way to discern that it is a Mega Diancie
Expected behavior:
I expected Diancie-Mega
to be a separate specie
Describe the bug:
The level
key (which when not specified is assumed to be level 100) is missing in the sets json for cases where the level has been explicitly mentioned on the smogon site.
Example:
Level dependent formats such as Little Cup (Level 5) and VGC series (Level 50).
Ponyta in sword/shield (gen 8) is in Little Cup format -> https://www.smogon.com/dex/ss/pokemon/ponyta/
Relevant sets json file however, has no level key for ponyta's little cup sets.
Expected behavior:
"level" key to be specified when level is not 100
or maybe a more byte saving solution would be to explicitly mention the level clause for those particular formats.
The downside that I can think of would be that it can end up needing maintenance manually in-case any new format that depends on explicitly set levels shows up.
Additional context:
This might also imply that there can be missing keys such as gender / shiny.
Which I cannot tell without going through the code which performs the scraping.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.