Move Models

Created models for all move related models and added build steps for
each
This commit is contained in:
Zane Adickes 2015-04-09 00:45:23 -04:00
parent 5d5914fb2e
commit b6b6ff0938
4 changed files with 1938 additions and 497 deletions

View file

@ -18,6 +18,14 @@ def clearTable(model):
print str(model)
model.objects.all().delete()
def parseNumber(num):
try:
result = int(num)
except ValueError:
result = ''
return result
##############
# LANGUAGE #
@ -48,7 +56,7 @@ for index, info in enumerate(data):
if index > 0:
languageName = LanguageName (
language = Language.objects.filter(id = int(info[0]))[0],
language = Language.objects.get(id = int(info[0])),
local_language_id = int(info[1]),
name = info[2]
)
@ -81,8 +89,8 @@ for index, info in enumerate(data):
if index > 0:
generationName = GenerationName (
generation = Generation.objects.filter(id = int(info[0]))[0],
language = Language.objects.filter(id = int(info[1]))[0],
generation = Generation.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
generationName.save()
@ -102,7 +110,7 @@ for index, info in enumerate(data):
versionGroup = VersionGroup (
id = int(info[0]),
name = info[1],
generation = Generation.objects.filter(id = int(info[2]))[0],
generation = Generation.objects.get(id = int(info[2])),
order = int(info[3])
)
versionGroup.save()
@ -115,7 +123,7 @@ for index, info in enumerate(data):
if index > 0:
versionGroupRegion = VersionGroupRegion (
version_group = VersionGroup.objects.filter(id = int(info[0]))[0],
version_group = VersionGroup.objects.get(id = int(info[0])),
region_id = int(info[1])
)
versionGroupRegion.save()
@ -129,7 +137,7 @@ for index, info in enumerate(data):
version = Version (
id = int(info[0]),
version_group = VersionGroup.objects.filter(id = int(info[1]))[0],
version_group = VersionGroup.objects.get(id = int(info[1])),
name = info[2]
)
version.save()
@ -142,14 +150,45 @@ for index, info in enumerate(data):
if index > 0:
versionName = VersionName (
version = Version.objects.filter(id = int(info[0]))[0],
language = Language.objects.filter(id = int(info[1]))[0],
version = Version.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
versionName.save()
# ##################
# # DAMAGE CLASS #
# ##################
clearTable(MoveDamageClass)
data = loadData('move_damage_classes.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveDamageClass (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveDamageClassDescription)
data = loadData('move_damage_class_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveDamageClassDescription (
move_damage_class = MoveDamageClass.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
description = info[2]
)
model.save()
###########
# STATS #
###########
@ -162,10 +201,10 @@ for index, info in enumerate(data):
stat = Stat (
id = int(info[0]),
damage_class_id = int(info[3]) if info[3] else 0,
move_damage_class = MoveDamageClass.objects.get(id = int(info[1])) if info[1] != '' else None,
name = info[2],
is_battle_only = bool(info[3]),
game_index = int(info[3]) if info[3] else 0,
game_index = int(info[4]) if info[4] else 0,
)
stat.save()
@ -177,8 +216,8 @@ 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],
stat = Stat.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
statName.save()
@ -198,7 +237,7 @@ for index, info in enumerate(data):
ability = Ability (
id = int(info[0]),
name = info[1],
generation = Generation.objects.filter(id = int(info[2]))[0],
generation = Generation.objects.get(id = int(info[2])),
is_main_series = bool(info[3])
)
ability.save()
@ -211,8 +250,8 @@ for index, info in enumerate(data):
if index > 0:
abilityName = AbilityName (
ability = Ability.objects.filter(id = int(info[0]))[0],
language = Language.objects.filter(id = int(info[1]))[0],
ability = Ability.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
abilityName.save()
@ -225,8 +264,8 @@ for index, info in enumerate(data):
if index > 0:
abilityDesc = AbilityDescription (
ability = Ability.objects.filter(id = int(info[0]))[0],
language = Language.objects.filter(id = int(info[1]))[0],
ability = Ability.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
short_effect = info[2],
effect = info[3]
)
@ -240,10 +279,10 @@ for index, info in enumerate(data):
if index > 0:
abilityFlavorText = AbilityFlavorText (
ability = Ability.objects.filter(id = int(info[0]))[0],
version_group = VersionGroup.objects.filter(id = int(info[1]))[0],
language = Language.objects.filter(id = int(info[2]))[0],
flavor_text = info[2]
ability = Ability.objects.get(id = int(info[0])),
version_group = VersionGroup.objects.get(id = int(info[1])),
language = Language.objects.get(id = int(info[2])),
flavor_text = info[3]
)
abilityFlavorText.save()
@ -261,7 +300,7 @@ for index, info in enumerate(data):
model = Characteristic (
id = int(info[0]),
stat = Stat.objects.filter(id = int(info[1]))[0],
stat = Stat.objects.get(id = int(info[1])),
gene_mod_5 = int(info[2])
)
model.save()
@ -274,8 +313,8 @@ 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],
characteristic = Characteristic.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
description = info[2]
)
model.save()
@ -306,8 +345,8 @@ 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],
egg_group = EggGroup.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
model.save()
@ -339,16 +378,16 @@ 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]
growth_rate = GrowthRate.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
description = info[2]
)
model.save()
############
# Nature #
# NATURE #
############
clearTable(Nature)
@ -360,8 +399,8 @@ for index, info in enumerate(data):
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],
decreased_stat_id = Stat.objects.get(id = int(info[2])),
increased_stat_id = Stat.objects.get(id = int(info[3])),
hates_flavor_id = info[4],
likes_flavor_id = info[5],
game_index = info[6]
@ -376,8 +415,8 @@ 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],
nature = Nature.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
natureName.save()
@ -390,8 +429,8 @@ 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],
nature = Nature.objects.get(id = int(info[0])),
pokeathlon_stat_id = Stat.objects.get(id = int(info[1])),
max_change = info[2]
)
naturePokeathlonStat.save()
@ -404,7 +443,7 @@ for index, info in enumerate(data):
if index > 0:
model = NatureBattleStylePreference (
nature = Nature.objects.filter(id = int(info[0]))[0],
nature = Nature.objects.get(id = int(info[0])),
move_battle_style_id = int(info[1]),
low_hp_preference = info[2],
high_hp_preference = info[3]
@ -426,8 +465,8 @@ for index, info in enumerate(data):
type = Type (
id = int(info[0]),
name = info[1],
generation = Generation.objects.filter(id = int(info[2]))[0],
damage_class_id = int(info[3]) if info[3] else 0
generation = Generation.objects.get(id = int(info[2])),
move_damage_class = MoveDamageClass.objects.get(id = int(info[3])) if info[3] != '' else None
)
type.save()
@ -439,8 +478,8 @@ for index, info in enumerate(data):
if index > 0:
typeName = TypeName (
type = Type.objects.filter(id = int(info[0]))[0],
language = Language.objects.filter(id = int(info[1]))[0],
type = Type.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
typeName.save()
@ -453,8 +492,8 @@ for index, info in enumerate(data):
if index > 0:
typeGameIndex = TypeGameIndex (
type = Type.objects.filter(id = int(info[0]))[0],
generation = Generation.objects.filter(id = int(info[1]))[0],
type = Type.objects.get(id = int(info[0])),
generation = Generation.objects.get(id = int(info[1])),
game_index = int(info[2])
)
typeGameIndex.save()
@ -472,3 +511,340 @@ for index, info in enumerate(data):
damage_factor = int(info[2])
)
typeEfficacy.save()
# ###########
# # MOVES #
# ###########
clearTable(MoveEffect)
data = loadData('move_effects.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffect (
id = int(info[0])
)
model.save()
clearTable(MoveEffectDescription)
data = loadData('move_effect_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffectDescription (
move_effect = MoveEffect.objects.get(id = int(info[1])),
language = Language.objects.get(id = int(info[1])),
short_effect = info[2],
effect = info[3]
)
model.save()
clearTable(MoveEffectChange)
data = loadData('move_effect_changelog.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffectChange (
id = int(info[0]),
move_effect = MoveEffect.objects.get(id = int(info[1])),
version_group = VersionGroup.objects.get(id = int(info[2]))
)
model.save()
clearTable(MoveEffectChangeDescription)
data = loadData('move_effect_changelog_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveEffectChangeDescription (
move_effect_change = MoveEffectChange.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
effect = info[2]
)
model.save()
clearTable(MoveTarget)
data = loadData('move_targets.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveTarget (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveTargetDescription)
data = loadData('move_target_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveTargetDescription (
move_target = MoveTarget.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2],
description = info[3]
)
model.save()
clearTable(Move)
data = loadData('moves.csv')
for index, info in enumerate(data):
if index > 0:
model = Move (
id = int(info[0]),
name = info[1],
generation = Generation.objects.get(id = int(info[2])),
type = Type.objects.get(id = int(info[3])),
power = int(info[4]) if info[4] != '' else None,
pp = int(info[5]) if info[5] != '' else None,
accuracy = int(info[6]) if info[6] != '' else None,
priority = int(info[7]) if info[7] != '' else None,
move_target = MoveTarget.objects.get(id = int(info[8])),
move_damage_class = MoveDamageClass.objects.get(id = int(info[9])),
move_effect = MoveEffect.objects.get(id = int(info[10])),
move_effect_chance = int(info[11]) if info[11] != '' else None,
contest_type_id = int(info[12]) if info[12] != '' else None,
contest_effect_id = int(info[13]) if info[13] != '' else None,
super_contest_effect_id = int(info[14]) if info[14] != '' else None
)
model.save()
clearTable(MoveName)
data = loadData('move_names.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveName (
move = Move.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
model.save()
clearTable(MoveFlavorText)
data = loadData('move_flavor_text.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlavorText (
move = Move.objects.get(id = int(info[0])),
version_group = VersionGroup.objects.get(id = int(info[1])),
language = Language.objects.get(id = int(info[2])),
flavor_text = info[3]
)
model.save()
clearTable(MoveChange)
data = loadData('move_changelog.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveChange (
move = Move.objects.get(id = int(info[0])),
version_group = VersionGroup.objects.get(id = int(info[1])),
type = Type.objects.get(id = int(info[2])) if info[2] != '' else None,
power = int(info[3]) if info[3] != '' else None,
pp = int(info[4]) if info[4] != '' else None,
accuracy = int(info[5]) if info[5] != '' else None,
move_effect = MoveEffect.objects.get(id = int(info[6])) if info[6] != '' else None,
move_effect_chance = int(info[7]) if info[7] != '' else None
)
model.save()
clearTable(MoveBattleStyle)
data = loadData('move_battle_styles.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveBattleStyle (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveBattleStyleName)
data = loadData('move_battle_style_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveBattleStyleName (
move_battle_style = MoveBattleStyle.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
model.save()
clearTable(MoveFlag)
data = loadData('move_flags.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlag (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveFlagMap)
data = loadData('move_flag_map.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlagMap (
move = Move.objects.get(id = int(info[0])),
move_flag = MoveFlag.objects.get(id = int(info[1])),
)
model.save()
clearTable(MoveFlagDescription)
data = loadData('move_flag_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveFlagDescription (
move_flag = MoveFlag.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2],
description = info[3]
)
model.save()
clearTable(MoveMetaAilment)
data = loadData('move_meta_ailments.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaAilment (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveMetaAilmentName)
data = loadData('move_meta_ailment_names.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaAilmentName (
move_meta_ailment = MoveMetaAilment.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
name = info[2]
)
model.save()
clearTable(MoveMetaCategory)
data = loadData('move_meta_categories.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaCategory (
id = int(info[0]),
name = info[1]
)
model.save()
clearTable(MoveMetaCategoryDescription)
data = loadData('move_meta_category_prose.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaCategoryDescription (
move_meta_category = MoveMetaCategory.objects.get(id = int(info[0])),
language = Language.objects.get(id = int(info[1])),
description = info[2]
)
model.save()
clearTable(MoveMeta)
data = loadData('move_meta.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMeta (
move = Move.objects.get(id = int(info[0])),
move_meta_category = MoveMetaCategory.objects.get(id = int(info[1])),
move_meta_ailment = MoveMetaAilment.objects.get(id = int(info[2])),
min_hits = int(info[3]) if info[3] != '' else None,
max_hits = int(info[4]) if info[4] != '' else None,
min_turns = int(info[5]) if info[5] != '' else None,
max_turns = int(info[6]) if info[6] != '' else None,
drain = int(info[7]) if info[7] != '' else None,
healing = int(info[8]) if info[8] != '' else None,
crit_rate = int(info[9]) if info[9] != '' else None,
ailment_chance = int(info[10]) if info[10] != '' else None,
flinch_chance = int(info[11]) if info[11] != '' else None,
stat_chance = int(info[12]) if info[12] != '' else None,
)
model.save()
clearTable(MoveMetaStatChange)
data = loadData('move_meta_stat_changes.csv')
for index, info in enumerate(data):
if index > 0:
model = MoveMetaStatChange (
move = Move.objects.get(id = int(info[0])),
stat = Stat.objects.get(id = int(info[1])),
change = int(info[2])
)
model.save()

View file

@ -1,431 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Language',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('iso639', models.CharField(max_length=2)),
('iso3166', models.CharField(max_length=2)),
('name', models.CharField(max_length=10)),
('official', models.BooleanField()),
('order', models.IntegerField()),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='LanguageName',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('local_language_id', models.IntegerField()),
('name', models.CharField(max_length=30)),
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Generation',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('main_region_id', models.IntegerField()),
('name', models.CharField(max_length=30)),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='GenerationName',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=30)),
('generation', models.ForeignKey(blank=True, to='pokemon_v2.Generation', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Ability',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=30)),
('is_main_series', models.BooleanField(default=False)),
('generation', models.ForeignKey(blank=True, to='pokemon_v2.Generation', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AbilityDescription',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('short_effect', models.CharField(max_length=300)),
('effect', models.CharField(max_length=2000)),
('ability', models.ForeignKey(blank=True, to='pokemon_v2.Ability', null=True)),
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AbilityFlavorText',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('flavor_text', models.CharField(max_length=100)),
('ability', models.ForeignKey(blank=True, to='pokemon_v2.Ability', null=True)),
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='AbilityName',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=30)),
('ability', models.ForeignKey(blank=True, to='pokemon_v2.Ability', null=True)),
('language', models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='Version',
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='VersionGroup',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=30)),
('order', models.IntegerField()),
('generation', models.ForeignKey(blank=True, to='pokemon_v2.Generation', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='VersionGroupPokemonMoveMethod',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('pokemon_move_method_id', models.IntegerField()),
('version_group', models.ForeignKey(blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='VersionGroupRegion',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('region_id', models.IntegerField()),
('version_group', models.ForeignKey(blank=True, to='pokemon_v2.VersionGroup', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='VersionName',
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)),
('version', models.ForeignKey(blank=True, to='pokemon_v2.Version', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.AddField(
model_name='version',
name='version_group',
field=models.ForeignKey(blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='abilityflavortext',
name='version_group',
field=models.ForeignKey(blank=True, to='pokemon_v2.VersionGroup', null=True),
preserve_default=True,
),
migrations.AddField(
model_name='generationname',
name='language',
field=models.ForeignKey(blank=True, to='pokemon_v2.Language', null=True),
preserve_default=True,
),
migrations.AlterField(
model_name='language',
name='name',
field=models.CharField(max_length=30),
preserve_default=True,
),
migrations.AlterField(
model_name='language',
name='official',
field=models.BooleanField(default=False),
preserve_default=True,
),
migrations.CreateModel(
name='Type',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=30)),
('damage_class_id', models.IntegerField()),
('generation', models.ForeignKey(blank=True, to='pokemon_v2.Generation', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TypeGameIndex',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('game_index', models.IntegerField()),
('generation', models.ForeignKey(blank=True, to='pokemon_v2.Generation', null=True)),
('type', models.ForeignKey(blank=True, to='pokemon_v2.Type', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TypeName',
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)),
('type', models.ForeignKey(blank=True, to='pokemon_v2.Type', null=True)),
],
options={
'abstract': False,
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TypeEfficacy',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('damage_type_id', models.IntegerField()),
('target_type_id', models.IntegerField()),
('damage_factor', models.IntegerField()),
],
options={
},
bases=(models.Model,),
),
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='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='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,
),
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.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.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,),
),
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,),
),
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,),
),
]

File diff suppressed because it is too large Load diff

View file

@ -13,6 +13,7 @@ class HasAbility(models.Model):
class Meta:
abstract = True
class HasCharacteristic(models.Model):
characteristic = models.ForeignKey('Characteristic', blank=True, null=True)
@ -20,13 +21,15 @@ class HasCharacteristic(models.Model):
class Meta:
abstract = True
class HasDamageClass(models.Model):
damage_class_id = models.IntegerField(blank = True, null = True)
class HasDescription(models.Model):
description = models.CharField(max_length=200, default='')
class Meta:
abstract = True
class HasEggGroup(models.Model):
egg_group = models.ForeignKey('EggGroup', blank=True, null=True)
@ -34,6 +37,23 @@ class HasEggGroup(models.Model):
class Meta:
abstract = True
class HasFlavorText(models.Model):
flavor_text = models.CharField(max_length=200)
class Meta:
abstract = True
class HasGameIndex(models.Model):
game_index = models.IntegerField()
class Meta:
abstract = True
class HasGeneration(models.Model):
generation = models.ForeignKey('Generation', blank=True, null=True)
@ -41,6 +61,7 @@ class HasGeneration(models.Model):
class Meta:
abstract = True
class HasGrowthRate(models.Model):
growth_rate = models.ForeignKey('GrowthRate', blank=True, null=True)
@ -48,6 +69,7 @@ class HasGrowthRate(models.Model):
class Meta:
abstract = True
class HasLanguage(models.Model):
language = models.ForeignKey('Language', blank = True, null = True)
@ -55,13 +77,71 @@ class HasLanguage(models.Model):
class Meta:
abstract = True
class HasName(models.Model):
name = models.CharField(max_length=30)
class HasMetaAilment(models.Model):
move_meta_ailment = models.ForeignKey('MoveMetaAilment', blank = True, null = True)
class Meta:
abstract = True
class HasMetaCategory(models.Model):
move_meta_category = models.ForeignKey('MoveMetaCategory', blank = True, null = True)
class Meta:
abstract = True
class HasMove(models.Model):
move = models.ForeignKey('Move', blank = True, null = True)
class Meta:
abstract = True
class HasMoveDamageClass(models.Model):
move_damage_class = models.ForeignKey('MoveDamageClass', blank = True, null = True)
class Meta:
abstract = True
class HasMoveEffect(models.Model):
move_effect = models.ForeignKey('MoveEffect', blank = True, null = True)
class Meta:
abstract = True
class HasMoveFlag(models.Model):
move_flag = models.ForeignKey('MoveFlag', blank = True, null = True)
class Meta:
abstract = True
class HasMoveTarget(models.Model):
move_target = models.ForeignKey('MoveTarget', blank = True, null = True)
class Meta:
abstract = True
class HasName(models.Model):
name = models.CharField(max_length=100)
class Meta:
abstract = True
class HasNature(models.Model):
nature = models.ForeignKey('Nature', blank=True, null=True)
@ -69,6 +149,7 @@ class HasNature(models.Model):
class Meta:
abstract = True
class HasOrder(models.Model):
order = models.IntegerField()
@ -76,6 +157,7 @@ class HasOrder(models.Model):
class Meta:
abstract = True
class HasStat(models.Model):
stat = models.ForeignKey('Stat', blank=True, null=True)
@ -83,6 +165,7 @@ class HasStat(models.Model):
class Meta:
abstract = True
class HasType(models.Model):
type = models.ForeignKey('Type', blank=True, null=True)
@ -90,6 +173,7 @@ class HasType(models.Model):
class Meta:
abstract = True
class HasVersionGroup(models.Model):
version_group = models.ForeignKey('VersionGroup', blank=True, null=True)
@ -97,12 +181,41 @@ class HasVersionGroup(models.Model):
class Meta:
abstract = True
class IsName(HasLanguage, HasName):
class Meta:
abstract = True
class IsDescription(HasLanguage, HasDescription):
class Meta:
abstract = True
class IsEffectDescription(HasLanguage):
short_effect = models.CharField(max_length=300)
effect = models.CharField(max_length=4000)
class Meta:
abstract = True
class IsName(HasLanguage, HasName):
class Meta:
abstract = True
class IsFlavorText(HasLanguage, HasFlavorText):
class Meta:
abstract = True
####################
# VERSION MODELS #
####################
@ -172,16 +285,12 @@ class Ability(HasName, HasGeneration):
is_main_series = models.BooleanField(default = False)
class AbilityDescription(HasLanguage, HasAbility):
short_effect = models.CharField(max_length=300)
effect = models.CharField(max_length=2000)
class AbilityDescription(IsEffectDescription, HasAbility):
pass
class AbilityFlavorText(HasLanguage, HasAbility, HasVersionGroup):
flavor_text = models.CharField(max_length=100)
class AbilityFlavorText(IsFlavorText, HasAbility, HasVersionGroup):
pass
class AbilityName(IsName, HasAbility):
@ -193,18 +302,16 @@ class AbilityName(IsName, HasAbility):
# TYPE MODELS #
#################
class Type(HasName, HasGeneration):
damage_class_id = models.IntegerField(blank = True, null = True)
class Type(HasName, HasGeneration, HasMoveDamageClass):
pass
class TypeName(IsName, HasType):
pass
class TypeGameIndex(HasType, HasGeneration):
game_index = models.IntegerField()
class TypeGameIndex(HasType, HasGeneration, HasGameIndex):
pass
class TypeEfficacy(models.Model):
@ -221,7 +328,7 @@ class TypeEfficacy(models.Model):
# STAT MODELS #
#################
class Stat(HasName, HasDamageClass):
class Stat(HasName, HasMoveDamageClass):
is_battle_only = models.BooleanField(default = False)
@ -242,9 +349,8 @@ class Characteristic(HasStat):
gene_mod_5 = models.IntegerField()
class CharacteristicDescription(HasCharacteristic, HasLanguage):
description = models.CharField(max_length = 60)
class CharacteristicDescription(HasCharacteristic, IsDescription):
pass
@ -270,7 +376,7 @@ class GrowthRate(HasName):
formula = models.CharField(max_length = 500)
class GrowthRateDescription(HasName, HasLanguage, HasGrowthRate):
class GrowthRateDescription(HasGrowthRate, IsDescription):
pass
@ -310,3 +416,176 @@ class NatureBattleStylePreference(HasNature):
low_hp_preference = models.IntegerField()
high_hp_preference = models.IntegerField()
#################
# MOVE MODELS #
#################
class Move(HasName, HasGeneration, HasType, HasMoveDamageClass, HasMoveEffect, HasMoveTarget):
power = models.IntegerField(blank = True, null = True)
pp = models.IntegerField(blank = True, null = True)
accuracy = models.IntegerField(blank = True, null = True)
priority = models.IntegerField(blank = True, null = True)
move_effect_chance = models.IntegerField(blank = True, null = True)
contest_type_id = models.IntegerField(blank = True, null = True)
contest_effect_id = models.IntegerField(blank = True, null = True)
super_contest_effect_id = models.IntegerField(blank = True, null = True)
class MoveName(HasMove, IsName):
pass
class MoveFlavorText(HasMove, HasVersionGroup, IsFlavorText):
pass
class MoveChange(HasMove, HasVersionGroup, HasType, HasMoveEffect):
power = models.IntegerField(blank = True, null = True)
pp = models.IntegerField(blank = True, null = True)
accuracy = models.IntegerField(blank = True, null = True)
move_effect_chance = models.IntegerField(blank = True, null = True)
##############################
# MOVE DAMAGE CLASS MODELS #
##############################
class MoveDamageClass(HasName):
pass
class MoveDamageClassDescription(HasMoveDamageClass, IsDescription, HasName):
pass
##############################
# MOVE BATTLE STYLE MODELS #
##############################
class MoveBattleStyle(HasName):
pass
class MoveBattleStyleName(IsName):
move_battle_style = models.ForeignKey(MoveBattleStyle, blank = True, null = True)
########################
# MOVE EFFECT MODELS #
########################
class MoveEffect(models.Model):
pass
class MoveEffectDescription(HasMoveEffect, IsEffectDescription):
pass
class MoveEffectChange(HasMoveEffect, HasVersionGroup):
pass
class MoveEffectChangeDescription(HasLanguage):
move_effect_change = models.ForeignKey('MoveEffectChange', blank = True, null = True)
effect = models.CharField(max_length=2000)
######################
# MOVE FLAG MODELS #
######################
class MoveFlag(HasName):
pass
class MoveFlagDescription(HasMoveFlag, HasName, IsDescription):
pass
class MoveFlagMap(HasMove, HasMoveFlag):
pass
########################
# MOVE TARGET MODELS #
########################
class MoveTarget(HasName):
pass
class MoveTargetDescription(HasMoveTarget, IsDescription, HasName):
pass
######################
# MOVE META MODELS #
######################
class MoveMeta(HasMove, HasMetaAilment, HasMetaCategory):
min_hits = models.IntegerField(blank = True, null = True)
max_hits = models.IntegerField(blank = True, null = True)
min_turns = models.IntegerField(blank = True, null = True)
max_turns = models.IntegerField(blank = True, null = True)
drain = models.IntegerField(blank = True, null = True)
healing = models.IntegerField(blank = True, null = True)
crit_rate = models.IntegerField(blank = True, null = True)
ailment_chance = models.IntegerField(blank = True, null = True)
flinch_chance = models.IntegerField(blank = True, null = True)
stat_chance = models.IntegerField(blank = True, null = True)
class MoveMetaAilment(HasName):
pass
class MoveMetaAilmentName(HasMetaAilment, IsName):
pass
class MoveMetaCategory(HasName):
pass
class MoveMetaCategoryDescription(HasMetaCategory, IsDescription):
pass
class MoveMetaStatChange(HasMove, HasStat):
change = models.IntegerField()