Skip to content

Add pokemon form trigger conditions#1578

Open
dyp1109 wants to merge 3 commits into
PokeAPI:masterfrom
dyp1109:feat/link-form-changes-methods
Open

Add pokemon form trigger conditions#1578
dyp1109 wants to merge 3 commits into
PokeAPI:masterfrom
dyp1109:feat/link-form-changes-methods

Conversation

@dyp1109

@dyp1109 dyp1109 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Change description

Addressing issues #1549 by adding new form triggers fields in /api/v2/pokemon-form/ endpoints.

Changes included:

  • New PokemonFormMethod and PokemonFormCondition models to store how a form is activated,
  • New pokemon_form_methods.csv to define trigger types, and pokemon_form_conditions.csv to link forms to their trigger methods.
  • New za mega-stones in items.csv

AI coding assistance disclosure

I use AI assistant for formatting.

Contributor check list

  • I have written a description of the contribution and explained its motivation.
  • I have written tests for my code changes (if applicable).
  • I have read and understood the AI Assisted Contribution guidelines.
  • I will own this change in production, and I am prepared to fix any bugs caused by my code change.

@Naramsim Naramsim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, can you merge the migrations into a single one?

Can you address the failing tests?

Comment thread data/v2/csv/items.csv Outdated
2231,peat-block,10,0,,
2232,metal-alloy,10,0,, No newline at end of file
2232,metal-alloy,10,0,,
2559,clefablite,44,0,80,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why start at 2559 instead of 2233?

Comment thread data/v2/csv/pokemon_form_conditions.csv Outdated
@@ -0,0 +1,224 @@
pokemon_form_id,form_method_id,item_id,ability_id,move_id

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some more descriptive names like trigger_item_id and so on?

@@ -0,0 +1,7 @@
id,identifier

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add a pokemon_form_method_prose.csv file to match

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the pokemon_form_trigger_prose.csv the one you are referring to?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that’s the one that was added, there was some renaming done

Comment thread pokemon_v2/serializers.py Outdated
model = PokemonFormName
fields = ("name", "pokemon_name", "language")

class PokemonFormTriggerSerializer(serializers.ModelSerializer):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like form trigger as the name rather than form method, but whatever you choose we should make it consistent between these classes and the file.

@dyp1109

dyp1109 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

The new update addresses the comments to fix the ID and naming issues. Migrations is merged into single file and prose csv file is added

@jemarq04

jemarq04 commented Jul 2, 2026

Copy link
Copy Markdown
Member

I'm loving the format and after checking a few pokemon things are looking good! This next part is a bit out of my expertise so I'll tag @Naramsim - would it be good to have this as a separate endpoint (like at pokeapi.co/api/v2/pokemon-form-trigger)? Maybe we could even have it list the pokemon forms that use that trigger (similar to a location area listing the encounters that linked it)?

These suggestions may very well be something we handle in a separate PR and merge this one for now, but I thought I'd bring it up in case it was easy enough to work into this one.

@@ -0,0 +1,7 @@
id,identifier

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, just a silly idea. What about using the evolution_trigger.csv file here? Some triggers are already shared, for example move or consumed-item. @dyp1109 @jemarq04 do you think it can get messy?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think we should make a new endpoint for clarity, as there are evolution triggers that wouldn’t work as form triggers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a clear distinction between form changes and evolution. Form changes are temporary, while evolution is permanent. While that might not be a perfect definition, we should try to separate the two situations as much as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants