smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.77k stars 2.79k forks source link

Bug: Teambuilder Exports sets involving Hidden Power in a format it does not accept when Importing #9737

Closed jmynes closed 1 year ago

jmynes commented 1 year ago

Teambuilder both exports sets, as well as tries to automatically import sets via buttons like Showdown Usage in this format, where Hidden Power has [ ] brackets around the type:

Zapdos @ Leftovers  
Ability: Pressure  
Hidden Power: Grass  
EVs: 4 HP / 252 SpA / 252 Spe  
Timid Nature  
- Thunderbolt  
- Hidden Power [Grass]  
- Baton Pass  
- Thunder Wave  

However, importing a moveset fails when using this format, with this error in Microsoft Edge (and likely Chrome/Chromium)'s console:

storage.js?2d307af6:1250  Uncaught TypeError: Cannot read properties of undefined (reading '3')
    at Storage.importTeam (storage.js?2d307af6:1250:25)
    at child.savePokemonImport (client-teambuilder.js?99a0369c:1727:25)
    at child.dispatchClickButton (client.js?7d9f61ae:2118:22)
    at HTMLButtonElement.e (lodash.core.js?e9be4c2d:12:478)
    at HTMLDivElement.dispatch (jquery-2.1.4.min.js:3:6466)
    at r.handle (jquery-2.1.4.min.js:3:3241)

Smogon's export format does not include brackets around the type, and these import just fine:

Zapdos @ Leftovers
Ability: Pressure
EVs: 4 HP / 252 SpA / 252 Spe
Timid Nature
- Thunderbolt
- Hidden Power Grass
- Thunder Wave
- Roar

Teambuilder's import validation should either fix the error with reading brackets, or not add them at all

DaWoblefet commented 1 year ago

This was fixed on the client when reverting a recent change: https://github.com/smogon/pokemon-showdown-client/commit/2451f24bb6e19c90add1e04479c3f4a1017f75cd