pokeapi/pokemon_v2/models.py

1901 lines
35 KiB
Python
Raw Normal View History

2014-12-04 11:11:46 +00:00
from django.db import models
#####################
# ABSTRACT MODELS #
#####################
2016-03-05 09:27:25 +00:00
2015-04-07 12:14:31 +00:00
class HasAbility(models.Model):
ability = models.ForeignKey(
"Ability",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2015-04-07 12:14:31 +00:00
2015-04-07 12:14:31 +00:00
class HasCharacteristic(models.Model):
2016-03-05 09:27:25 +00:00
characteristic = models.ForeignKey(
"Characteristic",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2015-04-07 12:14:31 +00:00
class HasContestType(models.Model):
2016-03-05 09:27:25 +00:00
contest_type = models.ForeignKey(
"ContestType",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasContestEffect(models.Model):
2016-03-05 09:27:25 +00:00
contest_effect = models.ForeignKey(
"ContestEffect",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasSuperContestEffect(models.Model):
2016-03-05 09:27:25 +00:00
super_contest_effect = models.ForeignKey(
"SuperContestEffect",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
2018-10-19 15:50:32 +00:00
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasDescription(models.Model):
description = models.CharField(max_length=1000, default="")
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasGender(models.Model):
2016-03-05 09:27:25 +00:00
gender = models.ForeignKey(
"Gender",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2015-04-07 12:14:31 +00:00
class HasEffect(models.Model):
2016-03-05 09:27:25 +00:00
effect = models.CharField(max_length=6000)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2015-04-07 12:14:31 +00:00
class HasEggGroup(models.Model):
2016-03-05 09:27:25 +00:00
egg_group = models.ForeignKey(
"EggGroup",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2015-04-07 12:14:31 +00:00
class HasEncounterMethod(models.Model):
2016-03-05 09:27:25 +00:00
encounter_method = models.ForeignKey(
"EncounterMethod",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasEncounterCondition(models.Model):
2016-03-05 09:27:25 +00:00
encounter_condition = models.ForeignKey(
"EncounterCondition",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasEvolutionTrigger(models.Model):
2016-03-05 09:27:25 +00:00
evolution_trigger = models.ForeignKey(
"EvolutionTrigger",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasFlavorText(models.Model):
2016-03-05 09:27:25 +00:00
flavor_text = models.CharField(max_length=500)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasFlingEffect(models.Model):
2016-03-05 09:27:25 +00:00
item_fling_effect = models.ForeignKey(
"ItemFlingEffect",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasGameIndex(models.Model):
2016-03-05 09:27:25 +00:00
game_index = models.IntegerField()
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2015-04-07 12:14:31 +00:00
class HasGeneration(models.Model):
generation = models.ForeignKey(
"Generation",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2015-04-07 12:14:31 +00:00
2015-04-07 12:14:31 +00:00
class HasGrowthRate(models.Model):
growth_rate = models.ForeignKey(
"GrowthRate",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2015-04-07 12:14:31 +00:00
class HasItem(models.Model):
item = models.ForeignKey(
"Item",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasItemAttribute(models.Model):
2016-03-05 09:27:25 +00:00
item_attribute = models.ForeignKey(
"ItemAttribute",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasItemCategory(models.Model):
2016-03-05 09:27:25 +00:00
item_category = models.ForeignKey(
"ItemCategory",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasItemPocket(models.Model):
2016-03-05 09:27:25 +00:00
item_pocket = models.ForeignKey(
"ItemPocket",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasLanguage(models.Model):
2016-03-05 09:27:25 +00:00
language = models.ForeignKey(
"Language",
blank=True,
null=True,
related_name="%(class)s_language",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasLocation(models.Model):
location = models.ForeignKey(
"Location",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasLocationArea(models.Model):
2016-03-05 09:27:25 +00:00
location_area = models.ForeignKey(
"LocationArea",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasMetaAilment(models.Model):
2016-03-05 09:27:25 +00:00
move_meta_ailment = models.ForeignKey(
"MoveMetaAilment",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasMetaCategory(models.Model):
2016-03-05 09:27:25 +00:00
move_meta_category = models.ForeignKey(
"MoveMetaCategory",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasMove(models.Model):
move = models.ForeignKey(
"Move",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasMoveDamageClass(models.Model):
2016-03-05 09:27:25 +00:00
move_damage_class = models.ForeignKey(
"MoveDamageClass",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasMoveEffect(models.Model):
move_effect = models.ForeignKey(
"MoveEffect", blank=True, null=True, on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasMoveAttribute(models.Model):
2018-10-18 20:23:48 +00:00
move_attribute = models.ForeignKey(
"MoveAttribute", blank=True, null=True, on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasMoveTarget(models.Model):
2016-03-05 09:27:25 +00:00
move_target = models.ForeignKey(
"MoveTarget",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasName(models.Model):
name = models.CharField(max_length=100, db_index=True)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2015-04-07 12:14:31 +00:00
class HasNature(models.Model):
nature = models.ForeignKey(
"Nature",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasOrder(models.Model):
2016-03-05 09:27:25 +00:00
order = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasPokeathlonStat(models.Model):
2016-03-05 09:27:25 +00:00
pokeathlon_stat = models.ForeignKey(
"PokeathlonStat",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasPokedex(models.Model):
pokedex = models.ForeignKey(
"Pokedex",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasPokemon(models.Model):
pokemon = models.ForeignKey(
"Pokemon",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasPokemonColor(models.Model):
2016-03-05 09:27:25 +00:00
pokemon_color = models.ForeignKey(
"PokemonColor",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasPokemonForm(models.Model):
2016-03-05 09:27:25 +00:00
pokemon_form = models.ForeignKey(
"PokemonForm",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasPokemonHabitat(models.Model):
2016-03-05 09:27:25 +00:00
pokemon_habitat = models.ForeignKey(
"PokemonHabitat",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
2016-03-05 09:27:25 +00:00
# HasPokemonMoveMethod
class HasMoveLearnMethod(models.Model):
2016-03-05 09:27:25 +00:00
move_learn_method = models.ForeignKey(
"MoveLearnMethod",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasPokemonShape(models.Model):
2016-03-05 09:27:25 +00:00
pokemon_shape = models.ForeignKey(
"PokemonShape",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasPokemonSpecies(models.Model):
2016-03-05 09:27:25 +00:00
pokemon_species = models.ForeignKey(
"PokemonSpecies",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasRegion(models.Model):
region = models.ForeignKey(
"Region",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasShortEffect(models.Model):
2016-03-05 09:27:25 +00:00
short_effect = models.CharField(max_length=300)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasStat(models.Model):
stat = models.ForeignKey(
"Stat",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasType(models.Model):
type = models.ForeignKey(
"Type",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasTypeEfficacy(models.Model):
damage_type = models.ForeignKey(
"Type",
blank=True,
null=True,
related_name="%(class)s_damage_type",
on_delete=models.CASCADE,
)
target_type = models.ForeignKey(
"Type",
blank=True,
null=True,
related_name="%(class)s_target_type",
on_delete=models.CASCADE,
)
damage_factor = models.IntegerField()
class Meta:
abstract = True
class HasVersion(models.Model):
version = models.ForeignKey(
"Version",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class HasVersionGroup(models.Model):
2016-03-05 09:27:25 +00:00
version_group = models.ForeignKey(
"VersionGroup",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class IsDescription(HasLanguage, HasDescription):
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class IsName(HasLanguage, HasName):
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
class IsFlavorText(HasLanguage, HasFlavorText):
2016-03-05 09:27:25 +00:00
class Meta:
abstract = True
####################
# VERSION MODELS #
####################
class Version(HasName, HasVersionGroup):
2016-03-05 09:27:25 +00:00
pass
2015-10-18 23:01:33 +00:00
class VersionName(IsName, HasVersion):
2016-03-05 09:27:25 +00:00
pass
class VersionGroup(HasName, HasGeneration, HasOrder):
2016-03-05 09:27:25 +00:00
pass
class VersionGroupRegion(HasVersionGroup, HasRegion):
2016-03-05 09:27:25 +00:00
pass
2016-03-05 09:27:25 +00:00
# VersionGroupPokemonMoveMethod
class VersionGroupMoveLearnMethod(HasVersionGroup, HasMoveLearnMethod):
pass
#####################
# LANGUAGE MODELS #
#####################
class Language(HasName, HasOrder):
iso639 = models.CharField(max_length=10)
2016-03-05 09:27:25 +00:00
iso3166 = models.CharField(max_length=2)
2016-03-05 09:27:25 +00:00
official = models.BooleanField(default=False)
class LanguageName(IsName):
2016-03-05 09:27:25 +00:00
local_language = models.ForeignKey(
"Language",
blank=True,
null=True,
related_name="locallanguage",
on_delete=models.CASCADE,
)
#######################
# GENERATION MODELS #
#######################
class Generation(HasName):
region = models.OneToOneField(
"Region",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
class GenerationName(IsName, HasGeneration):
2016-03-05 09:27:25 +00:00
pass
###################
# REGION MODELS #
###################
class Region(HasName):
2016-03-05 09:27:25 +00:00
pass
class RegionName(IsName, HasRegion):
2016-03-05 09:27:25 +00:00
pass
####################
# ABILITY MODELS #
####################
class Ability(HasName, HasGeneration):
2016-03-05 09:27:25 +00:00
is_main_series = models.BooleanField(default=False)
class AbilityEffectText(HasLanguage, HasEffect, HasShortEffect, HasAbility):
2016-03-05 09:27:25 +00:00
pass
class AbilityFlavorText(IsFlavorText, HasAbility, HasVersionGroup):
2016-03-05 09:27:25 +00:00
pass
class AbilityName(IsName, HasAbility):
2016-03-05 09:27:25 +00:00
pass
class AbilityChange(HasAbility, HasVersionGroup):
2016-03-05 09:27:25 +00:00
pass
class AbilityChangeEffectText(HasLanguage, HasEffect):
2016-03-05 09:27:25 +00:00
ability_change = models.ForeignKey(
AbilityChange,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
#################
# TYPE MODELS #
#################
class Type(HasName, HasGeneration, HasMoveDamageClass):
2016-03-05 09:27:25 +00:00
pass
class TypeName(IsName, HasType):
2016-03-05 09:27:25 +00:00
pass
class TypeGameIndex(HasType, HasGeneration, HasGameIndex):
2016-03-05 09:27:25 +00:00
pass
class TypeEfficacy(HasTypeEfficacy):
pass
2015-04-07 12:14:31 +00:00
# model for a type's efficacy that was used until a given generation
class TypeEfficacyPast(HasTypeEfficacy, HasGeneration):
pass
2015-04-07 12:14:31 +00:00
#################
# STAT MODELS #
#################
class Stat(HasName, HasMoveDamageClass):
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
is_battle_only = models.BooleanField(default=False)
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
game_index = models.IntegerField()
2015-04-07 12:14:31 +00:00
class StatName(IsName, HasStat):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
###########################
# CHARACTERISTIC MODELS #
###########################
2015-04-07 12:14:31 +00:00
class Characteristic(HasStat):
2016-03-05 09:27:25 +00:00
gene_mod_5 = models.IntegerField()
2015-04-07 12:14:31 +00:00
class CharacteristicDescription(HasCharacteristic, IsDescription):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
######################
# EGG GROUP MODELS #
######################
2015-04-07 12:14:31 +00:00
class EggGroup(HasName):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
class EggGroupName(IsName, HasEggGroup):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
#################
# ITEM MODELS #
#################
2015-04-07 12:14:31 +00:00
class ItemPocket(HasName):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
class ItemPocketName(IsName, HasItemPocket):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
class ItemCategory(HasName, HasItemPocket):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
class ItemCategoryName(IsName, HasItemCategory):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
class ItemFlingEffect(HasName):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
class ItemFlingEffectEffectText(HasLanguage, HasEffect, HasFlingEffect):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
class Item(HasName, HasItemCategory, HasFlingEffect):
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
cost = models.IntegerField(blank=True, null=True)
2015-04-07 12:14:31 +00:00
2016-03-05 09:27:25 +00:00
fling_power = models.IntegerField(blank=True, null=True)
2015-04-07 12:14:31 +00:00
class ItemEffectText(HasItem, HasLanguage, HasEffect, HasShortEffect):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
class ItemName(HasItem, IsName):
2016-03-05 09:27:25 +00:00
pass
2015-04-07 12:14:31 +00:00
class ItemFlavorText(HasItem, HasVersionGroup, IsFlavorText):
2016-03-05 09:27:25 +00:00
pass
2015-10-23 04:56:01 +00:00
class ItemAttribute(HasName):
2016-03-05 09:27:25 +00:00
pass
class ItemAttributeName(IsName, HasItemAttribute):
2016-03-05 09:27:25 +00:00
pass
class ItemAttributeDescription(IsDescription, HasItemAttribute):
2016-03-05 09:27:25 +00:00
pass
class ItemAttributeMap(HasItem, HasItemAttribute):
2016-03-05 09:27:25 +00:00
pass
class ItemGameIndex(HasItem, HasGeneration, HasGameIndex):
2016-03-05 09:27:25 +00:00
pass
class ItemSprites(HasItem):
sprites = models.CharField(max_length=1000)
####################
# CONTEST MODELS #
####################
class ContestType(HasName):
2016-03-05 09:27:25 +00:00
pass
class ContestTypeName(HasContestType, IsName):
2016-03-05 09:27:25 +00:00
flavor = models.CharField(max_length=10)
2016-03-05 09:27:25 +00:00
color = models.CharField(max_length=10)
class ContestEffect(models.Model):
2016-03-05 09:27:25 +00:00
appeal = models.IntegerField()
2016-03-05 09:27:25 +00:00
jam = models.IntegerField()
class ContestEffectEffectText(HasLanguage, HasEffect, HasContestEffect):
2016-03-05 09:27:25 +00:00
pass
class ContestEffectFlavorText(HasLanguage, HasFlavorText, HasContestEffect):
2016-03-05 09:27:25 +00:00
pass
class ContestCombo(models.Model):
first_move = models.ForeignKey(
"Move",
blank=True,
null=True,
related_name="first_move",
on_delete=models.CASCADE,
)
second_move = models.ForeignKey(
"Move",
blank=True,
null=True,
related_name="second_move",
on_delete=models.CASCADE,
)
##################
# BERRY MODELS #
##################
class BerryFirmness(HasName):
2016-03-05 09:27:25 +00:00
pass
class BerryFirmnessName(IsName):
2016-03-05 09:27:25 +00:00
berry_firmness = models.ForeignKey(
BerryFirmness,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
class Berry(HasName, HasItem):
2016-03-05 09:27:25 +00:00
berry_firmness = models.ForeignKey(
BerryFirmness,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
natural_gift_power = models.IntegerField()
2018-10-18 20:23:48 +00:00
natural_gift_type = models.ForeignKey(
Type, blank=True, null=True, related_name="%(class)s", on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
size = models.IntegerField()
2016-03-05 09:27:25 +00:00
max_harvest = models.IntegerField()
2016-03-05 09:27:25 +00:00
growth_time = models.IntegerField()
2016-03-05 09:27:25 +00:00
soil_dryness = models.IntegerField()
2016-03-05 09:27:25 +00:00
smoothness = models.IntegerField()
# Berry Flavors are a bit of a hack because their relationship
# in terms of flavors to contest types is really awkward the
# way it was handled in the veekun data set. Berry Flavor here
# does not match the csv table. Berry Flavor Map
# is a table fabricated just to suit this project.
2016-03-05 09:27:25 +00:00
class BerryFlavor(HasName):
2016-03-05 09:27:25 +00:00
contest_type = models.OneToOneField(
"ContestType",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2015-11-10 19:20:06 +00:00
class BerryFlavorName(IsName):
berry_flavor = models.ForeignKey(
BerryFlavor,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2015-11-10 19:20:06 +00:00
class BerryFlavorMap(models.Model):
berry = models.ForeignKey(
Berry, blank=True, null=True, related_name="%(class)s", on_delete=models.CASCADE
)
2015-11-10 19:20:06 +00:00
berry_flavor = models.ForeignKey(
BerryFlavor,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
potency = models.IntegerField()
########################
# GROWTH RATE MODELS #
########################
class GrowthRate(HasName):
2016-03-05 09:27:25 +00:00
formula = models.CharField(max_length=500)
class GrowthRateDescription(HasGrowthRate, IsDescription):
2016-03-05 09:27:25 +00:00
pass
###################
# NATURE MODELS #
###################
class Nature(HasName):
2018-10-18 20:23:48 +00:00
decreased_stat = models.ForeignKey(
Stat, blank=True, null=True, related_name="decreased", on_delete=models.CASCADE
)
2018-10-18 20:23:48 +00:00
increased_stat = models.ForeignKey(
Stat, blank=True, null=True, related_name="increased", on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
hates_flavor = models.ForeignKey(
BerryFlavor,
blank=True,
null=True,
related_name="hates_flavor",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
likes_flavor = models.ForeignKey(
BerryFlavor,
blank=True,
null=True,
related_name="likes_flavor",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
game_index = models.IntegerField()
class NatureName(IsName, HasNature):
2016-03-05 09:27:25 +00:00
pass
class NaturePokeathlonStat(HasNature, HasPokeathlonStat):
2016-03-05 09:27:25 +00:00
max_change = models.IntegerField()
class NatureBattleStylePreference(HasNature):
2016-03-05 09:27:25 +00:00
move_battle_style = models.ForeignKey(
"MoveBattleStyle",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
low_hp_preference = models.IntegerField()
2016-03-05 09:27:25 +00:00
high_hp_preference = models.IntegerField()
#####################
# LOCATION MODELS #
#####################
class Location(HasRegion, HasName):
2016-03-05 09:27:25 +00:00
pass
class LocationName(HasLocation, IsName):
2016-03-05 09:27:25 +00:00
pass
class LocationGameIndex(HasLocation, HasGeneration, HasGameIndex):
2016-03-05 09:27:25 +00:00
pass
class LocationArea(HasLocation, HasGameIndex, HasName):
2016-03-05 09:27:25 +00:00
pass
class LocationAreaName(IsName, HasLocationArea):
2016-03-05 09:27:25 +00:00
pass
class LocationAreaEncounterRate(HasEncounterMethod, HasLocationArea, HasVersion):
2016-03-05 09:27:25 +00:00
rate = models.IntegerField()
######################
# ENCOUNTER MODELS #
######################
class EncounterMethod(HasName, HasOrder):
2016-03-05 09:27:25 +00:00
pass
class EncounterMethodName(HasEncounterMethod, IsName):
2016-03-05 09:27:25 +00:00
pass
class EncounterSlot(HasVersionGroup, HasEncounterMethod):
2016-03-05 09:27:25 +00:00
slot = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
rarity = models.IntegerField()
class Encounter(HasVersion, HasLocationArea, HasPokemon):
encounter_slot = models.ForeignKey(
EncounterSlot, blank=True, null=True, on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
min_level = models.IntegerField()
2016-03-05 09:27:25 +00:00
max_level = models.IntegerField()
class EncounterCondition(HasName):
2016-03-05 09:27:25 +00:00
pass
class EncounterConditionName(HasEncounterCondition, IsName):
2016-03-05 09:27:25 +00:00
pass
class EncounterConditionValue(HasEncounterCondition, HasName):
2016-03-05 09:27:25 +00:00
is_default = models.BooleanField(default=False)
class EncounterConditionValueName(IsName):
2016-03-05 09:27:25 +00:00
encounter_condition_value = models.ForeignKey(
EncounterConditionValue,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
class EncounterConditionValueMap(models.Model):
encounter = models.ForeignKey(
Encounter, blank=True, null=True, on_delete=models.CASCADE
)
2018-10-18 20:23:48 +00:00
encounter_condition_value = models.ForeignKey(
EncounterConditionValue, blank=True, null=True, on_delete=models.CASCADE
)
#################
# MOVE MODELS #
#################
2016-03-05 09:27:25 +00:00
class Move(
HasName,
HasGeneration,
HasType,
HasMoveDamageClass,
HasMoveEffect,
HasMoveTarget,
HasContestType,
HasContestEffect,
HasSuperContestEffect,
):
2016-03-05 09:27:25 +00:00
power = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
pp = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
accuracy = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
priority = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
move_effect_chance = models.IntegerField(blank=True, null=True)
class MoveName(HasMove, IsName):
2016-03-05 09:27:25 +00:00
pass
class MoveFlavorText(HasMove, HasVersionGroup, IsFlavorText):
2016-03-05 09:27:25 +00:00
pass
class MoveChange(HasMove, HasVersionGroup, HasType, HasMoveEffect):
2016-03-05 09:27:25 +00:00
power = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
pp = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
accuracy = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
move_effect_chance = models.IntegerField(blank=True, null=True)
##############################
# MOVE DAMAGE CLASS MODELS #
##############################
class MoveDamageClass(HasName):
2016-03-05 09:27:25 +00:00
pass
class MoveDamageClassName(HasMoveDamageClass, IsName):
2016-03-05 09:27:25 +00:00
pass
2016-03-05 09:27:25 +00:00
class MoveDamageClassDescription(HasMoveDamageClass, IsDescription):
pass
##############################
# MOVE BATTLE STYLE MODELS #
##############################
class MoveBattleStyle(HasName):
2016-03-05 09:27:25 +00:00
pass
class MoveBattleStyleName(IsName):
2016-03-05 09:27:25 +00:00
move_battle_style = models.ForeignKey(
MoveBattleStyle,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
########################
# MOVE EFFECT MODELS #
########################
class MoveEffect(models.Model):
2016-03-05 09:27:25 +00:00
pass
class MoveEffectEffectText(HasLanguage, HasMoveEffect, HasEffect, HasShortEffect):
2016-03-05 09:27:25 +00:00
pass
class MoveEffectChange(HasMoveEffect, HasVersionGroup):
2016-03-05 09:27:25 +00:00
pass
class MoveEffectChangeEffectText(HasLanguage, HasEffect):
2016-03-05 09:27:25 +00:00
move_effect_change = models.ForeignKey(
"MoveEffectChange",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
################################
# MOVE FLAG/ATTRIBUTE MODELS #
################################
class MoveAttribute(HasName):
2016-03-05 09:27:25 +00:00
pass
class MoveAttributeName(HasMoveAttribute, IsName):
2016-03-05 09:27:25 +00:00
pass
class MoveAttributeDescription(HasMoveAttribute, IsDescription):
2016-03-05 09:27:25 +00:00
pass
class MoveAttributeMap(HasMove, HasMoveAttribute):
2016-03-05 09:27:25 +00:00
pass
########################
# MOVE TARGET MODELS #
########################
class MoveTarget(HasName):
2016-03-05 09:27:25 +00:00
pass
class MoveTargetName(HasMoveTarget, IsName):
2016-03-05 09:27:25 +00:00
pass
class MoveTargetDescription(HasMoveTarget, IsDescription):
2016-03-05 09:27:25 +00:00
pass
######################
# MOVE META MODELS #
######################
class MoveMeta(HasMetaAilment, HasMetaCategory):
move = models.OneToOneField(
Move,
blank=False,
null=False,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
min_hits = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
max_hits = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
min_turns = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
max_turns = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
drain = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
healing = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
crit_rate = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
ailment_chance = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
flinch_chance = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
stat_chance = models.IntegerField(blank=True, null=True)
class MoveMetaAilment(HasName):
2016-03-05 09:27:25 +00:00
pass
class MoveMetaAilmentName(HasMetaAilment, IsName):
2016-03-05 09:27:25 +00:00
pass
class MoveMetaCategory(HasName):
2016-03-05 09:27:25 +00:00
pass
class MoveMetaCategoryDescription(HasMetaCategory, IsDescription):
2016-03-05 09:27:25 +00:00
pass
class MoveMetaStatChange(HasMove, HasStat):
2016-03-05 09:27:25 +00:00
change = models.IntegerField()
#######################
# EXPERIENCE MODELS #
#######################
class Experience(HasGrowthRate):
2016-03-05 09:27:25 +00:00
level = models.IntegerField()
2016-03-05 09:27:25 +00:00
experience = models.IntegerField()
###################
# GENDER MODELS #
###################
class Gender(HasName):
2016-03-05 09:27:25 +00:00
pass
####################
# MACHINE MODELS #
####################
class Machine(HasGrowthRate, HasItem):
2016-03-05 09:27:25 +00:00
machine_number = models.IntegerField()
version_group = models.ForeignKey(
VersionGroup, blank=True, null=True, on_delete=models.CASCADE
)
2018-10-18 20:23:48 +00:00
move = models.ForeignKey(Move, blank=True, null=True, on_delete=models.CASCADE)
#######################
# POKEATHLON MODELS #
#######################
class PokeathlonStat(HasName):
2016-03-05 09:27:25 +00:00
pass
class PokeathlonStatName(IsName, HasPokeathlonStat):
2016-03-05 09:27:25 +00:00
pass
#####################
# PAL PARK MODELS #
#####################
class PalParkArea(HasName):
2016-03-05 09:27:25 +00:00
pass
class PalParkAreaName(IsName):
2016-03-05 09:27:25 +00:00
pal_park_area = models.ForeignKey(
PalParkArea,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
class PalPark(HasPokemonSpecies):
2016-03-05 09:27:25 +00:00
pal_park_area = models.ForeignKey(
PalParkArea,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
base_score = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
rate = models.IntegerField()
##########################
# SUPER CONTEST MODELS #
##########################
class SuperContestEffect(models.Model):
2016-03-05 09:27:25 +00:00
appeal = models.IntegerField()
class SuperContestEffectFlavorText(IsFlavorText, HasSuperContestEffect):
2016-03-05 09:27:25 +00:00
pass
class SuperContestCombo(models.Model):
first_move = models.ForeignKey(
Move, blank=True, null=True, related_name="first", on_delete=models.CASCADE
)
second_move = models.ForeignKey(
Move, blank=True, null=True, related_name="second", on_delete=models.CASCADE
)
######################
# EVOLUTION MODELS #
######################
class EvolutionChain(models.Model):
baby_trigger_item = models.ForeignKey(
Item, blank=True, null=True, on_delete=models.CASCADE
)
class EvolutionTrigger(HasName):
2016-03-05 09:27:25 +00:00
pass
class EvolutionTriggerName(HasEvolutionTrigger, IsName):
2016-03-05 09:27:25 +00:00
pass
####################
# POKEDEX MODELS #
####################
class Pokedex(HasName, HasRegion):
2016-03-05 09:27:25 +00:00
is_main_series = models.BooleanField(default=False)
class PokedexName(HasPokedex, IsName):
2016-03-05 09:27:25 +00:00
pass
class PokedexDescription(HasPokedex, IsDescription):
2016-03-05 09:27:25 +00:00
pass
class PokedexVersionGroup(HasPokedex, HasVersionGroup):
2016-03-05 09:27:25 +00:00
pass
####################
# POKEMON MODELS #
####################
class PokemonSpecies(
HasName, HasGeneration, HasPokemonColor, HasPokemonShape, HasGrowthRate, HasOrder
):
2018-10-18 20:23:48 +00:00
evolves_from_species = models.ForeignKey(
"self", blank=True, null=True, on_delete=models.CASCADE
)
2018-10-18 20:23:48 +00:00
evolution_chain = models.ForeignKey(
EvolutionChain, blank=True, null=True, on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
pokemon_habitat = models.ForeignKey(
"PokemonHabitat",
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
2020-08-01 10:00:09 +00:00
gender_rate = models.IntegerField(blank=True, null=True)
2020-08-01 10:00:09 +00:00
capture_rate = models.IntegerField(blank=True, null=True)
2020-08-01 10:00:09 +00:00
base_happiness = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
is_baby = models.BooleanField(default=False)
is_legendary = models.BooleanField(default=False)
is_mythical = models.BooleanField(default=False)
2020-08-01 10:00:09 +00:00
hatch_counter = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
has_gender_differences = models.BooleanField(default=False)
2016-03-05 09:27:25 +00:00
forms_switchable = models.BooleanField(default=False)
class PokemonSpeciesName(IsName, HasPokemonSpecies):
2016-03-05 09:27:25 +00:00
genus = models.CharField(max_length=30)
class PokemonSpeciesDescription(HasPokemonSpecies, IsDescription):
2016-03-05 09:27:25 +00:00
pass
class PokemonSpeciesFlavorText(IsFlavorText, HasPokemonSpecies, HasVersion):
2016-03-05 09:27:25 +00:00
pass
class Pokemon(HasName, HasPokemonSpecies, HasOrder):
2020-07-25 19:52:01 +00:00
height = models.IntegerField(blank=True, null=True)
2020-07-25 19:52:01 +00:00
weight = models.IntegerField(blank=True, null=True)
2020-07-25 19:52:01 +00:00
base_experience = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
is_default = models.BooleanField(default=False)
class PokemonAbility(HasPokemon, HasAbility):
2016-03-05 09:27:25 +00:00
is_hidden = models.BooleanField(default=False)
2016-03-05 09:27:25 +00:00
slot = models.IntegerField()
class PokemonColor(HasName):
2016-03-05 09:27:25 +00:00
pass
class PokemonColorName(HasPokemonColor, IsName):
2016-03-05 09:27:25 +00:00
pass
class PokemonDexNumber(HasPokemonSpecies, HasPokedex):
2016-03-05 09:27:25 +00:00
pokedex_number = models.IntegerField()
class PokemonEggGroup(HasPokemonSpecies, HasEggGroup):
2016-03-05 09:27:25 +00:00
pass
class PokemonEvolution(HasEvolutionTrigger, HasGender):
2018-10-18 20:23:48 +00:00
evolution_item = models.ForeignKey(
Item,
blank=True,
null=True,
related_name="evolution_item",
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
evolved_species = models.ForeignKey(
PokemonSpecies,
related_name="evolved_species",
blank=True,
null=True,
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
min_level = models.IntegerField(blank=True, null=True)
location = models.ForeignKey(
Location,
related_name="location",
blank=True,
null=True,
on_delete=models.CASCADE,
)
held_item = models.ForeignKey(
Item, blank=True, null=True, related_name="held_item", on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
time_of_day = models.CharField(max_length=10, blank=True, null=True)
known_move = models.ForeignKey(
Move, blank=True, null=True, on_delete=models.CASCADE
)
2018-10-18 20:23:48 +00:00
known_move_type = models.ForeignKey(
Type, related_name="known_move", blank=True, null=True, on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
min_happiness = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
min_beauty = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
min_affection = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
relative_physical_stats = models.IntegerField(blank=True, null=True)
2016-03-05 09:27:25 +00:00
party_species = models.ForeignKey(
PokemonSpecies,
related_name="party_species",
blank=True,
null=True,
on_delete=models.CASCADE,
)
party_type = models.ForeignKey(
Type, related_name="party_type", blank=True, null=True, on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
trade_species = models.ForeignKey(
PokemonSpecies,
related_name="trade_species",
blank=True,
null=True,
on_delete=models.CASCADE,
)
2016-03-05 09:27:25 +00:00
needs_overworld_rain = models.BooleanField(default=False)
2016-03-05 09:27:25 +00:00
turn_upside_down = models.BooleanField(default=False)
class PokemonForm(HasName, HasPokemon, HasOrder):
2016-03-05 09:27:25 +00:00
form_name = models.CharField(max_length=30)
version_group = models.ForeignKey(
VersionGroup, blank=True, null=True, on_delete=models.CASCADE
)
2016-03-05 09:27:25 +00:00
is_default = models.BooleanField(default=False)
2016-03-05 09:27:25 +00:00
is_battle_only = models.BooleanField(default=False)
2016-03-05 09:27:25 +00:00
is_mega = models.BooleanField(default=False)
2016-03-05 09:27:25 +00:00
form_order = models.IntegerField(blank=True, null=True)
class PokemonFormGeneration(HasPokemonForm, HasGeneration, HasGameIndex):
2016-03-05 09:27:25 +00:00
pass
class PokemonFormName(HasPokemonForm, IsName):
2020-11-23 20:57:30 +00:00
pokemon_name = models.CharField(max_length=60)
class PokemonFormSprites(HasPokemonForm):
sprites = models.CharField(max_length=1000)
class PokemonGameIndex(HasPokemon, HasGameIndex, HasVersion):
2016-03-05 09:27:25 +00:00
pass
class PokemonHabitat(HasName):
2016-03-05 09:27:25 +00:00
pass
class PokemonHabitatName(IsName):
2016-03-05 09:27:25 +00:00
pokemon_habitat = models.ForeignKey(
PokemonHabitat,
blank=True,
null=True,
related_name="%(class)s",
on_delete=models.CASCADE,
)
class PokemonItem(HasPokemon, HasVersion, HasItem):
2016-03-05 09:27:25 +00:00
rarity = models.IntegerField()
2016-03-05 09:27:25 +00:00
# PokemonMoveMethod
class MoveLearnMethod(HasName):
2016-03-05 09:27:25 +00:00
pass
2016-03-05 09:27:25 +00:00
# PokemonMoveMethodName
class MoveLearnMethodName(IsName, HasMoveLearnMethod):
2016-03-05 09:27:25 +00:00
pass
class MoveLearnMethodDescription(IsDescription, HasMoveLearnMethod):
2016-03-05 09:27:25 +00:00
pass
class PokemonMove(HasPokemon, HasMoveLearnMethod, HasVersionGroup, HasMove, HasOrder):
2016-03-05 09:27:25 +00:00
level = models.IntegerField()
class PokemonShape(HasName):
2016-03-05 09:27:25 +00:00
pass
class PokemonShapeName(IsName):
2016-03-05 09:27:25 +00:00
awesome_name = models.CharField(max_length=30)
2016-03-05 09:27:25 +00:00
pokemon_shape = models.ForeignKey(
PokemonShape,
blank=True,
null=True,
related_name="pokemonshapename",
on_delete=models.CASCADE,
2018-10-18 20:23:48 +00:00
)
class PokemonStat(HasPokemon, HasStat):
2016-03-05 09:27:25 +00:00
base_stat = models.IntegerField()
2016-03-05 09:27:25 +00:00
effort = models.IntegerField()
class PokemonType(HasPokemon, HasType):
2016-03-05 09:27:25 +00:00
slot = models.IntegerField()
2016-02-10 04:11:37 +00:00
class PokemonFormType(HasPokemonForm, HasType):
slot = models.IntegerField()
# model for a Pokemon's types that were used until a given generation
class PokemonTypePast(HasPokemon, HasType, HasGeneration):
slot = models.IntegerField()
2016-02-13 04:44:08 +00:00
class PokemonSprites(HasPokemon):
2020-07-10 06:25:48 +00:00
sprites = models.CharField(max_length=20000)