Repository navigation
Conversation
|
Hi! just a quick question, currently you used the is it correct? Should we use Example: Gumshoos. https://pokeapi.co/api/v2/pokemon-species/735/ we have two According to the chart you posted the two
|
Thanks for the quick review! I used species on purpose. Couple reasons. Although the spreadsheet has more precise information, for this feature I defined ball legality as "can this species exist in this ball, in any form, in any game", and combined the sheet's variant rows per species. "In any form" includes variants like Totem Gumshoos. I think this will make more sense to most users and avoid confusion. It also loses very little, because only 26 species have variants with different legality at all, and most of them are pretty obvious like pokeball only gifts. Going with pokemon-form would be especially problematic. Someone checking Vivillon's legality would have to work out which of the 20 patterns they have, when 19 of them have identical legality anyway. Nobody's first instinct would be to look up vivillon-archipelago instead of just Vivillon. Some technical issues as well. Right now, I just had to map the data by using the pokedex number. Going per pokemon would mean hand mapping sheet names to PokeAPI names ("Mega Venusaur" → venusaur-mega, "Nidoran♀" → nidoran-f) and writing rules for about 250 pokemon the sheet doesn't cover, like Megas, Gmax and battle forms. That leaves room for errors, and every future sheet update would need the mapping maintained too, which makes contributing harder as new games add more forms and strange ways to name pokemon. However, if you think that one of the two would be a better idea, I'm happy to switch. Again it might be a difficult job in the future to integrate new data, but for now I should be able to build a working name map. In that case, should Megas, Gmax and battle-only forms be empty, or copy their base form's balls? |
|
Hi! it's ok with me, before merging I'd like to just know the opinion of the other @PokeAPI/core-team because this addition is quite peculiar. In first place whether to expose this kind of information and secondly if formatted in a meaningful way. Normally we always differentiate per-version but maybe here it's overkill? |
|
few questions from me if i get this right the main idea is whether a ball is legal for a mon in that game either caught or via breeding etc
|
Legality is not per game. A species counts as legal in a ball if it can legitimately exist in that ball in any mainline game in any form. Regional forms are merged at the species level. If any form is legal in a ball, the species is. So yes, you can't tell from this endpoint which form a ball applies to. The gap is smaller than it looks for most cases because regional breeding passes balls across forms. In SwSh, a Kanto Meowth parent produces a Galarian Meowth egg unless it holds an Everstone, and the egg gets the parent's ball. That's why Perrserker ends up with the same list as Meowth, Safari Ball included. Master, Cherish and Legends Arceus balls are left out because the source sheet doesn't cover them. I guess its because master balls are not inherited, LA balls are considered not mainline, and for Cherish ball I'm not so sure. Just for now The best source I could find, that was also suggested for the issue, decided not to include them. Filling this gap could be a nice task to open to be done next. Finding a reliable source that is easy to use is the biggest challenge. |
Change description
Closes #1612 (Ball legality). This adds a legal_balls field to
/api/v2/pokemon-species/{id}/, listing ball legality for all pokemonsScope
Covers 24 balls: Poké, Great, Ultra, Premier, Nest, Repeat, Dive, Net, Timer, Luxury, Dusk, Heal, Quick, Safari, Sport, Fast, Friend, Heavy, Level, Love, Lure, Moon, Dream and Beast. Master Ball, Cherish Ball and the Legends Arceus balls are not included.
Data source & credit
The data comes from mariomaniac432's spreadsheet.
https://docs.google.com/spreadsheets/d/1jbYzsjuIIGtf7VFgIgV3NDgX4Ym_rXtW4qp-dHbLHbo
How to test
Test results
BallLegalityCSVDataIntegrityTestCase.test_ball_legality_rowschecked that every species id exists inpokemon_species.csv, that every item is one of the 24 supported balls, that there are no duplicate rows, and that the file isn't empty.APITests.test_pokemon_species_legal_ballschecked that a species with no data returns[], that one species' balls don't appear on another, and that results are ordered by item id.APITests.test_pokemon_species_apinow also asserts thelegal_ballsnames and URLs.AI coding assistance disclosure
Used AI to decode the sheet's value codes and column order from its ReadMe and header images, writing the CSV conversion script, and flagging data issues.
Contributor check list