Download as pdf or txt
Download as pdf or txt
You are on page 1of 75

Pokedex Documentation

Release 0.1

veekun

June 29, 2014

Contents

Installing the pokedex library


1.1 Quick startup with Ubuntu/Debian-like systems
1.2 Prerequisites . . . . . . . . . . . . . . . . . .
1.3 Getting and installing pokedex . . . . . . . . .
1.4 Loading the database . . . . . . . . . . . . . .
1.5 All done . . . . . . . . . . . . . . . . . . . .

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

3
3
3
4
4
5

Using pokedex
2.1 Connecting . . . .
2.2 Pokdex tables . .
2.3 Getting things . .
2.4 Querying . . . . .
2.5 API documentation

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

7
7
7
8
8
9

The database schema


3.1 The pokdex tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11
11

Indices and tables

69

Python Module Index

71

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

.
.
.
.
.

ii

Pokedex Documentation, Release 0.1

Jump right in!


Contents:

Contents

Pokedex Documentation, Release 0.1

Contents

CHAPTER 1

Installing the pokedex library

1.1 Quick startup with Ubuntu/Debian-like systems


Run the following from an empty directory:
$ sudo apt-get install git python python-pip python-sqlalchemy
$ git clone git://github.com/veekun/pokedex.git
$ pip install -E env -e pokedex
$ source env/bin/activate
(env)$ pokedex setup -v
(env)$ pokedex lookup eevee

If it all goes smoothly, you can now use env/bin/pokedex, the command-line tool, and env/bin/python, a
Python interpreter configured to use the pokedex library.
That is all you need. Feel free to skip the rest of this chapter if youre not interested in the details.

1.2 Prerequisites
1.2.1 Linux
Ubuntu/Debian users should run the following:
$ sudo apt-get install git python python-pip

With other Linuxes, install the packages for git, python (2.6 or 2.7, not 3.x), and python-pip.
If you succeeded, skip the Detailed instructions.

1.2.2 Detailed instructions


You should know what a command line is and how to work with it. The here we assume youre using Linux 1 , if thats
not the case, make sure you have enough computer knowledge to translate the instructions to your operating system.
Pokedex is distributed via Git. So, get Git.
You will also need Python 2; the language pokedex is written in. Be sure to get version 2.6 or 2.7. Pokedex does not
work with Python 3.x yet, and it most likely wont work with 2.5 or earlier.
1 If you write instructions for another OS, well be happy to include them here. The reason your OS is not listed here is because the author
doesnt use it, so naturally he cant write instructions for it.

Pokedex Documentation, Release 0.1

Next, get pip, a tool to install Python packages. Experts can use another tool, of course.
Make sure git and pip are on your path.
Optionally you can install SQLAlchemy, Python markdown, Whoosh, or construct. If you dont, pip will atuomatically
download and install a copy for you, but some are pretty big so you might want to install it system-wide. (Unfortunately, many distros have outdated versions of these libraries, so pip will install pokedexs own copy anyway.)

1.3 Getting and installing pokedex


Run the following from an empty directory:
$ git clone git://github.com/veekun/pokedex.git
$ pip install -E env -e pokedex

This will give you two directories: pokedex (containing the source code and data), and env (a virtualenv).
In env/bin, there are three interesting files:
pokedex: The pokedex program
python: A copy of Python that knows about pokedex and its prerequisites.
activate: Typing source env/bin/activate in a shell will put pokedex and our bin/python on the
$PATH, and generally set things up to work with them. Your prompt will change to let you know of this.
You can end such a session by typing deactivate.
This documentation will assume that youve activated the virtualenv, so pokedex means env/bin/pokedex.

1.3.1 Advanced
You can of course install into an existing virtualenv, by either using its pip and leaving out the -E env, or running
the setup script directly:
(anotherenv)$ cd pokedex
(anotherenv)pokedex$ python setup.py develop

It is also possible to install pokedex system-wide. There are problems with that. Dont do it. The only time you need
sudo is for getting the prerequisites.

1.4 Loading the database


Before you can do anything useful with pokedex, you need to load the database:
$ pokedex setup -v

This will load the data into a default SQLite database and create a default Whoosh index.

1.4.1 Advanced
If you want to use another database, make sure you have the corresponding SQLAlchemy engine for it and either use
the -e switch, (e.g. -e postgresql://@/pokedex), or set the POKEDEX_DB_ENGINE environment variable.
To use another lookup index directory, specify it with -i or the POKEDEX_INDEX_DIR variable.

Chapter 1. Installing the pokedex library

Pokedex Documentation, Release 0.1

Make sure you always use the same options whenever you use pokedex.
If youre confused about what pokedex thinks its settings are, check pokedex status.
See pokedex help for even more options.

1.5 All done


To verify that all went smoothly, check that the pokedex tool finds your favorite pokmon:
$ pokedex lookup eevee

Yes, that was a bit anti-climatic. The command-line tool doesnt do much, currently.

1.5. All done

Pokedex Documentation, Release 0.1

Chapter 1. Installing the pokedex library

CHAPTER 2

Using pokedex

The pokdex is, first and foremost, a Python library. To get the most of it, youll need to learn Python and
SQLAlchemy.
Here is a small example of using pokedex:
from pokedex.db import connect, tables, util
session = connect()
pokemon = util.get(session, tables.PokemonSpecies, ubulbasaur)
print u{0.name}, the {0.genus} Pokemon.format(pokemon)

Running this will give you some Bulbasaur info:


Bulbasaur, the Seed Pokemon

2.1 Connecting
To get information out of the Pokdex, you will need to create a Session.
To do that, use
pokedex.db.connect(). For simple uses, you dont need to give it any arguments: it uses the database that
pokedex load fills up by default. If you need to select another database, give its URI as the first argument.
The object connect() gives you is actually a SQLAlchemy session, giving you the full power of SQLAlchemy
for working with the data. Well cover some basics here, but if you intend to do some serious work, do read
SQLAlchemys docs.

2.2 Pokdex tables


Data in the pokdex is organized in tables, defined in pokedex.db.tables. There is quite a few or them. To get
you started, here are a few common ones:
PokemonSpecies
Move
Item
Type

Pokedex Documentation, Release 0.1

2.3 Getting things


If you know what you want from the pokdex, you can use the pokedex.db.util.get() function. It looks up a
thing in a table, based on its identifier, name, or ID, and returns it.
def print_pokemon(pokemon):
print u{0.name}, the {0.genus} Pokemon.format(pokemon)
print_pokemon(util.get(session, tables.PokemonSpecies, identifier=ueevee))
print_pokemon(util.get(session, tables.PokemonSpecies, name=uHo-Oh))
print_pokemon(util.get(session, tables.PokemonSpecies, id=50))
def print_item(item):
print u{0.name}: ${0.cost}.format(item)
print_item(util.get(session, tables.Item, identifier=ugreat-ball))
print_item(util.get(session, tables.Item, name=uPotion))
print_item(util.get(session, tables.Item, id=30))
Eevee, the Evolution Pokemon
Ho-Oh, the Rainbow Pokemon
Diglett, the Mole Pokemon
Great Ball: $600
Potion: $300
Fresh Water: $200

2.4 Querying
So, how do you get data from the session? You use the sessions query() method, and give it a pokdex Table as an
argument. This will give you a SQLAlchemy query.

2.4.1 Ordering
As always with SQL, you should not rely on query results being in some particular order unless you have ordered
the query first. This means that youll want to sort just about every query you will make.
For example, you can get a list of all pokmon species, sorted by their id, like so:
for pokemon in session.query(tables.PokemonSpecies).order_by(tables.PokemonSpecies.id):
print pokemon.name
Bulbasaur
Ivysaur
Venusaur
Charmander
Charmeleon
...
Xerneas
Yveltal
Zygarde

Or to order by name:

Chapter 2. Using pokedex

Pokedex Documentation, Release 0.1

for pokemon in session.query(tables.PokemonSpecies).order_by(tables.PokemonSpecies.name):


print pokemon.name
Abomasnow
...
Zygarde

2.4.2 Filtering
Another major operation on queries is filtering, using the querys filter() or filter_by() methods:
for move in session.query(tables.Move).filter(tables.Move.power > 200):
print move.name
Explosion

2.4.3 Joining
The final operation well cover here is joining other tables to the query, using the querys join(). You will usually
want to join on a relationship, such as in the following example:
query
query
query
query
query
query

=
=
=
=
=
=

session.query(tables.Move)
query.join(tables.Move.type)
query.filter(tables.Type.identifier == ugrass)
query.filter(tables.Move.power >= 100)
query.order_by(tables.Move.power)
query.order_by(tables.Move.name)

print The most powerful Grass-type moves:


for move in query:
print u{0.name} ({0.power}).format(move)
The most powerful Grass-type moves:
Petal Dance (120)
Power Whip (120)
Seed Flare (120)
Solar Beam (120)
Wood Hammer (120)
Leaf Storm (130)
Frenzy Plant (150)

That concludes our brief tutorial. If you need to do more, consult the SQLAlchemy documentation.

2.5 API documentation


pokedex.db.connect(uri=None, session_args={}, engine_args={}, engine_prefix=)
Connects to the requested URI. Returns a session object.
With the URI omitted, attempts to connect to a default SQLite database contained within the package directory.
Calling this function also binds the metadata object to the created engine.
See sqlalchemy.orm.session.Session for more documentation on the returned object.

2.5. API documentation

Pokedex Documentation, Release 0.1

pokedex.db.util.get(session, table, identifier=None, name=None, id=None, language=None)


Get one object from the database.
session: The session to use (from pokedex.db.connect()) table:
pokedex.db.tables.Move)

The table to select from (such as

identifier: Identifier of the object name: The name of the object id: The ID number of the object
language: A Language to use for name and form_name
All conditions must match, so its not a good idea to specify more than one of identifier/name/id at once.
If zero or more than one objects matching the criteria are found, the appropriate SQLAlchemy exception is
raised.

10

Chapter 2. Using pokedex

CHAPTER 3

The database schema

3.1 The pokdex tables


The pokedex.db.tables module defines all of the tables in the Pokdex.
SQLAlchemys declarative extension.

They are all defined with

To introspect the tables programmatically, you can use the following:


pokedex.db.tables.mapped_classes
A list of all the classes you see below.
pokedex.db.tables.metadata
The SQLAlchemy MetaData containing all the tables.
Each of the classes has a translation_classes attribute: a potentially empty list of translation classes. See
pokedex.db.multilang for how these work.
Many tables have these columns:
id: An integer primary key. Sometimes its semantically meaningful, most often it isnt.
identifier: A string identifier of the class, and the preferred way to access individual items.
name: A name (uses the multilang functionality)

3.1.1 Pokmon
PokemonSpecies
pokedex.db.tables.PokemonSpecies
A Pokmon species: the standard 1151. Or 649. Whatever.
Table name: pokemon_species (single: pokemon_species)
Primary key: id.
Has id, identifier, and name via pokemon_species_names.
Columns:
PokemonSpecies.generation (generation_id Generation.id)
ID of the generation this species first appeared in
PokemonSpecies.evolves_from_species_id ( PokemonSpecies.id):

11

Pokedex Documentation, Release 0.1

The species from which this one evolves


PokemonSpecies.evolution_chain (evolution_chain_id EvolutionChain.id)
ID of the species evolution chain (a.k.a. family)
PokemonSpecies.color (color_id PokemonColor.id)
ID of this Pokmons Pokdex color, as used for a gimmick search function in the games.
PokemonSpecies.shape (shape_id PokemonShape.id)
ID of this Pokmons body shape, as used for a gimmick search function in the games.
PokemonSpecies.habitat (habitat_id PokemonHabitat.id)
ID of this Pokmons habitat, as used for a gimmick search function in the games.
PokemonSpecies.gender_rate (int):
The chance of this Pokmon being female, in eighths; or -1 for genderless
PokemonSpecies.capture_rate (int):
The base capture rate; up to 255
PokemonSpecies.base_happiness (int):
The tameness when caught by a normal ball
PokemonSpecies.is_baby (bool):
True iff the Pokmon is a baby, i.e. a lowest-stage Pokmon that cannot breed but whose evolved
form can.
PokemonSpecies.hatch_counter (int):
Initial hatch counter: one must walk 255 (hatch_counter + 1) steps before this Pokmons egg
hatches, unless utilizing bonuses like Flame Bodys
PokemonSpecies.has_gender_differences (bool):
Set iff the species exhibits enough sexual dimorphism to have separate sets of sprites in Gen IV and
beyond.
PokemonSpecies.growth_rate (growth_rate_id GrowthRate.id)
ID of the growth rate for this family
PokemonSpecies.forms_switchable (bool):
True iff a particular individual of this species can switch beween its different forms.
PokemonSpecies.order (int):
The order in which species should be sorted. Based on National Dex order, except families are
grouped together and sorted by stage.
PokemonSpecies.conquest_order (int):
The order in which species should be sorted for Pokmon Conquest-related tables. Matches gallery
order.
Internationalized strings:
PokemonSpecies.genus (unicode plaintext) via pokemon_species_names
The short flavor text, such as Seed or Lizard; usually affixed with the word Pokmon
PokemonSpecies.flavor_summary (unicode plaintext) via pokemon_species_flavor_summaries

12

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Text containing facts from all flavor texts, for languages without official game translations
PokemonSpecies.form_description (unicode markdown) via pokemon_species_prose
Description of how the forms work
Relationships:
PokemonSpecies.child_species ( [PokemonSpecies])
The species to which this one evolves
PokemonSpecies.conquest_abilities ( [Ability])
Association table: conquest_pokemon_abilities
Ordered by: conquest_pokemon_abilities.slot
PokemonSpecies.conquest_evolution ( ConquestPokemonEvolution)
PokemonSpecies.conquest_max_links ( [ConquestMaxLink])
Ordered by: conquest_max_links.warrior_rank_id
PokemonSpecies.conquest_move ( Move)
Association table: conquest_pokemon_moves
PokemonSpecies.conquest_stats ( [ConquestPokemonStat])
PokemonSpecies.default_form ( PokemonForm)
A representative form of this species
Association table: pokemon
PokemonSpecies.default_pokemon ( Pokemon)
PokemonSpecies.dex_numbers ( [PokemonDexNumber])
Ordered by: pokemon_dex_numbers.pokedex_id ASC
PokemonSpecies.egg_groups ( [EggGroup])
Association table: pokemon_egg_groups
Ordered by: pokemon_egg_groups.egg_group_id ASC
PokemonSpecies.evolutions ( [PokemonEvolution])
PokemonSpecies.flavor_text ( [PokemonSpeciesFlavorText])
Ordered by: pokemon_species_flavor_text.version_id ASC
PokemonSpecies.forms ( [PokemonForm])
Association table: pokemon
Ordered by:
ASC

pokemon_forms."order" ASC, pokemon_forms.form_identifier

PokemonSpecies.pal_park ( PalPark)
PokemonSpecies.parent_species ( PokemonSpecies)
The species from which this one evolves
PokemonSpecies.pokemon ( [Pokemon])
PokemonSpecies.triggered_evolutions ( [PokemonEvolution])

3.1. The pokdex tables

13

Pokedex Documentation, Release 0.1

Pokemon
pokedex.db.tables.Pokemon
A Pokmon. The core to this whole mess.
This table defines Pokmon the same way the games do: a form with different types, moves, or other gamechanging properties counts as a different Pokmon. For example, this table contains four rows for Deoxys, but
only one for Unown.
Table name: pokemon (single: pokemon)
Primary key: id.
Has id and identifier.
Columns:
Pokemon.species (species_id PokemonSpecies.id)
ID of the species this Pokmon belongs to
Pokemon.height (int):
The height of the Pokmon, in decimeters (tenths of a meter)
Pokemon.weight (int):
The weight of the Pokmon, in tenths of a kilogram (decigrams)
Pokemon.base_experience (int):
The base EXP gained when defeating this Pokmon
Pokemon.order (int):
Order for sorting. Almost national order, except families are grouped together.
Pokemon.is_default (bool):
Set for exactly one pokemon used as the default for each species.
Relationships:
Pokemon.abilities ( [Ability])
Abilities the Pokmon can have in the wild
Association table: pokemon_abilities
Ordered by: pokemon_abilities.slot ASC
Pokemon.all_abilities ( [Ability])
All abilities the Pokmon can have, including the Hidden Ability
Association table: pokemon_abilities
Ordered by: pokemon_abilities.slot ASC
Pokemon.default_form ( PokemonForm)
A representative form of this pokmon
Pokemon.encounters ( [Encounter])
Pokemon.forms ( [PokemonForm])
Ordered by:
ASC

14

pokemon_forms."order" ASC, pokemon_forms.form_identifier

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Pokemon.hidden_ability ( Ability)
The Pokmons Hidden Ability
Association table: pokemon_abilities
Pokemon.items ( [PokemonItem])
Info about items this pokmon holds in the wild
Ordered by: pokemon_items.rarity DESC
Pokemon.pokemon_abilities ( [PokemonAbility])
All abilities the Pokmon can have, as bridge rows
Ordered by: pokemon_abilities.slot ASC
Pokemon.pokemon_moves ( [PokemonMove])
Pokemon.stats ( [PokemonStat])
Ordered by: pokemon_stats.stat_id ASC
Pokemon.types ( [Type])
Association table: pokemon_types
Ordered by: pokemon_types.slot ASC
base_stat(stat_identifier, default=0)
Return this Pokemons base stat value for the given stat identifier, or default if missing.
better_damage_class
Returns the MoveDamageClass that this Pokmon is best suited for, based on its attack stats.
If the attack stats are about equal (within 5), returns None. The value None, not the damage class called
None.
name
Returns a name for this Pokmon, specifiying the form iff it represents a specific PokemonForm.
stat(stat_identifier)
Returns a PokemonStat record for the given stat name (or Stat row object). Uses the normal has-many
machinery, so all the stats are effectively cached.
PokemonForm
pokedex.db.tables.PokemonForm
An individual form of a Pokmon. This includes every variant (except color differences) of every Pokmon,
regardless of how the games treat them. Even Pokmon with no alternate forms have one row in this table, to
represent their lone normal form.
Table name: pokemon_forms (single: pokemon_form)
Primary key: id.
Has id and identifier.
Columns:
PokemonForm.form_identifier (unicode identifier):
An identifier of the form, uniue among a species. May be None for the default form of the species.
PokemonForm.pokemon (pokemon_id Pokemon.id)

3.1. The pokdex tables

15

Pokedex Documentation, Release 0.1

The ID of the base Pokmon for this form.


PokemonForm.introduced_in_version_group_id ( VersionGroup.id):
The ID of the version group in which this form first appeared.
PokemonForm.is_default (bool):
Set for exactly one form used as the default for each pokemon (not necessarily species).
PokemonForm.is_battle_only (bool):
Set iff the form can only appear in battle.
PokemonForm.is_mega (bool):
Records whether this form is a Mega Evolution.
PokemonForm.form_order (int):
The order in which forms should be sorted within a species forms. Multiple forms may have equal order, in which case they should fall back on sorting by name. Used in generating pokemon_forms.order
and pokemon.order.
PokemonForm.order (int):
The order in which forms should be sorted within all forms. Multiple forms may have equal order, in
which case they should fall back on sorting by name.
Internationalized strings:
PokemonForm.form_name (unicode plaintext) via pokemon_form_names
The full form name, e.g. Sky Forme, for pokmon with different forms
PokemonForm.pokemon_name (unicode plaintext) via pokemon_form_names
The full pokmon name, e.g. Sky Shaymin, for pokmon with different forms
Relationships:
PokemonForm.pokeathlon_stats ( [PokemonFormPokeathlonStat])
Ordered by: pokemon_form_pokeathlon_stats.pokeathlon_stat_id
PokemonForm.pokemon_form_generations ( [PokemonFormGeneration])
Ordered by: pokemon_form_generations.generation_id
PokemonForm.version_group ( VersionGroup)
Association Proxies:
PokemonForm.species: species of self.pokemon
name
Name of this form: the form_name, if set; otherwise the species name
EvolutionChain
pokedex.db.tables.EvolutionChain
A family of Pokmon that are linked by evolution
Table name: evolution_chains
Primary key: id.
Has id.
16

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Columns:
EvolutionChain.baby_trigger_item (baby_trigger_item_id Item.id)
Item that a parent must hold while breeding to produce a baby
Relationships:
EvolutionChain.species ( [PokemonSpecies])
Ordered by: pokemon_species.id ASC
PokemonEvolution
pokedex.db.tables.PokemonEvolution
A required action (trigger) and the conditions under which the trigger must occur to cause a Pokmon to
evolve.
Any condition may be null if it does not apply for a particular Pokmon.
Table name: pokemon_evolution
Primary key: id.
Has id.
Columns:
PokemonEvolution.evolved_species (evolved_species_id PokemonSpecies.id)
The ID of the post-evolution species.
PokemonEvolution.evolution_trigger_id ( EvolutionTrigger.id):
The ID of the evolution trigger.
PokemonEvolution.trigger_item (trigger_item_id Item.id)
The ID of the item that must be used on the Pokmon.
PokemonEvolution.minimum_level (int):
The minimum level for the Pokmon.
PokemonEvolution.gender (gender_id Gender.id)
The ID of the Pokmons required gender, or None if gender doesnt matter
PokemonEvolution.location (location_id Location.id)
The ID of the location the evolution must be triggered at.
PokemonEvolution.held_item (held_item_id Item.id)
The ID of the item the Pokmon must hold.
PokemonEvolution.time_of_day (enum: [day, night]):
The required time of day.
PokemonEvolution.known_move (known_move_id Move.id)
The ID of the move the Pokmon must know.
PokemonEvolution.known_move_type (known_move_type_id Type.id)
The ID of the type the Pokmon must know a move of.
PokemonEvolution.minimum_happiness (int):
3.1. The pokdex tables

17

Pokedex Documentation, Release 0.1

The minimum happiness value the Pokmon must have.


PokemonEvolution.minimum_beauty (int):
The minimum Beauty value the Pokmon must have.
PokemonEvolution.minimum_affection (int):
The minimum number of affection hearts the Pokmon must have in Pokmon-Amie.
PokemonEvolution.relative_physical_stats (int):
The required relation between the Pokmons Attack and Defense stats, as sgn(atk-def).
PokemonEvolution.party_species (party_species_id PokemonSpecies.id)
The ID of the species that must be present in the party.
PokemonEvolution.party_type (party_type_id Type.id)
The ID of a type that at least one party member must have.
PokemonEvolution.trade_species (trade_species_id PokemonSpecies.id)
The ID of the species for which this one must be traded.
PokemonEvolution.needs_overworld_rain (bool):
True iff it needs to be raining outside of battle.
PokemonEvolution.turn_upside_down (bool):
True iff the 3DS needs to be turned upside-down as this Pokmon levels up.
Relationships:
PokemonEvolution.trigger ( EvolutionTrigger)

3.1.2 Moves
Move
pokedex.db.tables.Move
A Move: technique or attack a Pokmon can learn to use
Table name: moves (single: move)
Primary key: id.
Has id, identifier, and name via move_names.
Columns:
Move.generation (generation_id Generation.id)
ID of the generation this move first appeared in
Move.type (type_id Type.id)
ID of the moves elemental type
Move.power (int):
Base power of the move, null if it does not have a set base power.
Move.pp (int):
Base PP (Power Points) of the move, nullable if not applicable (e.g. Struggle and Shadow moves).
18

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Move.accuracy (int):
Accuracy of the move; NULL means it never misses
Move.priority (int):
The moves priority bracket
Move.target (target_id MoveTarget.id)
ID of the target (range) of the move
Move.damage_class (damage_class_id MoveDamageClass.id)
ID of the damage class (physical/special) of the move
Move.effect (effect_id MoveEffect.id)
ID of the moves effect
Move.effect_chance (int):
The chance for a secondary effect. What this is a chance of is specified by the moves effect.
Move.contest_type (contest_type_id ContestType.id)
ID of the moves Contest type (e.g. cool or smart)
Move.contest_effect (contest_effect_id ContestEffect.id)
ID of the moves Contest effect
Move.super_contest_effect (super_contest_effect_id SuperContestEffect.id)
ID of the moves Super Contest effect
Internationalized strings:
Move.flavor_summary (unicode plaintext) via move_flavor_summaries
Text containing facts from all flavor texts, for languages without official game translations
Relationships:
Move.changelog ( [MoveChangelog])
Ordered by: move_changelog.changed_in_version_group_id DESC
Move.conquest_data ( ConquestMoveData)
Move.conquest_pokemon ( [PokemonSpecies])
Association table: conquest_pokemon_moves
Ordered by: pokemon_species.conquest_order
Move.contest_combo_first ( [ContestCombo])
Move.contest_combo_second ( [ContestCombo])
Move.flavor_text ( [MoveFlavorText])
Ordered by: move_flavor_text.version_group_id
Move.machines ( [Machine])
Move.meta ( MoveMeta)
Move.meta_stat_changes ( [MoveMetaStatChange])
Move.move_effect ( MoveEffect)

3.1. The pokdex tables

19

Pokedex Documentation, Release 0.1

Move.move_flags ( [MoveFlagMap])
Move.pokemon_moves ( [PokemonMove])
Move.super_contest_combo_first ( [SuperContestCombo])
Move.super_contest_combo_second ( [SuperContestCombo])
Move.triggered_evolutions ( [PokemonEvolution])
Association Proxies:
Move.contest_combo_next: second of self.contest_combo_first
Move.contest_combo_prev: first of self.contest_combo_second
Move.flags: flag of self.move_flags
Move.super_contest_combo_next: second of self.super_contest_combo_first
Move.super_contest_combo_prev: first of self.super_contest_combo_second
Undocumented:
Move.effect_map
Move.short_effect
Move.short_effect_map
MoveEffect
pokedex.db.tables.MoveEffect
An effect of a move
Table name: move_effects (single: move_effect)
Primary key: id.
Has id.
Internationalized strings:
MoveEffect.short_effect (unicode markdown) via move_effect_prose
A short summary of the effect
MoveEffect.effect (unicode markdown) via move_effect_prose
A detailed description of the effect
Relationships:
MoveEffect.changelog ( [MoveEffectChangelog])
Ordered by: move_effect_changelog.changed_in_version_group_id DESC
MoveEffect.move_changelog ( [MoveChangelog])
MoveEffect.moves ( [Move])

20

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

MoveMeta
pokedex.db.tables.MoveMeta
Metadata for move effects, sorta-kinda ripped straight from the game
Table name: move_meta
Primary key: move_id.
Columns:
MoveMeta.move (move_id Move.id)
A numeric ID
MoveMeta.meta_category_id ( MoveMetaCategory.id):
ID of the move category
MoveMeta.meta_ailment_id ( MoveMetaAilment.id):
ID of the caused ailment
MoveMeta.min_hits (int):
Minimum number of hits per use
MoveMeta.max_hits (int):
Maximum number of hits per use
MoveMeta.min_turns (int):
Minimum number of turns the user is forced to use the move
MoveMeta.max_turns (int):
Maximum number of turns the user is forced to use the move
MoveMeta.recoil (int):
Recoil damage, in percent of damage done
MoveMeta.healing (int):
Healing, in percent of users max HP
MoveMeta.crit_rate (int):
Critical hit rate bonus
MoveMeta.ailment_chance (int):
Chance to cause an ailment, in percent
MoveMeta.flinch_chance (int):
Chance to cause flinching, in percent
MoveMeta.stat_chance (int):
Chance to cause a stat change, in percent
Relationships:
MoveMeta.ailment ( MoveMetaAilment)
MoveMeta.category ( MoveMetaCategory)

3.1. The pokdex tables

21

Pokedex Documentation, Release 0.1

3.1.3 Items
Item
pokedex.db.tables.Item
An Item from the games, like Pok Ball or Bicycle.
Table name: items (single: item)
Primary key: id.
Has id, identifier, and name via item_names.
Columns:
Item.category (category_id ItemCategory.id)
ID of a category this item belongs to
Item.cost (int):
Cost of the item when bought. Items sell for half this price.
Item.fling_power (int):
Power of the move Fling when used with this item.
Item.fling_effect (fling_effect_id ItemFlingEffect.id)
ID of the fling-effect of the move Fling when used with this item. Note that these are different from
move effects.
Internationalized strings:
Item.short_effect (unicode markdown) via item_prose
A short summary of the effect
Item.effect (unicode markdown) via item_prose
Detailed description of the items effect.
Item.flavor_summary (unicode plaintext) via item_flavor_summaries
Text containing facts from all flavor texts, for languages without official game translations
Relationships:
Item.berry ( Berry)
Item.conquest_evolutions ( [ConquestPokemonEvolution])
Item.evolution_chains ( [EvolutionChain])
Item.flags ( [ItemFlag])
Association table: item_flag_map
Item.flavor_text ( [ItemFlavorText])
Ordered by: item_flavor_text.version_group_id ASC
Item.game_indices ( [ItemGameIndex])
Item.machines ( [Machine])
Ordered by: machines.version_group_id ASC

22

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Item.pokemon ( [PokemonItem])
Item.required_for_evolutions ( [PokemonEvolution])
Item.triggered_evolutions ( [PokemonEvolution])
Association Proxies:
Item.pocket: pocket of self.category
appears_underground
True if the item appears underground, as specified by the appropriate flag
Berry
pokedex.db.tables.Berry
A Berry, consumable item that grows on trees
For data common to all items, such as the name, see the corresponding item entry.
Table name: berries
Primary key: id.
Has id.
Columns:
Berry.item (item_id Item.id)
The ID of the item that represents this Berry
Berry.firmness (firmness_id BerryFirmness.id)
The ID of this Berrys firmness category
Berry.natural_gift_power (int):
Natural Gifts power when used with this Berry
Berry.natural_gift_type (natural_gift_type_id Type.id)
The ID of the Type that Natural Gift has when used with this Berry
Berry.size (int):
The size of this Berry, in millimeters
Berry.max_harvest (int):
The maximum number of these berries that can grow on one tree in Generation IV
Berry.growth_time (int):
Time it takes the tree to grow one stage, in hours. Berry trees go through four of these growth stages
before they can be picked.
Berry.soil_dryness (int):
The speed at which this Berry dries out the soil as it grows. A higher rate means the soil dries more
quickly.
Berry.smoothness (int):
The smoothness of this Berry, used in making Pokblocks or Poffins

3.1. The pokdex tables

23

Pokedex Documentation, Release 0.1

Relationships:
Berry.berry_firmness ( BerryFirmness)
Berry.flavors ( [BerryFlavor])
Ordered by: berry_flavors.contest_type_id

3.1.4 Types
Type
pokedex.db.tables.Type
Any of the elemental types Pokmon and moves can have.
Table name: types (single: type)
Primary key: id.
Has id, identifier, and name via type_names.
Columns:
Type.generation (generation_id Generation.id)
The ID of the generation this type first appeared in.
Type.damage_class (damage_class_id MoveDamageClass.id)
The ID of the damage class this types moves had before Generation IV, null if not applicable (e.g.
???).
Relationships:
Type.conquest_kingdom ( ConquestKingdom)
Type.conquest_warriors ( [ConquestWarrior])
Association table: conquest_warrior_specialties
Type.damage_efficacies ( [TypeEfficacy])
Type.move_changelog ( [MoveChangelog])
Type.moves ( [Move])
Type.pokemon ( [Pokemon])
Association table: pokemon_types
Ordered by: pokemon.order
Type.target_efficacies ( [TypeEfficacy])

3.1.5 Abilities
Ability
pokedex.db.tables.Ability
An ability a Pokmon can have, such as Static or Pressure.
Table name: abilities (single: ability)
Primary key: id.
24

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Has id, identifier, and name via ability_names.


Columns:
Ability.generation (generation_id Generation.id)
The ID of the generation this ability was introduced in
Ability.is_main_series (bool):
True iff the ability exists in the main series.
Internationalized strings:
Ability.short_effect (unicode markdown) via ability_prose
A short summary of this abilitys effect
Ability.effect (unicode markdown) via ability_prose
A detailed description of this abilitys effect
Relationships:
Ability.all_pokemon ( [Pokemon])
Association table: pokemon_abilities
Ordered by: pokemon."order" ASC
Ability.changelog ( [AbilityChangelog])
Ordered by: ability_changelog.changed_in_version_group_id DESC
Ability.conquest_pokemon ( [PokemonSpecies])
Association table: conquest_pokemon_abilities
Ordered by: pokemon_species.conquest_order
Ability.flavor_text ( [AbilityFlavorText])
Ordered by: ability_flavor_text.version_group_id
Ability.hidden_pokemon ( [Pokemon])
Association table: pokemon_abilities
Ordered by: pokemon.order
Ability.pokemon ( [Pokemon])
Association table: pokemon_abilities
Ordered by: pokemon."order" ASC

3.1.6 Language
Language
pokedex.db.tables.Language
A language the Pokmon games have been translated into
Table name: languages (single: language)
Primary key: id.
Has id, identifier, and name via language_names.
3.1. The pokdex tables

25

Pokedex Documentation, Release 0.1

Columns:
Language.iso639 (unicode identifier):
The two-letter code of the country where this language is spoken. Note that it is not unique.
Language.iso3166 (unicode identifier):
The two-letter code of the language. Note that it is not unique.
Language.official (bool):
True iff games are produced in the language.
Language.order (int):
Order for sorting in foreign name lists.

3.1.7 Version stuff


Generation
pokedex.db.tables.Generation
A Generation of the Pokmon franchise
Table name: generations (single: generation)
Primary key: id.
Has id, identifier, and name via generation_names.
Columns:
Generation.main_region (main_region_id Region.id)
ID of the region this generations main games take place in
Relationships:
Generation.abilities ( [Ability])
Generation.moves ( [Move])
Generation.pokemon_form_generations ( [PokemonFormGeneration])
Ordered by: pokemon_form_generations.game_index
Generation.species ( [PokemonSpecies])
Generation.types ( [Type])
Generation.version_groups ( [VersionGroup])
Ordered by: version_groups.order
Generation.versions ( [Version])
Association table: version_groups
VersionGroup
pokedex.db.tables.VersionGroup
A group of versions, containing either two paired versions (such as Red and Blue) or a single game (such as
Yellow.)

26

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Table name: version_groups


Primary key: id.
Has id and identifier.
Columns:
VersionGroup.generation (generation_id Generation.id)
The ID of the generation the games in this group belong to.
VersionGroup.order (int):
Order for sorting. Almost by date of release, except similar versions are grouped together.
Relationships:
VersionGroup.ability_changelog ( [AbilityChangelog])
VersionGroup.machines ( [Machine])
Ordered by: machines.machine_number
VersionGroup.move_changelog ( [MoveChangelog])
VersionGroup.move_effect_changelog ( [MoveEffectChangelog])
VersionGroup.pokedexes ( [Pokedex])
Association table: pokedex_version_groups
VersionGroup.pokemon_move_methods ( [PokemonMoveMethod])
Association table: version_group_pokemon_move_methods
VersionGroup.pokemon_moves ( [PokemonMove])
VersionGroup.version_group_move_methods ( [VersionGroupPokemonMoveMethod])
VersionGroup.version_group_regions ( [VersionGroupRegion])
VersionGroup.versions ( [Version])
Ordered by: versions.id
Association Proxies:
VersionGroup.regions: region of self.version_group_regions
Version
pokedex.db.tables.Version
An individual main-series Pokmon game.
Table name: versions (single: version)
Primary key: id.
Has id, identifier, and name via version_names.
Columns:
Version.version_group (version_group_id VersionGroup.id)
The ID of the version group this game belongs to.

3.1. The pokdex tables

27

Pokedex Documentation, Release 0.1

Relationships:
Version.encounters ( [Encounter])
Association Proxies:
Version.generation: generation of self.version_group
Pokedex
pokedex.db.tables.Pokedex
A collection of Pokmon species ordered in a particular way
Table name: pokedexes (single: pokedex)
Primary key: id.
Has id, identifier, and name via pokedex_prose.
Columns:
Pokedex.region (region_id Region.id)
ID of the region this Pokdex is used in, or None if its global
Pokedex.is_main_series (bool):
True if this Pokdex appears in the main series.
Internationalized strings:
Pokedex.description (unicode plaintext) via pokedex_prose
A longer description of the Pokdex
Relationships:
Pokedex.version_groups ( [VersionGroup])
Association table: pokedex_version_groups
Ordered by: version_groups."order" ASC
Region
pokedex.db.tables.Region
Major areas of the world: Kanto, Johto, etc.
Table name: regions (single: region)
Primary key: id.
Has id, identifier, and name via region_names.
Relationships:
Region.generation ( Generation)
Region.locations ( [Location])
Region.pokedexes ( [Pokedex])
Region.version_group_regions ( [VersionGroupRegion])
Ordered by: version_group_regions.version_group_id ASC

28

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Region.version_groups ( [VersionGroup])
Association table: version_group_regions
Ordered by: version_groups.order

3.1.8 Encounters
Location
pokedex.db.tables.Location
A place in the Pokmon world
Table name: locations (single: location)
Primary key: id.
Has id, identifier, and name via location_names.
Columns:
Location.region (region_id Region.id)
ID of the region this location is in
Relationships:
Location.areas ( [LocationArea])
Location.game_indices ( [LocationGameIndex])
Location.triggered_evolutions ( [PokemonEvolution])
LocationArea
pokedex.db.tables.LocationArea
A sub-area of a location
Table name: location_areas (single: location_area)
Primary key: id.
Has id, identifier, and name via location_area_prose.
Columns:
LocationArea.location (location_id Location.id)
ID of the location this area is part of
LocationArea.game_index (int):
ID the games use for this area
Relationships:
LocationArea.encounter_rates ( [LocationAreaEncounterRate])
LocationArea.encounters ( [Encounter])

3.1. The pokdex tables

29

Pokedex Documentation, Release 0.1

LocationAreaEncounterRate
pokedex.db.tables.LocationAreaEncounterRate
None
Table name: location_area_encounter_rates
Primary key: location_area_id, encounter_method_id, version_id.
Columns:
LocationAreaEncounterRate.location_area (location_area_id LocationArea.id)
ID of the area
LocationAreaEncounterRate.encounter_method_id ( EncounterMethod.id):
ID of the method
LocationAreaEncounterRate.version_id ( Version.id):
ID of the version
LocationAreaEncounterRate.rate (int):
The encounter rate
Relationships:
LocationAreaEncounterRate.method ( EncounterMethod)
Encounter
pokedex.db.tables.Encounter
Encounters with wild Pokmon.
Bear with me, here.
Within a given area in a given game, encounters are differentiated by the slot they are in and the state of the
game world.
What the player is doing to get an encounter, such as surfing or walking through tall grass, is called a method.
Each method has its own set of encounter slots.
Within a method, slots are defined primarily by rarity. Each slot can also be affected by world conditions; for
example, the 20% slot for walking in tall grass is affected by whether a swarm is in effect in that area. Is there a
swarm? is a condition; there is a swarm and there is not a swarm are the possible values of this condition.
A slot (20% walking in grass) and any appropriate world conditions (no swarm) are thus enough to define a
specific encounter.
Well, okay, almost: each slot actually appears twice.
Table name: encounters
Primary key: id.
Has id.
Columns:
Encounter.version (version_id Version.id)
The ID of the version this applies to
Encounter.location_area (location_area_id LocationArea.id)

30

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

The ID of the location of this encounter


Encounter.encounter_slot_id ( EncounterSlot.id):
The ID of the encounter slot, which determines method and rarity
Encounter.pokemon (pokemon_id Pokemon.id)
The ID of the encountered Pokmon
Encounter.min_level (int):
The minimum level of the encountered Pokmon
Encounter.max_level (int):
The maxmum level of the encountered Pokmon
Relationships:
Encounter.condition_values ( [EncounterConditionValue])
Association table: encounter_condition_value_map
Encounter.slot ( EncounterSlot)
EncounterCondition
pokedex.db.tables.EncounterCondition
A conditions in the game world that affects Pokmon encounters, such as time of day.
Table name: encounter_conditions (single: encounter_condition)
Primary key: id.
Has id, identifier, and name via encounter_condition_prose.
Relationships:
EncounterCondition.values ( [EncounterConditionValue])
EncounterConditionValue
pokedex.db.tables.EncounterConditionValue
A possible state for a condition; for example, the state of swarm could be swarm or no swarm.
Table name: encounter_condition_values (single: encounter_condition_value)
Primary key: id.
Has id, identifier, and name via encounter_condition_value_prose.
Columns:
EncounterConditionValue.encounter_condition_id ( EncounterCondition.id):
The ID of the encounter condition this is a value of
EncounterConditionValue.is_default (bool):
Set if this value is the default state for the condition
Relationships:
EncounterConditionValue.condition ( EncounterCondition)

3.1. The pokdex tables

31

Pokedex Documentation, Release 0.1

EncounterMethod
pokedex.db.tables.EncounterMethod
A way the player can enter a wild encounter, e.g., surfing, fishing, or walking through tall grass.
Table name: encounter_methods (single: encounter_method)
Primary key: id.
Has id, identifier, and name via encounter_method_prose.
Columns:
EncounterMethod.order (int):
A good column for sorting on
Relationships:
EncounterMethod.slots ( [EncounterSlot])
EncounterSlot
pokedex.db.tables.EncounterSlot
An abstract slot within a method, associated with both some set of conditions and a rarity.
Note that there are two encounters per slot, so the rarities will only add up to 50.
Table name: encounter_slots
Primary key: id.
Has id.
Columns:
EncounterSlot.version_group (version_group_id VersionGroup.id)
The ID of the version group this slot is in
EncounterSlot.encounter_method_id ( EncounterMethod.id):
The ID of the method
EncounterSlot.slot (int):
This slots order for the location and method
EncounterSlot.rarity (int):
The chance of the encounter as a percentage
Relationships:
EncounterSlot.encounters ( [Encounter])
EncounterSlot.method ( EncounterMethod)

3.1.9 Contests
ContestCombo
pokedex.db.tables.ContestCombo
Combo of two moves in a Contest.

32

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Table name: contest_combos


Primary key: first_move_id, second_move_id.
Columns:
ContestCombo.first_move_id ( Move.id):
The ID of the first move in the combo
ContestCombo.second_move_id ( Move.id):
The ID of the second and final move in the combo
Relationships:
ContestCombo.first ( Move)
ContestCombo.second ( Move)
ContestEffect
pokedex.db.tables.ContestEffect
Effect of a move when used in a Contest.
Table name: contest_effects (single: contest_effect)
Primary key: id.
Has id.
Columns:
ContestEffect.appeal (int):
The base number of hearts the user of this move gets
ContestEffect.jam (int):
The base number of hearts the users opponent loses
Internationalized strings:
ContestEffect.flavor_text (unicode gametext) via contest_effect_prose
The in-game description of this effect
ContestEffect.effect (unicode plaintext) via contest_effect_prose
A detailed description of the effect
Relationships:
ContestEffect.moves ( [Move])
SuperContestCombo
pokedex.db.tables.SuperContestCombo
Combo of two moves in a Super Contest.
Table name: super_contest_combos
Primary key: first_move_id, second_move_id.
Columns:
SuperContestCombo.first_move_id ( Move.id):
3.1. The pokdex tables

33

Pokedex Documentation, Release 0.1

The ID of the first move in the combo.


SuperContestCombo.second_move_id ( Move.id):
The ID of the second and last move.
Relationships:
SuperContestCombo.first ( Move)
SuperContestCombo.second ( Move)
SuperContestEffect
pokedex.db.tables.SuperContestEffect
An effect a move can have when used in the Super Contest
Table name: super_contest_effects (single: super_contest_effect)
Primary key: id.
Has id.
Columns:
SuperContestEffect.appeal (int):
The number of hearts the user gains.
Internationalized strings:
SuperContestEffect.flavor_text (unicode plaintext) via super_contest_effect_prose
A description of the effect.
Relationships:
SuperContestEffect.moves ( [Move])

3.1.10 Enum tables


BerryFirmness
pokedex.db.tables.BerryFirmness
A Berry firmness, such as hard or very soft.
Table name: berry_firmness (single: berry_firmness)
Primary key: id.
Has id, identifier, and name via berry_firmness_names.
Relationships:
BerryFirmness.berries ( [Berry])
ContestType
pokedex.db.tables.ContestType
A Contest type, such as cool or smart, and their associated Berry flavors and Pokblock colors.
Table name: contest_types (single: contest_type)

34

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Primary key: id.


Has id, identifier, and name via contest_type_names.
Internationalized strings:
ContestType.flavor (unicode plaintext) via contest_type_names
The name of the corresponding Berry flavor
ContestType.color (unicode plaintext) via contest_type_names
The name of the corresponding Pokblock color
Relationships:
ContestType.hating_natures ( [Nature])
ContestType.liking_natures ( [Nature])
ContestType.moves ( [Move])
EggGroup
pokedex.db.tables.EggGroup
An Egg group. Usually, two Pokmon can breed if they share an Egg Group.
(exceptions are the Ditto and No Eggs groups)
Table name: egg_groups (single: egg_group)
Primary key: id.
Has id, identifier, and name via egg_group_prose.
Relationships:
EggGroup.species ( [PokemonSpecies])
Association table: pokemon_egg_groups
Ordered by: pokemon_species."order" ASC
EvolutionTrigger
pokedex.db.tables.EvolutionTrigger
An evolution type, such as level or trade.
Table name: evolution_triggers (single: evolution_trigger)
Primary key: id.
Has id, identifier, and name via evolution_trigger_prose.
Relationships:
EvolutionTrigger.evolutions ( [PokemonEvolution])

3.1. The pokdex tables

35

Pokedex Documentation, Release 0.1

Gender
pokedex.db.tables.Gender
A gender.
Table name: genders (single: gender)
Primary key: id.
Has id and identifier.
Relationships:
Gender.conquest_evolutions ( [ConquestPokemonEvolution])
Gender.required_for_evolutions ( [PokemonEvolution])
GrowthRate
pokedex.db.tables.GrowthRate
Growth rate of a Pokmon, i.e. the EXP level function.
Table name: growth_rates (single: growth_rate)
Primary key: id.
Has id, identifier, and name via growth_rate_prose.
Columns:
GrowthRate.formula (unicode latex):
The formula
Relationships:
GrowthRate.evolution_chains ( [PokemonSpecies])
GrowthRate.experience_table ( [Experience])
GrowthRate.max_experience_obj ( Experience)
Association Proxies:
GrowthRate.max_experience: experience of self.max_experience_obj
ItemCategory
pokedex.db.tables.ItemCategory
An item category
Table name: item_categories (single: item_category)
Primary key: id.
Has id, identifier, and name via item_category_prose.
Columns:
ItemCategory.pocket (pocket_id ItemPocket.id)
ID of the pocket these items go to

36

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Relationships:
ItemCategory.items ( [Item])
Ordered by: items.identifier ASC
ItemFlingEffect
pokedex.db.tables.ItemFlingEffect
An effect of the move Fling when used with a specific item
Table name: item_fling_effects (single: item_fling_effect)
Primary key: id.
Has id.
Internationalized strings:
ItemFlingEffect.effect (unicode plaintext) via item_fling_effect_prose
Description of the effect
Relationships:
ItemFlingEffect.items ( [Item])
ItemPocket
pokedex.db.tables.ItemPocket
A pocket that categorizes items
Table name: item_pockets (single: item_pocket)
Primary key: id.
Has id, identifier, and name via item_pocket_names.
Relationships:
ItemPocket.categories ( [ItemCategory])
Ordered by: item_categories.identifier ASC
MoveBattleStyle
pokedex.db.tables.MoveBattleStyle
A battle style of a move
Table name: move_battle_styles (single: move_battle_style)
Primary key: id.
Has id, identifier, and name via move_battle_style_prose.
Relationships:
MoveBattleStyle.nature_preferences ( [NatureBattleStylePreference])

3.1. The pokdex tables

37

Pokedex Documentation, Release 0.1

MoveDamageClass
pokedex.db.tables.MoveDamageClass
Any of the damage classes moves can have, i.e. physical, special, or non-damaging.
Table name: move_damage_classes (single: move_damage_class)
Primary key: id.
Has id, identifier, and name via move_damage_class_prose.
Internationalized strings:
MoveDamageClass.description (unicode plaintext) via move_damage_class_prose
A description of the class
Relationships:
MoveDamageClass.moves ( [Move])
MoveDamageClass.stats ( [Stat])
MoveDamageClass.types ( [Type])
MoveMetaAilment
pokedex.db.tables.MoveMetaAilment
Common status ailments moves can inflict on a single Pokmon, including major ailments like paralysis and
minor ailments like trapping.
Table name: move_meta_ailments (single: move_meta_ailment)
Primary key: id.
Has id, identifier, and name via move_meta_ailment_names.
Relationships:
MoveMetaAilment.move_meta ( [MoveMeta])
MoveMetaCategory
pokedex.db.tables.MoveMetaCategory
Very general categories that loosely group move effects.
Table name: move_meta_categories (single: move_meta_category)
Primary key: id.
Has id and identifier.
Internationalized strings:
MoveMetaCategory.description (unicode plaintext) via move_meta_category_prose
A description of the category
Relationships:
MoveMetaCategory.move_meta ( [MoveMeta])

38

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

MoveTarget
pokedex.db.tables.MoveTarget
Targetting or range of a move, e.g. Affects all opponents or Affects user.
Table name: move_targets (single: move_target)
Primary key: id.
Has id, identifier, and name via move_target_prose.
Internationalized strings:
MoveTarget.description (unicode plaintext) via move_target_prose
A description
Relationships:
MoveTarget.moves ( [Move])
Nature
pokedex.db.tables.Nature
A nature a Pokmon can have, such as Calm or Brave
Table name: natures (single: nature)
Primary key: id.
Has id, identifier, and name via nature_names.
Columns:
Nature.decreased_stat (decreased_stat_id Stat.id)
ID of the stat that this nature decreases by 10% (if decreased_stat_id is the same, the effects cancel
out)
Nature.increased_stat (increased_stat_id Stat.id)
ID of the stat that this nature increases by 10% (if decreased_stat_id is the same, the effects cancel
out)
Nature.hates_flavor (hates_flavor_id ContestType.id)
ID of the Berry flavor the Pokmon hates (if likes_flavor_id is the same, the effects cancel out)
Nature.likes_flavor (likes_flavor_id ContestType.id)
ID of the Berry flavor the Pokmon likes (if hates_flavor_id is the same, the effects cancel out)
Nature.game_index (int):
This natures internal order in the games (starting from 1, not 0).
Relationships:
Nature.battle_style_preferences ( [NatureBattleStylePreference])
Ordered by: nature_battle_style_preferences.move_battle_style_id ASC
Nature.pokeathlon_effects ( [NaturePokeathlonStat])
Ordered by: nature_pokeathlon_stats.pokeathlon_stat_id ASC

3.1. The pokdex tables

39

Pokedex Documentation, Release 0.1

is_neutral
Returns True iff this nature doesnt alter a Pokmons stats, bestow taste preferences, etc.
PalParkArea
pokedex.db.tables.PalParkArea
A distinct area of Pal Park in which Pokmon appear.
Table name: pal_park_areas (single: pal_park_area)
Primary key: id.
Has id, identifier, and name via pal_park_area_names.
PokemonColor
pokedex.db.tables.PokemonColor
The Pokdex color of a Pokmon species. Usually based on the Pokmons color.
Table name: pokemon_colors (single: pokemon_color)
Primary key: id.
Has id, identifier, and name via pokemon_color_names.
Relationships:
PokemonColor.species ( [PokemonSpecies])
PokemonMoveMethod
pokedex.db.tables.PokemonMoveMethod
A method a move can be learned by, such as Level up or Tutor.
Table name: pokemon_move_methods (single: pokemon_move_method)
Primary key: id.
Has id, identifier, and name via pokemon_move_method_prose.
Internationalized strings:
PokemonMoveMethod.description (unicode plaintext) via pokemon_move_method_prose
A detailed description of how the method works
Relationships:
PokemonMoveMethod.version_group_move_methods ( [VersionGroupPokemonMoveMethod])
PokemonMoveMethod.version_groups ( [VersionGroup])
Association table: version_group_pokemon_move_methods
PokemonShape
pokedex.db.tables.PokemonShape
The shape of a Pokmons body. Used for flavor in generation IV and V Pokdexes.
Table name: pokemon_shapes (single: pokemon_shape)

40

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Primary key: id.


Has id, identifier, and name via pokemon_shape_prose.
Internationalized strings:
PokemonShape.awesome_name (unicode plaintext) via pokemon_shape_prose
A splendiferous name of the body shape
Relationships:
PokemonShape.species ( [PokemonSpecies])
Stat
pokedex.db.tables.Stat
A Stat, such as Attack or Speed
Table name: stats (single: stat)
Primary key: id.
Has id, identifier, and name via stat_names.
Columns:
Stat.damage_class (damage_class_id MoveDamageClass.id)
For offensive and defensive stats, the damage this stat relates to; otherwise None (the NULL value)
Stat.is_battle_only (bool):
Whether this stat only exists within a battle
Stat.game_index (int):
The stat order the games use internally for the persistent stats. NULL for battle-only stats.
Relationships:
Stat.decreasing_natures ( [Nature])
Stat.hints ( [StatHint])
Stat.increasing_natures ( [Nature])
Stat.move_meta_stat_changes ( [MoveMetaStatChange])

3.1.11 Changelogs
AbilityChangelog
pokedex.db.tables.AbilityChangelog
History of changes to abilities across main game versions.
Table name: ability_changelog (single: ability_changelog)
Primary key: id.
Has id.
Columns:
AbilityChangelog.ability (ability_id Ability.id)

3.1. The pokdex tables

41

Pokedex Documentation, Release 0.1

The ID of the ability that changed


AbilityChangelog.changed_in_version_group_id ( VersionGroup.id):
The ID of the version group in which the ability changed
Internationalized strings:
AbilityChangelog.effect (unicode markdown) via ability_changelog_prose
A description of the old behavior
Relationships:
AbilityChangelog.changed_in ( VersionGroup)
MoveEffectChangelog
pokedex.db.tables.MoveEffectChangelog
History of changes to move effects across main game versions.
Table name: move_effect_changelog (single: move_effect_changelog)
Primary key: id.
Has id.
Columns:
MoveEffectChangelog.effect (effect_id MoveEffect.id)
The ID of the effect that changed
MoveEffectChangelog.changed_in_version_group_id ( VersionGroup.id):
The ID of the version group in which the effect changed
Internationalized strings:
MoveEffectChangelog.effect (unicode markdown) via move_effect_changelog_prose
A description of the old behavior
Relationships:
MoveEffectChangelog.changed_in ( VersionGroup)
MoveEffectChangelog.move_effect ( MoveEffect)
MoveChangelog
pokedex.db.tables.MoveChangelog
History of changes to moves across main game versions.
Table name: move_changelog (single: move_changelog)
Primary key: move_id, changed_in_version_group_id.
Columns:
MoveChangelog.move (move_id Move.id)
ID of the move that changed
MoveChangelog.changed_in_version_group_id ( VersionGroup.id):

42

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

ID of the version group in which the move changed


MoveChangelog.type (type_id Type.id)
Prior type of the move, or NULL if unchanged
MoveChangelog.power (int):
Prior base power of the move, or NULL if unchanged
MoveChangelog.pp (int):
Prior base PP of the move, or NULL if unchanged
MoveChangelog.accuracy (int):
Prior accuracy of the move, or NULL if unchanged
MoveChangelog.effect (effect_id MoveEffect.id)
Prior ID of the effect, or NULL if unchanged
MoveChangelog.effect_chance (int):
Prior effect chance, or NULL if unchanged
Relationships:
MoveChangelog.changed_in ( VersionGroup)
MoveChangelog.move_effect ( MoveEffect)
Undocumented:
MoveChangelog.effect_map
MoveChangelog.short_effect
MoveChangelog.short_effect_map

3.1.12 Flavor text


ItemFlavorText
pokedex.db.tables.ItemFlavorText
An in-game description of an item
Table name: item_flavor_text (single: item_flavor_text)
Primary key: item_id, version_group_id, language_id.
Columns:
ItemFlavorText.item (item_id Item.id)
The ID of the item
ItemFlavorText.version_group (version_group_id VersionGroup.id)
ID of the version group that sports this text
ItemFlavorText.language (language_id Language.id)
The language
ItemFlavorText.flavor_text (unicode gametext):
The flavor text itself
3.1. The pokdex tables

43

Pokedex Documentation, Release 0.1

AbilityFlavorText
pokedex.db.tables.AbilityFlavorText
In-game flavor text of an ability
Table name: ability_flavor_text
Primary key: ability_id, version_group_id, language_id.
Columns:
AbilityFlavorText.ability (ability_id Ability.id)
The ID of the ability
AbilityFlavorText.version_group (version_group_id VersionGroup.id)
The ID of the version group this flavor text is taken from
AbilityFlavorText.language (language_id Language.id)
The language
AbilityFlavorText.flavor_text (unicode gametext):
The actual flavor text
MoveFlavorText
pokedex.db.tables.MoveFlavorText
In-game description of a move
Table name: move_flavor_text
Primary key: move_id, version_group_id, language_id.
Columns:
MoveFlavorText.move (move_id Move.id)
ID of the move
MoveFlavorText.version_group (version_group_id VersionGroup.id)
ID of the version group this text appears in
MoveFlavorText.language (language_id Language.id)
The language
MoveFlavorText.flavor_text (unicode gametext):
The flavor text
PokemonSpeciesFlavorText
pokedex.db.tables.PokemonSpeciesFlavorText
In-game Pokdex descrption of a Pokmon.
Table name: pokemon_species_flavor_text
Primary key: species_id, version_id, language_id.
Columns:
PokemonSpeciesFlavorText.species (species_id PokemonSpecies.id)
44

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

ID of the Pokmon
PokemonSpeciesFlavorText.version (version_id Version.id)
ID of the version that has this flavor text
PokemonSpeciesFlavorText.language (language_id Language.id)
The language
PokemonSpeciesFlavorText.flavor_text (unicode gametext):
The flavor text

3.1.13 Association tables


BerryFlavor
pokedex.db.tables.BerryFlavor
A Berry flavor level.
Table name: berry_flavors
Primary key: berry_id, contest_type_id.
Columns:
BerryFlavor.berry (berry_id Berry.id)
The ID of the berry
BerryFlavor.contest_type (contest_type_id ContestType.id)
The ID of the flavor
BerryFlavor.flavor (int):
The level of the flavor in the berry
EncounterConditionValueMap
pokedex.db.tables.EncounterConditionValueMap
Maps encounters to the specific conditions under which they occur.
Table name: encounter_condition_value_map
Primary key: encounter_id, encounter_condition_value_id.
Columns:
EncounterConditionValueMap.encounter_id ( Encounter.id):
The ID of the encounter
EncounterConditionValueMap.encounter_condition_value_id ( EncounterConditionValue.id):
The ID of the encounter condition value

3.1. The pokdex tables

45

Pokedex Documentation, Release 0.1

ItemFlag
pokedex.db.tables.ItemFlag
An item attribute such as consumable or holdable.
Table name: item_flags (single: item_flag)
Primary key: id.
Has id, identifier, and name via item_flag_prose.
Internationalized strings:
ItemFlag.description (unicode plaintext) via item_flag_prose
Short description of the flag
ItemFlagMap
pokedex.db.tables.ItemFlagMap
Maps an item flag to its item.
Table name: item_flag_map
Primary key: item_id, item_flag_id.
Columns:
ItemFlagMap.item_id ( Item.id):
The ID of the item
ItemFlagMap.item_flag_id ( ItemFlag.id):
The ID of the item flag
Machine
pokedex.db.tables.Machine
A TM or HM; numbered item that can teach a move to a Pokmon
Table name: machines
Primary key: machine_number, version_group_id.
Columns:
Machine.machine_number (int):
Number of the machine for TMs, or 100 + the number for HMs
Machine.version_group (version_group_id VersionGroup.id)
Versions this entry applies to
Machine.item (item_id Item.id)
ID of the corresponding Item
Machine.move (move_id Move.id)
ID of the taught move

46

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Relationships:
Machine.pokemon_moves ( PokemonMove)
is_hm
True if this machine is a HM, False if its a TM
MoveFlag
pokedex.db.tables.MoveFlag
A Move attribute such as snatchable or contact.
Table name: move_flags (single: move_flag)
Primary key: id.
Has id, identifier, and name via move_flag_prose.
Internationalized strings:
MoveFlag.description (unicode markdown) via move_flag_prose
A short description of the flag
MoveFlagMap
pokedex.db.tables.MoveFlagMap
Maps a move flag to a move
Table name: move_flag_map
Primary key: move_id, move_flag_id.
Columns:
MoveFlagMap.move (move_id Move.id)
ID of the move
MoveFlagMap.move_flag_id ( MoveFlag.id):
ID of the flag
Relationships:
MoveFlagMap.flag ( MoveFlag)
MoveMetaStatChange
pokedex.db.tables.MoveMetaStatChange
Stat changes moves (may) make.
Table name: move_meta_stat_changes
Primary key: move_id, stat_id.
Columns:
MoveMetaStatChange.move_id ( Move.id):
ID of the move
MoveMetaStatChange.stat (stat_id Stat.id)

3.1. The pokdex tables

47

Pokedex Documentation, Release 0.1

ID of the stat
MoveMetaStatChange.change (int):
Amount of increase/decrease, in stages
NatureBattleStylePreference
pokedex.db.tables.NatureBattleStylePreference
Battle Palace move preference
Specifies how likely a Pokmon with a specific Nature is to use a move of a particular battl style in Battle Palace
or Battle Tent
Table name: nature_battle_style_preferences
Primary key: nature_id, move_battle_style_id.
Columns:
NatureBattleStylePreference.nature (nature_id Nature.id)
ID of the Pokmons nature
NatureBattleStylePreference.move_battle_style_id ( MoveBattleStyle.id):
ID of the battle style
NatureBattleStylePreference.low_hp_preference (int):
Chance of using the move, in percent, if HP is under
NatureBattleStylePreference.high_hp_preference (int):
Chance of using the move, in percent, if HP is over
Relationships:
NatureBattleStylePreference.battle_style ( MoveBattleStyle)
NaturePokeathlonStat
pokedex.db.tables.NaturePokeathlonStat
Specifies how a Nature affects a Pokathlon stat
Table name: nature_pokeathlon_stats
Primary key: nature_id, pokeathlon_stat_id.
Columns:
NaturePokeathlonStat.nature_id ( Nature.id):
ID of the nature
NaturePokeathlonStat.pokeathlon_stat (pokeathlon_stat_id PokeathlonStat.id)
ID of the stat
NaturePokeathlonStat.max_change (int):
Maximum change

48

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

PokeathlonStat
pokedex.db.tables.PokeathlonStat
A Pokathlon stat, such as Stamina or Jump.
Table name: pokeathlon_stats (single: pokeathlon_stat)
Primary key: id.
Has id, identifier, and name via pokeathlon_stat_names.
Relationships:
PokeathlonStat.nature_effects ( [NaturePokeathlonStat])
PokedexVersionGroup
pokedex.db.tables.PokedexVersionGroup
A mapping from Pokdexes to version groups in which they appear as the regional dex.
Table name: pokedex_version_groups (single: pokedex_version_group)
Primary key: pokedex_id, version_group_id.
Columns:
PokedexVersionGroup.pokedex_id ( Pokedex.id):
The ID of the Pokdex.
PokedexVersionGroup.version_group_id ( VersionGroup.id):
The ID of the version group.
PokemonAbility
pokedex.db.tables.PokemonAbility
Maps an ability to a Pokmon that can have it
Table name: pokemon_abilities
Primary key: pokemon_id, slot.
Columns:
PokemonAbility.pokemon (pokemon_id Pokemon.id)
ID of the Pokmon
PokemonAbility.ability (ability_id Ability.id)
ID of the ability
PokemonAbility.is_hidden (bool):
Whether this is a hidden ability
PokemonAbility.slot (int):
The ability slot, i.e. 1 or 2 for gen. IV

3.1. The pokdex tables

49

Pokedex Documentation, Release 0.1

PokemonEggGroup
pokedex.db.tables.PokemonEggGroup
Maps an Egg group to a species; each species belongs to one or two egg groups
Table name: pokemon_egg_groups
Primary key: species_id, egg_group_id.
Columns:
PokemonEggGroup.species_id ( PokemonSpecies.id):
ID of the species
PokemonEggGroup.egg_group_id ( EggGroup.id):
ID of the egg group
PokemonFormPokeathlonStat
pokedex.db.tables.PokemonFormPokeathlonStat
A Pokmon forms performance in one Pokathlon stat.
Table name: pokemon_form_pokeathlon_stats
Primary key: pokemon_form_id, pokeathlon_stat_id.
Columns:
PokemonFormPokeathlonStat.pokemon_form (pokemon_form_id PokemonForm.id)
The ID of the Pokmon form.
PokemonFormPokeathlonStat.pokeathlon_stat (pokeathlon_stat_id PokeathlonStat.id)
The ID of the Pokathlon stat.
PokemonFormPokeathlonStat.minimum_stat (int):
The minimum value for this stat for this Pokmon form.
PokemonFormPokeathlonStat.base_stat (int):
The default value for this stat for this Pokmon form.
PokemonFormPokeathlonStat.maximum_stat (int):
The maximum value for this stat for this Pokmon form.
PokemonHabitat
pokedex.db.tables.PokemonHabitat
The habitat of a Pokmon, as given in the FireRed/LeafGreen version Pokdex
Table name: pokemon_habitats (single: pokemon_habitat)
Primary key: id.
Has id, identifier, and name via pokemon_habitat_names.
Relationships:
PokemonHabitat.species ( [PokemonSpecies])

50

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

PokemonMove
pokedex.db.tables.PokemonMove
Record of a move a Pokmon can learn
Table name: pokemon_moves
Primary key: pokemon_id, version_group_id, move_id, pokemon_move_method_id, level.
Columns:
PokemonMove.pokemon (pokemon_id Pokemon.id)
ID of the Pokmon
PokemonMove.version_group (version_group_id VersionGroup.id)
ID of the version group this applies to
PokemonMove.move (move_id Move.id)
ID of the move
PokemonMove.pokemon_move_method_id ( PokemonMoveMethod.id):
ID of the method this move is learned by
PokemonMove.level (int):
Level the move is learned at, if applicable
PokemonMove.order (int):
A sort key to produce the correct ordering when all else is equal
Relationships:
PokemonMove.machine ( Machine)
PokemonMove.method ( PokemonMoveMethod)
PokemonStat
pokedex.db.tables.PokemonStat
A stat value of a Pokmon
Table name: pokemon_stats
Primary key: pokemon_id, stat_id.
Columns:
PokemonStat.pokemon (pokemon_id Pokemon.id)
ID of the Pokmon
PokemonStat.stat (stat_id Stat.id)
ID of the stat
PokemonStat.base_stat (int):
The base stat
PokemonStat.effort (int):
The effort increase in this stat gained when this Pokmon is defeated

3.1. The pokdex tables

51

Pokedex Documentation, Release 0.1

PokemonItem
pokedex.db.tables.PokemonItem
Record of an item a Pokmon can hold in the wild
Table name: pokemon_items
Primary key: pokemon_id, version_id, item_id.
Columns:
PokemonItem.pokemon (pokemon_id Pokemon.id)
ID of the Pokmon
PokemonItem.version (version_id Version.id)
ID of the version this applies to
PokemonItem.item (item_id Item.id)
ID of the item
PokemonItem.rarity (int):
Chance of the Pokmon holding the item, in percent
PokemonType
pokedex.db.tables.PokemonType
Maps a type to a Pokmon. Each Pokmon has 1 or 2 types.
Table name: pokemon_types
Primary key: pokemon_id, slot.
Columns:
PokemonType.pokemon_id ( Pokemon.id):
ID of the Pokmon
PokemonType.type_id ( Type.id):
ID of the type
PokemonType.slot (int):
The types slot, 1 or 2, used to sort types if there are two of them
TypeEfficacy
pokedex.db.tables.TypeEfficacy
The damage multiplier used when a move of a particular type damages a Pokmon of a particular other type.
Table name: type_efficacy
Primary key: damage_type_id, target_type_id.
Columns:
TypeEfficacy.damage_type (damage_type_id Type.id)
The ID of the damaging type.

52

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

TypeEfficacy.target_type (target_type_id Type.id)


The ID of the defending Pokmons type.
TypeEfficacy.damage_factor (int):
The multiplier, as a percentage of damage inflicted.
VersionGroupPokemonMoveMethod
pokedex.db.tables.VersionGroupPokemonMoveMethod
Maps a version group to a move learn methods it supports.
Supporting means simply that the method appears in the game. For example, Breeding didnt exist in Gen.I,
so its not in this table.
Table name: version_group_pokemon_move_methods
Primary key: version_group_id, pokemon_move_method_id.
Columns:
VersionGroupPokemonMoveMethod.version_group (version_group_id VersionGroup.id)
The ID of the version group.
VersionGroupPokemonMoveMethod.pokemon_move_method
PokemonMoveMethod.id)

(pokemon_move_method_id

The ID of the move method.


VersionGroupRegion
pokedex.db.tables.VersionGroupRegion
Maps a version group to a region that appears in it.
Table name: version_group_regions
Primary key: version_group_id, region_id.
Columns:
VersionGroupRegion.version_group (version_group_id VersionGroup.id)
The ID of the version group.
VersionGroupRegion.region (region_id Region.id)
The ID of the region.

3.1.14 Index maps


ItemGameIndex
pokedex.db.tables.ItemGameIndex
The internal ID number a game uses for an item
Table name: item_game_indices
Primary key: item_id, generation_id.
Columns:

3.1. The pokdex tables

53

Pokedex Documentation, Release 0.1

ItemGameIndex.item (item_id Item.id)


The database ID of the item
ItemGameIndex.generation (generation_id Generation.id)
ID of the generation of games
ItemGameIndex.game_index (int):
Internal ID of the item in the generation
LocationGameIndex
pokedex.db.tables.LocationGameIndex
IDs the games use internally for locations
Table name: location_game_indices
Primary key: location_id, generation_id, game_index.
Columns:
LocationGameIndex.location (location_id Location.id)
Database ID of the locaion
LocationGameIndex.generation (generation_id Generation.id)
ID of the generation this entry to
LocationGameIndex.game_index (int):
Internal game ID of the location
PokemonDexNumber
pokedex.db.tables.PokemonDexNumber
The number of a species in a particular Pokdex (e.g. Jigglypuff is #138 in Hoenns dex)
Table name: pokemon_dex_numbers
Primary key: species_id, pokedex_id.
Columns:
PokemonDexNumber.species (species_id PokemonSpecies.id)
ID of the species
PokemonDexNumber.pokedex (pokedex_id Pokedex.id)
ID of the Pokdex
PokemonDexNumber.pokedex_number (int):
Number of the Pokmon in that the Pokdex

54

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

PokemonFormGeneration
pokedex.db.tables.PokemonFormGeneration
Links Pokmon forms to the generations they exist in
Table name: pokemon_form_generations
Primary key: pokemon_form_id, generation_id.
Columns:
PokemonFormGeneration.pokemon_form_id ( PokemonForm.id):
The ID of the Pokmon form.
PokemonFormGeneration.generation (generation_id Generation.id)
The ID of the generation.
PokemonFormGeneration.game_index (int):
The internal ID the games use for this form.
Relationships:
PokemonFormGeneration.form ( PokemonForm)
PokemonGameIndex
pokedex.db.tables.PokemonGameIndex
The number of a Pokmon a game uses internally
Table name: pokemon_game_indices
Primary key: pokemon_id, version_id.
Columns:
PokemonGameIndex.pokemon_id ( Pokemon.id):
Database ID of the Pokmon
PokemonGameIndex.version_id ( Version.id):
Database ID of the version
PokemonGameIndex.game_index (int):
Internal ID the versions games use for the Pokmon

3.1.15 Mics tables


Experience
pokedex.db.tables.Experience
EXP needed for a certain level with a certain growth rate
Table name: experience
Primary key: growth_rate_id, level.
Columns:
Experience.growth_rate (growth_rate_id GrowthRate.id)

3.1. The pokdex tables

55

Pokedex Documentation, Release 0.1

ID of the growth rate


Experience.level (int):
The level
Experience.experience (int):
The number of EXP points needed to get to that level
PalPark
pokedex.db.tables.PalPark
Data for the Pal Park mini-game in Generation IV
Table name: pal_park (single: pal_park)
Primary key: species_id.
Columns:
PalPark.species (species_id PokemonSpecies.id)
The Pokmon species this data pertains to
PalPark.area (area_id PalParkArea.id)
The area in which this Pokmon is found
PalPark.base_score (int):
Used in calculating the players score at the end of a Pal Park run
PalPark.rate (int):
Base rate for encountering this Pokmon
StatHint
pokedex.db.tables.StatHint
Flavor text for genes that appears in a Pokmons summary. Sometimes called characteristics.
Table name: stat_hints (single: stat_hint)
Primary key: id.
Has id.
Columns:
StatHint.stat (stat_id Stat.id)
ID of the highest stat
StatHint.gene_mod_5 (int):
Value of the highest stat modulo 5
Internationalized strings:
StatHint.message (unicode plaintext) via stat_hint_names
The text displayed

56

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

3.1.16 Conquest tables


ConquestEpisode
pokedex.db.tables.ConquestEpisode
An episode from Pokmon Conquest: one of a bunch of mini-stories featuring a particular warrior.
The main story, The Legend of Ransei, also counts, even though its not in the episode select menu and theres
no way to replay it.
Table name: conquest_episodes (single: episode)
Primary key: id.
Has id, identifier, and name via conquest_episode_names.
Relationships:
ConquestEpisode.warriors ( [ConquestWarrior])
Association table: conquest_episode_warriors
ConquestEpisodeWarrior
pokedex.db.tables.ConquestEpisodeWarrior
A warrior featured in an episode in Pokmon Conquest.
This needs its own table because of the player having two episodes and there being two players.
Table name: conquest_episode_warriors
Primary key: episode_id, warrior_id.
Columns:
ConquestEpisodeWarrior.episode_id ( ConquestEpisode.id):
The ID of the episode.
ConquestEpisodeWarrior.warrior_id ( ConquestWarrior.id):
The ID of the warrior.
ConquestKingdom
pokedex.db.tables.ConquestKingdom
A kingdom in Pokmon Conquest.
Table name: conquest_kingdoms (single: kingdom)
Primary key: id.
Has id, identifier, and name via conquest_kingdom_names.
Columns:
ConquestKingdom.type (type_id Type.id)
The type associated with this kingdom in-game.
Relationships:
ConquestKingdom.evolutions ( [ConquestPokemonEvolution])

3.1. The pokdex tables

57

Pokedex Documentation, Release 0.1

ConquestMaxLink
pokedex.db.tables.ConquestMaxLink
The maximum link a warrior rank can reach with a Pokmon in Pokmon Conquest.
Table name: conquest_max_links
Primary key: warrior_rank_id, pokemon_species_id.
Columns:
ConquestMaxLink.warrior_rank (warrior_rank_id ConquestWarriorRank.id)
The ID of the warrior rank.
ConquestMaxLink.pokemon_species_id ( PokemonSpecies.id):
The ID of the Pokmon species.
ConquestMaxLink.max_link (int):
The maximum link percentage this warrior rank and Pokmon can reach.
Relationships:
ConquestMaxLink.pokemon ( PokemonSpecies)
Association Proxies:
ConquestMaxLink.warrior: warrior of self.warrior_rank
ConquestMoveData
pokedex.db.tables.ConquestMoveData
Data about a move in Pokmon Conquest.
Table name: conquest_move_data
Primary key: move_id.
Columns:
ConquestMoveData.move (move_id Move.id)
The ID of the move.
ConquestMoveData.power (int):
The moves power, null if it does no damage.
ConquestMoveData.accuracy (int):
The moves base accuracy, null if it is self-targetted or never misses.
ConquestMoveData.effect_chance (int):
The chance as a percentage that the moves secondary effect will trigger.
ConquestMoveData.effect (effect_id ConquestMoveEffect.id)
The ID of the moves effect.
ConquestMoveData.range (range_id ConquestMoveRange.id)
The ID of the moves range.
ConquestMoveData.displacement (displacement_id ConquestMoveDisplacement.id)

58

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

The ID of the moves displacement.


Relationships:
ConquestMoveData.move_displacement ( ConquestMoveDisplacement)
ConquestMoveData.move_effect ( ConquestMoveEffect)
Undocumented:
ConquestMoveData.effect_map
ConquestMoveData.short_effect
ConquestMoveData.short_effect_map
star_rating
Return the moves in-game power rating as a number of stars.
ConquestMoveDisplacement
pokedex.db.tables.ConquestMoveDisplacement
A way in which a move can cause the user or target to move to a different tile.
If a move displaces its user, the moves range is relative to the users original position.
Table name: conquest_move_displacements (single: move_displacement)
Primary key: id.
Has id, identifier, and name via conquest_move_displacement_prose.
Columns:
ConquestMoveDisplacement.affects_target (bool):
True iff the move displaces its target(s) and not its user.
Internationalized strings:
ConquestMoveDisplacement.short_effect (unicode markdown) via conquest_move_displacement_prose
A short summary of how the displacement works, to be used in the moves short effect.
ConquestMoveDisplacement.effect (unicode markdown) via conquest_move_displacement_prose
A detailed description of how the displacement works, to be used alongside the moves long effect.
Relationships:
ConquestMoveDisplacement.move_data ( [ConquestMoveData])
ConquestMoveEffect
pokedex.db.tables.ConquestMoveEffect
An effect moves can have in Pokmon Conquest.
Table name: conquest_move_effects (single: conquest_move_effect)
Primary key: id.
Has id.
Internationalized strings:
ConquestMoveEffect.short_effect (unicode markdown) via conquest_move_effect_prose

3.1. The pokdex tables

59

Pokedex Documentation, Release 0.1

A short summary of the effect


ConquestMoveEffect.effect (unicode markdown) via conquest_move_effect_prose
A detailed description of the effect
Relationships:
ConquestMoveEffect.move_data ( [ConquestMoveData])
ConquestMoveRange
pokedex.db.tables.ConquestMoveRange
A set of tiles moves can target in Pokmon Conquest.
Table name: conquest_move_ranges (single: conquest_move_range)
Primary key: id.
Has id, identifier, and name via conquest_move_range_prose.
Columns:
ConquestMoveRange.targets (int):
The number of tiles this range targets.
Internationalized strings:
ConquestMoveRange.description (unicode plaintext) via conquest_move_range_prose
A detailed description of the range
Relationships:
ConquestMoveRange.move_data ( [ConquestMoveData])
ConquestPokemonAbility
pokedex.db.tables.ConquestPokemonAbility
An ability a Pokmon species has in Pokmon Conquest.
Table name: conquest_pokemon_abilities
Primary key: pokemon_species_id, slot.
Columns:
ConquestPokemonAbility.pokemon_species_id ( PokemonSpecies.id):
The ID of the Pokmon species with this ability.
ConquestPokemonAbility.slot (int):
The order abilities are listed in. Upon evolution, if a Pokmons abilities change, it will receive the
one in the same slot.
ConquestPokemonAbility.ability_id ( Ability.id):
The ID of the ability.

60

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

ConquestPokemonEvolution
pokedex.db.tables.ConquestPokemonEvolution
The conditions under which a Pokmon must successfully complete an action to evolve in Pokmon Conquest.
Any condition may be null if it does not apply for a particular Pokmon.
Table name: conquest_pokemon_evolution
Primary key: evolved_species_id.
Columns:
ConquestPokemonEvolution.evolved_species (evolved_species_id PokemonSpecies.id)
The ID of the post-evolution species.
ConquestPokemonEvolution.required_stat_id ( ConquestStat.id):
The ID of the stat which minimum_stat applies to.
ConquestPokemonEvolution.minimum_stat (int):
The minimum value the Pokmon must have in a particular stat.
ConquestPokemonEvolution.minimum_link (int):
The minimum link percentage the Pokmon must have with its warrior.
ConquestPokemonEvolution.kingdom (kingdom_id ConquestKingdom.id)
The ID of the kingdom in which this Pokmon must complete an action after meeting all other
requirements.
ConquestPokemonEvolution.warrior_gender_id ( Gender.id):
The ID of the gender the Pokmons warrior must be.
ConquestPokemonEvolution.item (item_id Item.id)
The ID of the item the Pokmons warrior must have equipped.
ConquestPokemonEvolution.recruiting_ko_required (bool):
If true, the Pokmon must KO a Pokmon under the right conditions to recruit that Pokmons warrior.
Relationships:
ConquestPokemonEvolution.gender ( Gender)
ConquestPokemonEvolution.stat ( ConquestStat)
ConquestPokemonMove
pokedex.db.tables.ConquestPokemonMove
A Pokmons move in Pokmon Conquest.
Yes, move; each Pokmon has exactly one.
Table name: conquest_pokemon_moves
Primary key: pokemon_species_id.
Columns:
ConquestPokemonMove.pokemon_species_id ( PokemonSpecies.id):

3.1. The pokdex tables

61

Pokedex Documentation, Release 0.1

The ID of the Pokmon species.


ConquestPokemonMove.move_id ( Move.id):
The ID of the move.
ConquestPokemonStat
pokedex.db.tables.ConquestPokemonStat
A Pokmons base stat in Pokmon Conquest.
The main four base stats in Conquest are derived from level 100 stats in the main series (ignoring effort, genes,
and natures). Attack matches either Attack or Special Attack, and Defense matches the average of Defense and
Special Defense. HP and Speed are the same.
Table name: conquest_pokemon_stats
Primary key: pokemon_species_id, conquest_stat_id.
Columns:
ConquestPokemonStat.pokemon_species_id ( PokemonSpecies.id):
The ID of the Pokmon species.
ConquestPokemonStat.conquest_stat_id ( ConquestStat.id):
The ID of the stat.
ConquestPokemonStat.base_stat (int):
The base stat.
Relationships:
ConquestPokemonStat.pokemon ( PokemonSpecies)
ConquestPokemonStat.stat ( ConquestStat)
ConquestStat
pokedex.db.tables.ConquestStat
A stat Pokmon have in Pokmon Conquest.
Table name: conquest_stats (single: conquest_stat)
Primary key: id.
Has id, identifier, and name via conquest_stat_names.
Columns:
ConquestStat.is_base (bool):
True iff this is one of the main stats, calculated for individual Pokmon.
Relationships:
ConquestStat.evolutions ( [ConquestPokemonEvolution])
ConquestStat.pokemon_stats ( [ConquestPokemonStat])

62

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

ConquestTransformationPokemon
pokedex.db.tables.ConquestTransformationPokemon
A Pokmon that satisfies a warrior transformations link condition.
If a warrior has one or more Pokmon listed here, they only need to raise one of them to the required link.
Table name: conquest_transformation_pokemon
Primary key: transformation_id, pokemon_species_id.
Columns:

ConquestTransformationPokemon.transformation_id ( ConquestWarriorTransformation.transformed_warrior_rank_
The ID of the corresponding transformation, in turn a warrior rank ID.
ConquestTransformationPokemon.pokemon_species_id ( PokemonSpecies.id):
The ID of the Pokmon species.
ConquestTransformationWarrior
pokedex.db.tables.ConquestTransformationWarrior
A warrior who must be present in the same nation as another warrior for the latter to transform into their next
rank.
If a warrior has one or more other warriors listed here, they all need to gather in the same nation for the
transformation to take place.
Table name: conquest_transformation_warriors
Primary key: transformation_id, present_warrior_id.
Columns:

ConquestTransformationWarrior.transformation_id ( ConquestWarriorTransformation.transformed_warrior_rank_i
The ID of the corresponding transformation, in turn a warrior rank ID.
ConquestTransformationWarrior.present_warrior_id ( ConquestWarrior.id):
The ID of the other warrior who must be present.
ConquestWarrior
pokedex.db.tables.ConquestWarrior
A warrior in Pokmon Conquest.
Table name: conquest_warriors (single: warrior)
Primary key: id.
Has id, identifier, and name via conquest_warrior_names.
Columns:
ConquestWarrior.gender_id ( Gender.id):
The ID of the warriors gender.
ConquestWarrior.archetype (archetype_id ConquestWarriorArchetype.id)
The ID of this warriors archetype. Null for unique warriors.

3.1. The pokdex tables

63

Pokedex Documentation, Release 0.1

Relationships:
ConquestWarrior.episodes ( [ConquestEpisode])
Association table: conquest_episode_warriors
ConquestWarrior.ranks ( [ConquestWarriorRank])
Ordered by: conquest_warrior_ranks.rank
ConquestWarrior.types ( [Type])
Association table: conquest_warrior_specialties
Ordered by: conquest_warrior_specialties.slot
ConquestWarriorArchetype
pokedex.db.tables.ConquestWarriorArchetype
An archetype that generic warriors in Pokmon Conquest can have. All warriors of a particular archetype share
sprites and dialogue.
Some of these are unused as warriors because they exist only as NPCs. They should still be kept because we
have their sprites and may eventually get their dialogue.
Table name: conquest_warrior_archetypes (single: archetype)
Primary key: id.
Has id and identifier.
Relationships:
ConquestWarriorArchetype.warriors ( [ConquestWarrior])
ConquestWarriorRank
pokedex.db.tables.ConquestWarriorRank
A warrior at a particular rank in Pokmon Conquest.
These are used for whatever changes between ranks, much like Pokmon forms. Generic warriors who have
only one rank are also represented here, with a single row.
To clarify, each warriors ranks are individually called warrior ranks here; for example, Rank 2 Nobunaga
is an example of a warrior rank, not just Rank 2.
Table name: conquest_warrior_ranks (single: warrior_rank)
Primary key: id.
Has id.
Columns:
ConquestWarriorRank.warrior (warrior_id ConquestWarrior.id)
The ID of the warrior.
ConquestWarriorRank.rank (int):
The rank number.
ConquestWarriorRank.skill (skill_id ConquestWarriorSkill.id)
The ID of this warrior ranks warrior skill.

64

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

Relationships:
ConquestWarriorRank.max_links ( [ConquestMaxLink])
ConquestWarriorRank.stats ( [ConquestWarriorRankStatMap])
Ordered by: conquest_warrior_rank_stat_map.warrior_stat_id
ConquestWarriorRank.transformation ( ConquestWarriorTransformation)
ConquestWarriorRankStatMap
pokedex.db.tables.ConquestWarriorRankStatMap
Any of a warrior ranks warrior stats in Pokmon Conquest.
Table name: conquest_warrior_rank_stat_map
Primary key: warrior_rank_id, warrior_stat_id.
Columns:
ConquestWarriorRankStatMap.warrior_rank (warrior_rank_id ConquestWarriorRank.id)
The ID of the warrior rank.
ConquestWarriorRankStatMap.warrior_stat_id ( ConquestWarriorStat.id):
The ID of the warrior stat.
ConquestWarriorRankStatMap.base_stat (int):
The stat.
Relationships:
ConquestWarriorRankStatMap.stat ( ConquestWarriorStat)
ConquestWarriorSkill
pokedex.db.tables.ConquestWarriorSkill
A warrior skill in Pokmon Conquest.
Table name: conquest_warrior_skills (single: skill)
Primary key: id.
Has id, identifier, and name via conquest_warrior_skill_names.
Relationships:
ConquestWarriorSkill.warrior_ranks ( [ConquestWarriorRank])
Ordered by: conquest_warrior_ranks.id
ConquestWarriorSpecialty
pokedex.db.tables.ConquestWarriorSpecialty
A warriors specialty types in Pokmon Conquest.
These have no actual effect on gameplay; they just indicate which types of Pokmon each warrior generally has
strong maximum links with.
Table name: conquest_warrior_specialties

3.1. The pokdex tables

65

Pokedex Documentation, Release 0.1

Primary key: warrior_id, type_id, slot.


Columns:
ConquestWarriorSpecialty.warrior_id ( ConquestWarrior.id):
The ID of the warrior.
ConquestWarriorSpecialty.type_id ( Type.id):
The ID of the type.
ConquestWarriorSpecialty.slot (int):
The order in which the warriors types are listed.
ConquestWarriorStat
pokedex.db.tables.ConquestWarriorStat
A stat that warriors have in Pokmon Conquest.
Table name: conquest_warrior_stats (single: warrior_stat)
Primary key: id.
Has id, identifier, and name via conquest_warrior_stat_names.
Relationships:
ConquestWarriorStat.stat_map ( [ConquestWarriorRankStatMap])
ConquestWarriorTransformation
pokedex.db.tables.ConquestWarriorTransformation
The conditions under which a warrior must perform an action in order to transform to the next rank.
Or most of them, anyway. See also ConquestTransformationPokemon and ConquestTransformationWarrior.
Table name: conquest_warrior_transformation
Primary key: transformed_warrior_rank_id.
Columns:
ConquestWarriorTransformation.transformed_warrior_rank_id ( ConquestWarriorRank.id):
The ID of the post-transformation warrior rank.
ConquestWarriorTransformation.is_automatic (bool):
True iff the transformation happens automatically in the story with no further requirements.
ConquestWarriorTransformation.required_link (int):
The link percentage the warrior must reach with one of several specific Pokmon, if any.
ConquestWarriorTransformation.completed_episode (completed_episode_id ConquestEpisode.id)
The ID of the episode the player must have completed, if any.
ConquestWarriorTransformation.current_episode (current_episode_id ConquestEpisode.id)
The ID of the episode the player must currently be playing, if any.
ConquestWarriorTransformation.distant_warrior (distant_warrior_id ConquestWarrior.id)

66

Chapter 3. The database schema

Pokedex Documentation, Release 0.1

The ID of another warrior who must be in the army, but not in the same kingdom or in any adjacent
kingdom.
ConquestWarriorTransformation.female_warlord_count (int):
The number of female warlords who must be in the same nation.
ConquestWarriorTransformation.pokemon_count (int):
The number of Pokmon that must be registered in the gallery.
ConquestWarriorTransformation.collection_type_id ( Type.id):
The ID of a type all Pokmon of which must be registered in the gallery.
ConquestWarriorTransformation.warrior_count (int):
The number of warriors that must be registered in the gallery.
Relationships:
ConquestWarriorTransformation.pokemon ( [PokemonSpecies])
Association table: conquest_transformation_pokemon
Ordered by: pokemon_species.conquest_order
ConquestWarriorTransformation.present_warriors ( [ConquestWarrior])
Association table: conquest_transformation_warriors
Ordered by: conquest_warriors.id
ConquestWarriorTransformation.type ( Type)
ConquestWarriorTransformation.warrior_rank ( ConquestWarriorRank)

3.1. The pokdex tables

67

Pokedex Documentation, Release 0.1

68

Chapter 3. The database schema

CHAPTER 4

Indices and tables

genindex
search

69

Pokedex Documentation, Release 0.1

70

Chapter 4. Indices and tables

Python Module Index

p
pokedex.db.tables, 11

71

You might also like