mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Add properties for getting a Pokemon from a PokemonForm, and vice-versa.
This commit is contained in:
parent
29be17fb2a
commit
7e0cd75d29
1 changed files with 13 additions and 0 deletions
|
@ -847,6 +847,12 @@ class Pokemon(TableBase):
|
||||||
|
|
||||||
### Stuff to handle alternate Pokémon forms
|
### Stuff to handle alternate Pokémon forms
|
||||||
|
|
||||||
|
@property
|
||||||
|
def form(self):
|
||||||
|
u"""Returns the Pokémon's form, using its default form as fallback."""
|
||||||
|
|
||||||
|
return self.unique_form or self.default_form
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_base_form(self):
|
def is_base_form(self):
|
||||||
u"""Returns True iff the Pokémon is the base form for its species,
|
u"""Returns True iff the Pokémon is the base form for its species,
|
||||||
|
@ -1038,6 +1044,13 @@ class PokemonForm(TableBase):
|
||||||
order = Column(Integer, nullable=False, autoincrement=False,
|
order = Column(Integer, nullable=False, autoincrement=False,
|
||||||
info=dict(description=u'The order in which forms should be sorted. Multiple forms may have equal order, in which case they should fall back on sorting by name.'))
|
info=dict(description=u'The order in which forms should be sorted. Multiple forms may have equal order, in which case they should fall back on sorting by name.'))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pokemon(self):
|
||||||
|
u"""Returns the Pokémon for this form, using the form base as fallback.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return self.unique_pokemon or self.form_base_pokemon
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def full_name(self):
|
def full_name(self):
|
||||||
u"""Returns the full name of this form, e.g. "Plant Cloak"."""
|
u"""Returns the full name of this form, e.g. "Plant Cloak"."""
|
||||||
|
|
Loading…
Reference in a new issue