feat: expose form transformations in evolution chains - #1658
feat: expose form transformations in evolution chains#1658MiquelRForgeFlow wants to merge 1 commit into
Conversation
Group the reversible form changes of a chain's species (mega evolution, gigantamax, in-battle transformations) into a new `transformations` field, instead of requiring one pokemon-form lookup per variety. `chain` is unchanged.
|
would adding a new field in pokemon-species > varieties itself not solve this problem? {
"is_default": false,
"pokemon": {
"name": "charizard-mega-x",
"url": "https://pokeapi.co/api/v2/pokemon/10034/"
},
"pokemon_form": ...
}I dont think reversible transformations should be added in whats considered the biological evolution chain |
|
Agreed on the principle: reversible form changes aren't evolution, which is exactly why I kept them out of On putting it in But once it's a list, nesting it under
So I'd rather put a flat list on the species itself: "transformations": [
{"form": {"name": "charizard-mega-x", "url": ".../pokemon-form/10134/"},
"trigger": "held-item", "item": {"name": "charizardite-x", "url": "..."},
"ability": null, "move": null, "base_form": null},
{"form": {"name": "charizard-gmax", "url": ".../pokemon-form/10365/"},
"trigger": "gigantamax-factor", "item": null, "ability": null, "move": null, "base_form": null}
]Empty for 879 of the 1025 species, one extra query either way, and each pair stays readable in one place. If you'd still prefer it under |
Change description
/api/v2/evolution-chain/{id}/only describes species-level evolution. The reversible form changes of those same species (mega evolution, primal reversion, gigantamax, in-battle transformations) live inpokemon_form_conditions.csvand are only reachable one variety at a time:pokemon-species/6→varieties→pokemon/6→forms→pokemon-form/10134→trigger_conditions, i.e. 4 hops to learn that Charizard has two megas and a gmax form.This PR adds a
transformationsfield next tochain, grouping those conditions by species:Design notes:
chainis untouched. Form changes are not evolutions, so they are not chain links (otherwise Arceus would "evolve" into 17 plates and Aegislash into aegislash-blade). Purely additive: no model or migration changes.item/ability/move), unlikepokemon-form'strigger_conditions, which merges the target's{name, url}into the trigger dict and loses which of the three it came from.transformationsis always present,[]when the chain has no form conditions (399 of the 541 chains).AI coding assistance disclosure
It wrote the serializer and the tests from my design decisions.
Contributor check list