You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added a new affecting_items field to the StatDetailSerializer that returns items (vitamins and battle items) that affect each stat. This enhancement brings the stat endpoint in line with the existing affecting_moves and affecting_natures fields, providing a complete picture of all factors that can modify a Pokémon's stats.
Files Modified:
pokemon_v2/serializers.py - Added get_items_that_affect() method and affecting_items field to StatDetailSerializer
Makefile - Added auto-detection for Python/pip commands (minor improvement)
Highlights
New get_items_that_affect() method (pokemon_v2/serializers.py:1594): Returns a list of items that affect a given stat
Two categories of items tracked:
Vitamins (permanent stat boosters): HP Up, Protein, Iron, Calcium, Zinc, Carbos
X-Items (temporary battle boosters): X Attack, X Defense, X Sp. Atk, X Sp. Def, X Speed, X Accuracy, X Evasion
OpenAPI schema documentation included with proper typing and examples
Graceful error handling: Silently skips items that don't exist in the database
Consistent with existing patterns: Follows the same structure as affecting_moves and affecting_natures
This change completes the stat detail endpoint by providing comprehensive information about all game mechanics that affect stats. Previously, the API only exposed moves and natures that affect stats, but items are equally important in the Pokémon games for:
Team building and EV training - Vitamins are essential for stat optimization
Battle strategy - X-items provide temporary boosts during battles
Game completeness - Aligns with how the games present stat-modifying mechanics
This makes the PokéAPI more useful for:
Pokémon training calculators and team builders
Battle simulators that need to account for item effects
Educational tools teaching game mechanics
Complete data extraction for Pokémon-related applications
The implementation maintains backward compatibility (purely additive) and follows the existing API design patterns, making it intuitive for current API consumers to adopt.
A PokeAPI/api-data refresh has started. In ~45 minutes the staging branch of PokeAPI/api-data will be pushed with the new generated data.
The staging branch will be deployed in our staging environment and the entire API will be ready to review.
A Pull Request (master<-staging) will be also created at PokeAPI/api-data and assigned to the PokeAPI Core team to be reviewed. If approved and merged new data will soon be available worldwide at pokeapi.co.
The updater script has finished its job and has now opened a Pull Request towards PokeAPI/api-data with the updated data.
The Pull Request can be seen deployed in our staging environment when CircleCI deploy will be finished (check the start time of the last build).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I Changed
Added a new affecting_items field to the StatDetailSerializer that returns items (vitamins and battle items) that affect each stat. This enhancement brings the stat endpoint in line with the existing affecting_moves and affecting_natures fields, providing a complete picture of all factors that can modify a Pokémon's stats.
Files Modified:
Highlights
How to Use
API Endpoint: GET /api/v2/stat/{id}/
Example Request:
curl https://pokeapi.co/api/v2/stat/2/
Example Response (for Attack stat):
{
"id": 2,
"name": "attack",
"affecting_items": [
{
"name": "protein",
"url": "https://pokeapi.co/api/v2/item/46/"
},
{
"name": "x-attack",
"url": "https://pokeapi.co/api/v2/item/47/"
}
],
"affecting_moves": { ... },
"affecting_natures": { ... },
...
}
Significance
This change completes the stat detail endpoint by providing comprehensive information about all game mechanics that affect stats. Previously, the API only exposed moves and natures that affect stats, but items are equally important in the Pokémon games for:
This makes the PokéAPI more useful for:
The implementation maintains backward compatibility (purely additive) and follows the existing API design patterns, making it intuitive for current API consumers to adopt.