Skip to content

Commit a33d085

Browse files
authored
Merge pull request #571 from phrasmotica/feature/pokemon-form-types
2 parents 6f79bf0 + 48c27bb commit a33d085

File tree

7 files changed

+206
-34
lines changed

7 files changed

+206
-34
lines changed

data/v2/build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,13 @@ def csv_record_to_objects(info):
19641964
(PokemonFormGeneration,), "pokemon_form_generations.csv", csv_record_to_objects
19651965
)
19661966

1967+
def csv_record_to_objects(info):
1968+
yield PokemonFormType(
1969+
pokemon_form_id=int(info[0]), type_id=int(info[1]), slot=int(info[2])
1970+
)
1971+
1972+
build_generic((PokemonFormType,), "pokemon_form_types.csv", csv_record_to_objects)
1973+
19671974
def csv_record_to_objects(info):
19681975
yield PokemonGameIndex(
19691976
pokemon_id=int(info[0]), version_id=int(info[1]), game_index=int(info[2])

data/v2/csv/pokemon_form_types.csv

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
pokemon_form_id,type_id,slot
2+
10041,7,1
3+
10042,17,1
4+
10043,16,1
5+
10044,13,1
6+
10045,2,1
7+
10046,10,1
8+
10047,3,1
9+
10048,8,1
10+
10049,12,1
11+
10050,5,1
12+
10051,15,1
13+
10052,4,1
14+
10053,14,1
15+
10054,6,1
16+
10055,9,1
17+
10056,11,1
18+
10057,10001,1
19+
10085,18,1
20+
10232,2,1
21+
10233,3,1
22+
10234,4,1
23+
10235,5,1
24+
10236,6,1
25+
10237,7,1
26+
10238,8,1
27+
10239,9,1
28+
10240,10,1
29+
10241,11,1
30+
10242,12,1
31+
10243,13,1
32+
10244,14,1
33+
10245,15,1
34+
10246,16,1
35+
10247,17,1
36+
10248,18,1

pokemon_v2/README.md

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ Super contest effects refer to the effects of moves when used in super contests.
398398

399399
#### SuperContestEffect
400400

401-
| Name | Description | Data Type |
401+
| Name | Description | Data Type |
402402
| ---- | ----------- | --------- |
403403
| id | The identifier for this super contest effect resource | integer |
404404
| appeal | The level of appeal this super contest effect has | string |
@@ -795,7 +795,7 @@ A Pokédex is a handheld electronic encyclopedia device; one which is capable of
795795

796796

797797
## Versions
798-
Versions of the games, e.g., Red, Blue or Yellow.
798+
Versions of the games, e.g., Red, Blue or Yellow.
799799

800800
### GET api/v2/version/{id or name}
801801

@@ -833,7 +833,7 @@ Versions of the games, e.g., Red, Blue or Yellow.
833833

834834

835835
## Version Groups
836-
Version groups categorize highly similar versions of the games.
836+
Version groups categorize highly similar versions of the games.
837837

838838
### GET api/v2/version-group/{id or name}
839839

@@ -1114,7 +1114,7 @@ The various effects of the move "Fling" when used with different items.
11141114

11151115
| Name | Description | Data Type |
11161116
| ---- | ----------- | --------- |
1117-
| id | The identifier for this fling effect resource | integer |
1117+
| id | The identifier for this fling effect resource | integer |
11181118
| name | The name for this fling effect resource | string |
11191119
| effect_entries | The result of this fling effect listed in different languages | list [Effect](#effect) |
11201120
| items | A list of items that have this fling effect | list [NamedAPIResource](#namedapiresource) ([Item](#items)) |
@@ -1290,7 +1290,7 @@ Moves are the skills of pokémon in battle. In battle, a Pokémon uses one move
12901290
| type | The elemental type of this move | [NamedAPIResource](#namedapiresource) ([Type](#types)) |
12911291

12921292
#### ContestComboSets
1293-
1293+
12941294
| Name | Description | Data Type |
12951295
| ---- | ----------- | --------- |
12961296
| normal | A detail of moves this move can be used before or after, granting additional appeal points in contests | list [ContestComboDetail](#contestcombodetail) |
@@ -1300,7 +1300,7 @@ Moves are the skills of pokémon in battle. In battle, a Pokémon uses one move
13001300

13011301
| Name | Description | Data Type |
13021302
| ---- | ----------- | --------- |
1303-
| use_before | A list of moves to use before this move | list [NamedAPIResource](#namedapiresource) ([Move](#moves)) |
1303+
| use_before | A list of moves to use before this move | list [NamedAPIResource](#namedapiresource) ([Move](#moves)) |
13041304
| use_after | A list of moves to use after this move | list [NamedAPIResource](#namedapiresource) ([Move](#moves)) |
13051305

13061306
#### MoveMetaData
@@ -1918,7 +1918,7 @@ Abilities provide passive effects for pokémon in battle or in the overworld. Po
19181918
| effect_entries | The previous effect of this ability listed in different languages | [Effect](#effect) |
19191919
| version_group | The version group in which the previous effect of this ability originated | [NamedAPIResource](#namedapiresource) ([VersionGroup](#versiongroups)) |
19201920

1921-
#### AbilityFlavorText
1921+
#### AbilityFlavorText
19221922

19231923
| Name | Description | Data Type |
19241924
| ---- | ----------- | --------- |
@@ -2013,7 +2013,7 @@ Egg Groups are categories which determine which Pokémon are able to interbreed.
20132013

20142014

20152015
## Genders
2016-
Genders were introduced in Generation II for the purposes of breeding pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.
2016+
Genders were introduced in Generation II for the purposes of breeding pokémon but can also result in visual differences or even different evolutionary lines. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Gender) for greater detail.
20172017

20182018
### GET api/v2/gender/{id or name}
20192019

@@ -2059,7 +2059,7 @@ Genders were introduced in Generation II for the purposes of breeding pokémon b
20592059

20602060

20612061
## Growth Rates
2062-
Growth rates are the speed with which pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.
2062+
Growth rates are the speed with which pokémon gain levels through experience. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Experience) for greater detail.
20632063

20642064
### GET api/v2/growth-rate/{id or name}
20652065

@@ -2169,7 +2169,7 @@ Natures influence how a pokémon's stats grow. See [Bulbapedia](http://bulbapedi
21692169
| ---- | ----------- | --------- |
21702170
| id | The identifier for this nature resource | integer |
21712171
| name | The name for this nature resource | string |
2172-
| decreased_stat | The stat decreased by 10% in pokémon with this nature | [NamedAPIResource](#namedapiresource) ([Stat](#stats)) |
2172+
| decreased_stat | The stat decreased by 10% in pokémon with this nature | [NamedAPIResource](#namedapiresource) ([Stat](#stats)) |
21732173
| increased_stat | The stat increased by 10% in pokémon with this nature | [NamedAPIResource](#namedapiresource) ([Stat](#stats)) |
21742174
| hates_flavor | The flavor hated by pokémon with this nature | [NamedAPIResource](#namedapiresource) ([BerryFlavor](#berry-flavors)) |
21752175
| likes_flavor | The flavor liked by pokémon with this nature | [NamedAPIResource](#namedapiresource) ([BerryFlavor](#berry-flavors)) |
@@ -2380,7 +2380,7 @@ Pokémon are the creatures that inhabit the world of the pokemon games. They can
23802380
| location_area_encounters | A list of location areas as well as encounter details pertaining to specific versions | list [LocationAreaEncounter](#locationareaencounter) |
23812381
| moves | A list of moves along with learn methods and level details pertaining to specific version groups | list [NamedAPIResource](#namedapiresource) ([Move](#moves)) |
23822382
| species | The species this pokémon belongs to | [NamedAPIResource](#namedapiresource) ([PokemonSpecies](#pokemon-species)) |
2383-
| stats | A list of base stat values for this pokémon | list [NamedAPIResource](#namedapiresource) ([Stat](#stats)) |
2383+
| stats | A list of base stat values for this pokémon | list [NamedAPIResource](#namedapiresource) ([Stat](#stats)) |
23842384
| types | A list of details showing types this pokémon has | list [PokemonType](#pokemontype) |
23852385
| past_types | A list of details showing types this pokémon had in previous generations | list [PokemonTypePast](#pokemontypepast) |
23862386

@@ -2399,6 +2399,13 @@ Pokémon are the creatures that inhabit the world of the pokemon games. They can
23992399
| slot | The order the pokémon types are listed in | integer |
24002400
| type | The type the referenced pokémon has | string |
24012401

2402+
#### PokemonFormType
2403+
2404+
| Name | Description | Data Type |
2405+
| ---- | ----------- | --------- |
2406+
| slot | The order the Pokémon form types are listed in | integer |
2407+
| type | The type the referenced Pokémon form has | string |
2408+
24022409
#### PokemonTypePast
24032410

24042411
| Name | Description | Data Type |
@@ -2460,22 +2467,31 @@ Some pokémon have the ability to take on different forms. At times, these diffe
24602467

24612468
```json
24622469
{
2463-
"id": 413,
2464-
"name": "wormadam-plant",
2465-
"order": 503,
2466-
"form_order": 1,
2467-
"is_default": true,
2468-
"is_battle_only": false,
2469-
"is_mega": false,
2470-
"form_name": "plant",
2471-
"pokemon": {
2472-
"name": "wormadam-plant",
2473-
"url": "http://pokeapi.co/api/v2/pokemon/413/"
2474-
},
2475-
"version_group": {
2476-
"name": "diamond-pearl",
2477-
"url": "http://pokeapi.co/api/v2/version-group/8/"
2478-
}
2470+
"id": 10041,
2471+
"name": "arceus-bug",
2472+
"order": 631,
2473+
"form_order": 7,
2474+
"is_default": false,
2475+
"is_battle_only": false,
2476+
"is_mega": false,
2477+
"form_name": "bug",
2478+
"pokemon": {
2479+
"name": "arceus",
2480+
"url": "https://pokeapi.co/api/v2/pokemon/493/"
2481+
},
2482+
"version_group": {
2483+
"name": "diamond-pearl",
2484+
"url": "https://pokeapi.co/api/v2/version-group/8/"
2485+
},
2486+
"types": [
2487+
{
2488+
"slot": 1,
2489+
"type": {
2490+
"name": "bug",
2491+
"url": "https://pokeapi.co/api/v2/type/7/"
2492+
}
2493+
}
2494+
]
24792495
}
24802496
```
24812497

@@ -2495,6 +2511,7 @@ Some pokémon have the ability to take on different forms. At times, these diffe
24952511
| form_name | The name of this form | string |
24962512
| pokemon | The pokémon that can take on this form | [NamedAPIResource](#namedapiresource) ([Pokemon](#pokemon)) |
24972513
| version_group | The version group this pokémon form was introduced in | [NamedAPIResource](#namedapiresource) ([VersionGroup](#version-groups)) |
2514+
| types | A list of details showing types this Pokémon form has, if they differ from the types of the Pokémon that can take on this form | list [PokemonFormType](#pokemonformtype) |
24982515

24992516

25002517
## Pokémon Habitats
@@ -2539,7 +2556,7 @@ Habitats are generally different terrain pokémon can be found in but can also b
25392556

25402557

25412558
## Pokémon Shapes
2542-
Shapes used for sorting pokémon in a pokédex.
2559+
Shapes used for sorting pokémon in a pokédex.
25432560

25442561
### GET api/v2/pokemon-shape/{id or name}
25452562

@@ -2597,7 +2614,7 @@ Shapes used for sorting pokémon in a pokédex.
25972614

25982615

25992616
## Pokémon Species
2600-
A Pokémon Species forms the basis for at least one pokémon. Attributes of a Pokémon species are shared across all varieties of pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.
2617+
A Pokémon Species forms the basis for at least one pokémon. Attributes of a Pokémon species are shared across all varieties of pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.
26012618

26022619
### GET api/v2/pokemon-species/{id or name}
26032620

@@ -2685,9 +2702,9 @@ A Pokémon Species forms the basis for at least one pokémon. Attributes of a Po
26852702

26862703
#### PokemonSpecies
26872704

2688-
| Name | Description | Data Type |
2705+
| Name | Description | Data Type |
26892706
| ---- | ----------- | --------- |
2690-
| id | The identifier for this pokémon species resource | integer |
2707+
| id | The identifier for this pokémon species resource | integer |
26912708
| name | The name for this pokémon species resource | string |
26922709
| order | The order in which species should be sorted. Based on National Dex order, except families are grouped together and sorted by stage. | integer |
26932710
| gender_rate | The chance of this Pokémon being female, in eighths; or -1 for genderless | integer |
@@ -2936,7 +2953,7 @@ Types are properties for Pokémon and their moves. Each type has three propertie
29362953

29372954
#### TypeRelations
29382955

2939-
| Name | Description | Data Type |
2956+
| Name | Description | Data Type |
29402957
| ---- | ----------- | --------- |
29412958
| no_damage_to | A list of types this type has no effect on | list [NamedAPIResource](#namedapiresource) ([Type](#types)) |
29422959
| half_damage_to | A list of types this type is not very effect against | list [NamedAPIResource](#namedapiresource) ([Type](#types)) |
@@ -2998,7 +3015,7 @@ Languages for translations of api resource information.
29983015

29993016
#### Description
30003017

3001-
| Name | Description | Data Type |
3018+
| Name | Description | Data Type |
30023019
| ---- | ----------- | --------- |
30033020
| description | The localized description for an api resource in a specific language | string |
30043021
| language | The language this description is in | [NamedAPIResource](#namedapiresource) ([Language](#languages)) |
@@ -3048,7 +3065,7 @@ Languages for translations of api resource information.
30483065

30493066
#### NamedAPIResource
30503067

3051-
| Name | Description | Data Type |
3068+
| Name | Description | Data Type |
30523069
| ---- | ----------- | --------- |
30533070
| name | The name of the referenced resource | string |
30543071
| url | The url of the referenced resource | string |
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Generated by Django 2.1.11 on 2021-02-18 20:45
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
("pokemon_v2", "0009_pokemontypepast"),
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name="PokemonFormType",
16+
fields=[
17+
(
18+
"id",
19+
models.AutoField(
20+
auto_created=True,
21+
primary_key=True,
22+
serialize=False,
23+
verbose_name="ID",
24+
),
25+
),
26+
("slot", models.IntegerField()),
27+
(
28+
"pokemon_form",
29+
models.ForeignKey(
30+
blank=True,
31+
null=True,
32+
on_delete=django.db.models.deletion.CASCADE,
33+
related_name="pokemonformtype",
34+
to="pokemon_v2.PokemonForm",
35+
),
36+
),
37+
(
38+
"type",
39+
models.ForeignKey(
40+
blank=True,
41+
null=True,
42+
on_delete=django.db.models.deletion.CASCADE,
43+
related_name="pokemonformtype",
44+
to="pokemon_v2.Type",
45+
),
46+
),
47+
],
48+
options={
49+
"abstract": False,
50+
},
51+
),
52+
]

pokemon_v2/models.py

100755100644
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,11 @@ class PokemonType(HasPokemon, HasType):
18721872
slot = models.IntegerField()
18731873

18741874

1875+
class PokemonFormType(HasPokemonForm, HasType):
1876+
1877+
slot = models.IntegerField()
1878+
1879+
18751880
# model for a Pokemon's types that were used until a given generation
18761881
class PokemonTypePast(HasPokemon, HasType, HasGeneration):
18771882

0 commit comments

Comments
 (0)