mirror of
https://github.com/PokeAPI/pokeapi
synced 2024-11-25 04:40:21 +00:00
More of the same for now
This commit is contained in:
parent
be211d7f39
commit
fc4fe24270
9 changed files with 707 additions and 18 deletions
206
data/v2/build.py
206
data/v2/build.py
|
@ -1,16 +1,21 @@
|
|||
import csv
|
||||
import os
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
from pokemon_v2.models import *
|
||||
|
||||
|
||||
data_location = 'data/v2/csv/'
|
||||
|
||||
# migrations.RunSQL('INSERT INTO pokemon_v2_statname VALUES name=banana')
|
||||
|
||||
|
||||
def loadData(fileName):
|
||||
return csv.reader(open(data_location + fileName, 'rb'), delimiter=',')
|
||||
|
||||
def clearTable(model):
|
||||
print str(model)
|
||||
model.objects.all().delete()
|
||||
|
||||
|
||||
|
@ -19,7 +24,6 @@ def clearTable(model):
|
|||
##############
|
||||
|
||||
clearTable(Language)
|
||||
print str(Language)
|
||||
data = loadData('languages.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
|
@ -145,6 +149,42 @@ for index, info in enumerate(data):
|
|||
versionName.save()
|
||||
|
||||
|
||||
|
||||
###########
|
||||
# STATS #
|
||||
###########
|
||||
|
||||
clearTable(Stat)
|
||||
data = loadData('stats.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
stat = Stat (
|
||||
id = int(info[0]),
|
||||
damage_class_id = int(info[3]) if info[3] else 0,
|
||||
name = info[2],
|
||||
is_battle_only = bool(info[3]),
|
||||
game_index = int(info[3]) if info[3] else 0,
|
||||
)
|
||||
stat.save()
|
||||
|
||||
|
||||
clearTable(StatName)
|
||||
data = loadData('stat_names.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
statName = StatName (
|
||||
stat = Stat.objects.filter(id = int(info[0]))[0],
|
||||
language = Language.objects.filter(id = int(info[1]))[0],
|
||||
name = info[2]
|
||||
)
|
||||
statName.save()
|
||||
|
||||
|
||||
|
||||
###############
|
||||
# ABILITIES #
|
||||
###############
|
||||
|
@ -209,6 +249,170 @@ for index, info in enumerate(data):
|
|||
|
||||
|
||||
|
||||
####################
|
||||
# CHARACTERISTIC #
|
||||
####################
|
||||
|
||||
clearTable(Characteristic)
|
||||
data = loadData('characteristics.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
model = Characteristic (
|
||||
id = int(info[0]),
|
||||
stat = Stat.objects.filter(id = int(info[1]))[0],
|
||||
gene_mod_5 = int(info[2])
|
||||
)
|
||||
model.save()
|
||||
|
||||
|
||||
clearTable(CharacteristicDescription)
|
||||
data = loadData('characteristic_text.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
model = CharacteristicDescription (
|
||||
characteristic = Characteristic.objects.filter(id = int(info[0]))[0],
|
||||
language = Language.objects.filter(id = int(info[1]))[0],
|
||||
description = info[2]
|
||||
)
|
||||
model.save()
|
||||
|
||||
|
||||
|
||||
###############
|
||||
# EGG GROUP #
|
||||
###############
|
||||
|
||||
clearTable(EggGroup)
|
||||
data = loadData('egg_groups.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
model = EggGroup (
|
||||
id = int(info[0]),
|
||||
name = info[1]
|
||||
)
|
||||
model.save()
|
||||
|
||||
|
||||
clearTable(EggGroupName)
|
||||
data = loadData('egg_group_prose.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
model = EggGroupName (
|
||||
egg_group = EggGroup.objects.filter(id = int(info[0]))[0],
|
||||
language = Language.objects.filter(id = int(info[1]))[0],
|
||||
name = info[2]
|
||||
)
|
||||
model.save()
|
||||
|
||||
|
||||
|
||||
#################
|
||||
# GROWTH RATE #
|
||||
#################
|
||||
|
||||
clearTable(GrowthRate)
|
||||
data = loadData('growth_rates.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
model = GrowthRate (
|
||||
id = int(info[0]),
|
||||
name = info[1],
|
||||
formula = info[2]
|
||||
)
|
||||
model.save()
|
||||
|
||||
|
||||
clearTable(GrowthRateDescription)
|
||||
data = loadData('growth_rate_prose.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
model = GrowthRateDescription (
|
||||
growth_rate = GrowthRate.objects.filter(id = int(info[0]))[0],
|
||||
language = Language.objects.filter(id = int(info[1]))[0],
|
||||
name = info[2]
|
||||
)
|
||||
model.save()
|
||||
|
||||
|
||||
|
||||
############
|
||||
# Nature #
|
||||
############
|
||||
|
||||
clearTable(Nature)
|
||||
data = loadData('natures.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
nature = Nature (
|
||||
id = int(info[0]),
|
||||
name = info[1],
|
||||
decreased_stat_id = Stat.objects.filter(id = int(info[2]))[0],
|
||||
increased_stat_id = Stat.objects.filter(id = int(info[3]))[0],
|
||||
hates_flavor_id = info[4],
|
||||
likes_flavor_id = info[5],
|
||||
game_index = info[6]
|
||||
)
|
||||
nature.save()
|
||||
|
||||
|
||||
clearTable(NatureName)
|
||||
data = loadData('nature_names.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
natureName = NatureName (
|
||||
nature = Nature.objects.filter(id = int(info[0]))[0],
|
||||
language = Language.objects.filter(id = int(info[1]))[0],
|
||||
name = info[2]
|
||||
)
|
||||
natureName.save()
|
||||
|
||||
|
||||
clearTable(NaturePokeathlonStat)
|
||||
data = loadData('nature_pokeathlon_stats.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
naturePokeathlonStat = NaturePokeathlonStat (
|
||||
nature = Nature.objects.filter(id = int(info[0]))[0],
|
||||
pokeathlon_stat_id = Stat.objects.filter(id = int(info[1]))[0],
|
||||
max_change = info[2]
|
||||
)
|
||||
naturePokeathlonStat.save()
|
||||
|
||||
|
||||
clearTable(NatureBattleStylePreference)
|
||||
data = loadData('nature_battle_style_preferences.csv')
|
||||
|
||||
for index, info in enumerate(data):
|
||||
if index > 0:
|
||||
|
||||
model = NatureBattleStylePreference (
|
||||
nature = Nature.objects.filter(id = int(info[0]))[0],
|
||||
move_battle_style_id = int(info[1]),
|
||||
low_hp_preference = info[2],
|
||||
high_hp_preference = info[3]
|
||||
)
|
||||
model.save()
|
||||
|
||||
|
||||
|
||||
###########
|
||||
# TYPES #
|
||||
###########
|
||||
|
|
118
pokemon_v2/migrations/0009_auto_20150407_0216.py
Normal file
118
pokemon_v2/migrations/0009_auto_20150407_0216.py
Normal file
|
@ -0,0 +1,118 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0008_typeefficacy'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Nature',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('hates_flavor_id', models.IntegerField()),
|
||||
('likes_flavor_id', models.IntegerField()),
|
||||
('game_index', models.IntegerField()),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='NatureBattleStylePreference',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('move_battle_style_id', models.IntegerField()),
|
||||
('low_hp_preference', models.IntegerField()),
|
||||
('high_hp_preference', models.IntegerField()),
|
||||
('nature', models.ForeignKey(blank=True, to='pokemon_v2.Nature', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='NatureNames',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
|
||||
('nature', models.ForeignKey(blank=True, to='pokemon_v2.Nature', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='NaturePokeathalonStats',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('max_change', models.IntegerField()),
|
||||
('nature', models.ForeignKey(blank=True, to='pokemon_v2.Nature', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Stat',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('damage_class_id', models.IntegerField(null=True, blank=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('is_battle_only', models.BooleanField(default=False)),
|
||||
('game_index', models.IntegerField()),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StatName',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
|
||||
('stat', models.ForeignKey(blank=True, to='pokemon_v2.Stat', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='naturepokeathalonstats',
|
||||
name='pokeathalon_stat_id',
|
||||
field=models.ForeignKey(blank=True, to='pokemon_v2.Stat', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='nature',
|
||||
name='decreased_stat_id',
|
||||
field=models.ForeignKey(related_name='decreased', blank=True, to='pokemon_v2.Stat', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='nature',
|
||||
name='increased_stat_id',
|
||||
field=models.ForeignKey(related_name='increased', blank=True, to='pokemon_v2.Stat', null=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='type',
|
||||
name='damage_class_id',
|
||||
field=models.IntegerField(null=True, blank=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
38
pokemon_v2/migrations/0010_auto_20150407_0231.py
Normal file
38
pokemon_v2/migrations/0010_auto_20150407_0231.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0009_auto_20150407_0216'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='NatureName',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
|
||||
('nature', models.ForeignKey(blank=True, to='pokemon_v2.Nature', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='naturenames',
|
||||
name='language',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='naturenames',
|
||||
name='nature',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='NatureNames',
|
||||
),
|
||||
]
|
38
pokemon_v2/migrations/0011_auto_20150407_0233.py
Normal file
38
pokemon_v2/migrations/0011_auto_20150407_0233.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0010_auto_20150407_0231'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='NaturePokeathalonStat',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('max_change', models.IntegerField()),
|
||||
('nature', models.ForeignKey(blank=True, to='pokemon_v2.Nature', null=True)),
|
||||
('pokeathalon_stat_id', models.ForeignKey(blank=True, to='pokemon_v2.Stat', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='naturepokeathalonstats',
|
||||
name='nature',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='naturepokeathalonstats',
|
||||
name='pokeathalon_stat_id',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='NaturePokeathalonStats',
|
||||
),
|
||||
]
|
38
pokemon_v2/migrations/0012_auto_20150407_0235.py
Normal file
38
pokemon_v2/migrations/0012_auto_20150407_0235.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0011_auto_20150407_0233'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='NaturePokeathlonStat',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('max_change', models.IntegerField()),
|
||||
('nature', models.ForeignKey(blank=True, to='pokemon_v2.Nature', null=True)),
|
||||
('pokeathlon_stat_id', models.ForeignKey(blank=True, to='pokemon_v2.Stat', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='naturepokeathalonstat',
|
||||
name='nature',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='naturepokeathalonstat',
|
||||
name='pokeathalon_stat_id',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='NaturePokeathalonStat',
|
||||
),
|
||||
]
|
|
@ -0,0 +1,39 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0012_auto_20150407_0235'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Characteristic',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('gene_mod_5', models.IntegerField()),
|
||||
('stat', models.ForeignKey(blank=True, to='pokemon_v2.Stat', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CharacteristicDescription',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('description', models.CharField(max_length=60)),
|
||||
('characteristic', models.ForeignKey(blank=True, to='pokemon_v2.Characteristic', null=True)),
|
||||
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
]
|
38
pokemon_v2/migrations/0014_egggroup_egggroupname.py
Normal file
38
pokemon_v2/migrations/0014_egggroup_egggroupname.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0013_characteristic_characteristicdescription'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='EggGroup',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='EggGroupName',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('egg_group', models.ForeignKey(blank=True, to='pokemon_v2.EggGroup', null=True)),
|
||||
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,39 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pokemon_v2', '0014_egggroup_egggroupname'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='GrowthRate',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('formula', models.CharField(max_length=500)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='GrowthRateDescription',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('name', models.CharField(max_length=30)),
|
||||
('growth_rate', models.ForeignKey(blank=True, to='pokemon_v2.GrowthRate', null=True)),
|
||||
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
]
|
|
@ -6,6 +6,48 @@ from django.db import models
|
|||
# ABSTRACT MODELS #
|
||||
#####################
|
||||
|
||||
class HasAbility(models.Model):
|
||||
|
||||
ability = models.ForeignKey('Ability', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasCharacteristic(models.Model):
|
||||
|
||||
characteristic = models.ForeignKey('Characteristic', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasDamageClass(models.Model):
|
||||
|
||||
damage_class_id = models.IntegerField(blank = True, null = True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasEggGroup(models.Model):
|
||||
|
||||
egg_group = models.ForeignKey('EggGroup', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasGeneration(models.Model):
|
||||
|
||||
generation = models.ForeignKey('Generation', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasGrowthRate(models.Model):
|
||||
|
||||
growth_rate = models.ForeignKey('GrowthRate', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasLanguage(models.Model):
|
||||
|
||||
language = models.ForeignKey('Language', blank = True, null = True)
|
||||
|
@ -20,7 +62,9 @@ class HasName(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class IsName(HasLanguage, HasName):
|
||||
class HasNature(models.Model):
|
||||
|
||||
nature = models.ForeignKey('Nature', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -32,23 +76,9 @@ class HasOrder(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasAbility(models.Model):
|
||||
class HasStat(models.Model):
|
||||
|
||||
ability = models.ForeignKey('Ability', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasGeneration(models.Model):
|
||||
|
||||
generation = models.ForeignKey('Generation', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasVersionGroup(models.Model):
|
||||
|
||||
version_group = models.ForeignKey('VersionGroup', blank=True, null=True)
|
||||
stat = models.ForeignKey('Stat', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
@ -60,6 +90,17 @@ class HasType(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class HasVersionGroup(models.Model):
|
||||
|
||||
version_group = models.ForeignKey('VersionGroup', blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
class IsName(HasLanguage, HasName):
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
|
||||
####################
|
||||
|
@ -173,3 +214,99 @@ class TypeEfficacy(models.Model):
|
|||
target_type_id = models.IntegerField()
|
||||
|
||||
damage_factor = models.IntegerField()
|
||||
|
||||
|
||||
|
||||
#################
|
||||
# STAT MODELS #
|
||||
#################
|
||||
|
||||
class Stat(HasName, HasDamageClass):
|
||||
|
||||
is_battle_only = models.BooleanField(default = False)
|
||||
|
||||
game_index = models.IntegerField()
|
||||
|
||||
|
||||
class StatName(IsName, HasStat):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
###########################
|
||||
# CHARACTERISTIC MODELS #
|
||||
###########################
|
||||
|
||||
class Characteristic(HasStat):
|
||||
|
||||
gene_mod_5 = models.IntegerField()
|
||||
|
||||
|
||||
class CharacteristicDescription(HasCharacteristic, HasLanguage):
|
||||
|
||||
description = models.CharField(max_length = 60)
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# EGG GROUP MODELS #
|
||||
######################
|
||||
|
||||
class EggGroup(HasName):
|
||||
pass
|
||||
|
||||
|
||||
class EggGroupName(IsName, HasEggGroup):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
########################
|
||||
# GROWTH RATE MODELS #
|
||||
########################
|
||||
|
||||
class GrowthRate(HasName):
|
||||
|
||||
formula = models.CharField(max_length = 500)
|
||||
|
||||
|
||||
class GrowthRateDescription(HasName, HasLanguage, HasGrowthRate):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
###################
|
||||
# NATURE MODELS #
|
||||
###################
|
||||
|
||||
class Nature(HasName):
|
||||
|
||||
decreased_stat_id = models.ForeignKey(Stat, blank = True, null = True, related_name = 'decreased')
|
||||
|
||||
increased_stat_id = models.ForeignKey(Stat, blank = True, null = True, related_name = 'increased')
|
||||
|
||||
hates_flavor_id = models.IntegerField()
|
||||
|
||||
likes_flavor_id = models.IntegerField()
|
||||
|
||||
game_index = models.IntegerField()
|
||||
|
||||
|
||||
class NatureName(IsName, HasNature):
|
||||
pass
|
||||
|
||||
|
||||
class NaturePokeathlonStat(HasNature):
|
||||
|
||||
pokeathlon_stat_id = models.ForeignKey(Stat, blank = True, null = True)
|
||||
|
||||
max_change = models.IntegerField()
|
||||
|
||||
|
||||
class NatureBattleStylePreference(HasNature):
|
||||
|
||||
move_battle_style_id = models.IntegerField()
|
||||
|
||||
low_hp_preference = models.IntegerField()
|
||||
|
||||
high_hp_preference = models.IntegerField()
|
||||
|
|
Loading…
Reference in a new issue