diff --git a/openapi.yml b/openapi.yml index 88da3f160..32bd6ec1f 100644 --- a/openapi.yml +++ b/openapi.yml @@ -3193,8 +3193,8 @@ components: description: Whether or not this a hidden ability for the referenced Pokémon. slot: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 3 + minimum: 1 description: Pokémon have 3 ability 'slots' which hold references to possible abilities they could have. This is the slot of this ability for the referenced pokemon. @@ -3235,46 +3235,46 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: Time it takes the tree to grow one stage, in hours. Berry trees go through four of these growth stages before they can be picked. max_harvest: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 15 + minimum: 0 description: The maximum number of these berries that can grow on one tree in Generation IV. natural_gift_power: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The power of the move "Natural Gift" when used with this Berry. size: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The size of this Berry, in millimeters. smoothness: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 60 + minimum: 20 description: The smoothness of this Berry, used in making Pokéblocks or Poffins. soil_dryness: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 35 + minimum: 4 description: The speed at which this Berry dries out the soil as it grows. A higher rate means the soil dries more quickly. firmness: @@ -3368,8 +3368,8 @@ components: properties: potency: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: How powerful the referenced flavor is for this berry. berry: allOf: @@ -3416,8 +3416,8 @@ components: properties: potency: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: How powerful the referenced flavor is for this berry. flavor: allOf: @@ -3537,13 +3537,13 @@ components: description: The identifier for this resource. appeal: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The base number of hearts the user of this move gets. jam: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The base number of hearts the user's opponent loses. effect_entries: type: array @@ -3900,8 +3900,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: -1 description: A good value for sorting. names: type: array @@ -3949,8 +3949,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 31 + minimum: 0 description: The minimum number of perfect IVs, or null if unspecified. always_shiny: type: boolean @@ -4196,13 +4196,13 @@ components: properties: level: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: 1 description: The level gained. experience: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The amount of experience required to reach the referenced level. required: - experience @@ -4584,8 +4584,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 130 + minimum: 0 description: The power of the move Fling when used with this item. fling_effect: oneOf: @@ -4776,7 +4776,7 @@ components: game_index: type: integer maximum: 2147483647 - minimum: -2147483648 + minimum: 0 description: The internal id of an API resource within game data. generation: allOf: @@ -4877,16 +4877,16 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The purchase price in this currency and version group, or null if unavailable. sell_price: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The sell price in this currency and version group, or null if unavailable. currency: @@ -5005,7 +5005,7 @@ components: game_index: type: integer maximum: 2147483647 - minimum: -2147483648 + minimum: 0 description: The internal id of an API resource within game data. encounter_method_rates: type: array @@ -5216,7 +5216,7 @@ components: game_index: type: integer maximum: 2147483647 - minimum: -2147483648 + minimum: 0 description: The internal id of an API resource within game data. generation: allOf: @@ -5345,23 +5345,23 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: 0 description: The percent value of how likely this move is to be successful. power: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 250 + minimum: 0 description: The base power before the listed version group, or null if power did not change. pp: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 40 + minimum: 0 description: Power points. The number of times this move can be used. effect_chance: type: @@ -5518,8 +5518,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: 0 description: The percent value of how likely this move is to be successful. effect_chance: type: @@ -5531,15 +5531,15 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 40 + minimum: 0 description: Power points. The number of times this move can be used. priority: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 8 + minimum: -8 description: A value between -8 and 8. Sets the order in which moves are executed during battle. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Priority) for greater detail. @@ -5547,8 +5547,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 250 + minimum: 0 description: The base power of this move, or null if it has no fixed base power. contest_combos: @@ -5834,78 +5834,78 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 5 + minimum: 1 description: The minimum number of times this move hits. Null if it always only hits once. max_hits: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 5 + minimum: 1 description: The maximum number of times this move hits. Null if it always only hits once. min_turns: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 10 + minimum: 1 description: The minimum number of turns this move continues to take effect. Null if it always only lasts one turn. max_turns: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 10 + minimum: 1 description: The maximum number of turns this move continues to take effect. Null if it always only lasts one turn. drain: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: -100 description: HP drain (if positive) or Recoil damage (if negative), in percent of damage done. healing: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: -100 description: The amount of hp gained by the attacking Pokemon, in percent of it's maximum HP. crit_rate: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 8 + minimum: 0 description: Critical hit rate bonus. ailment_chance: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: 0 description: The likelihood this attack will cause an ailment. flinch_chance: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: 0 description: The likelihood this attack will cause the target Pokémon to flinch. stat_chance: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: 0 description: The likelihood this attack will cause a stat change in the target Pokémon. required: @@ -6030,8 +6030,8 @@ components: properties: change: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 6 + minimum: -6 description: The amount of change. stat: allOf: @@ -6059,8 +6059,8 @@ components: properties: change: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 6 + minimum: -6 description: The maximum amount of change to the referenced stat. move: allOf: @@ -6167,13 +6167,13 @@ components: properties: low_hp_preference: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: 0 description: Chance of using the move, in percent, if HP is under one half. high_hp_preference: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: 0 description: Chance of using the move, in percent, if HP is over one half. move_battle_style: allOf: @@ -6263,8 +6263,8 @@ components: properties: max_change: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 2 + minimum: -2 description: The amount of change. pokeathlon_stat: allOf: @@ -7903,14 +7903,14 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The base score given to the player when this Pokémon is caught during a pal park run. rate: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The base rate for encountering this Pokémon in this pal park area. pokemon_species: @@ -7947,8 +7947,8 @@ components: properties: max_change: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 2 + minimum: -2 description: The maximum amount of change to the referenced Pokéathlon stat. nature: allOf: @@ -8135,8 +8135,8 @@ components: description: Whether or not this is a hidden ability. slot: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 3 + minimum: 1 description: The slot this ability occupies in this Pokémon species. ability: allOf: @@ -8153,8 +8153,8 @@ components: description: Whether or not this is a hidden ability. slot: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 3 + minimum: 1 description: The slot this ability occupies in this Pokémon species. ability: oneOf: @@ -8252,15 +8252,15 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The base experience gained for defeating this Pokémon. height: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The height of this Pokémon in decimetres. is_default: type: boolean @@ -8269,16 +8269,16 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: -1 description: Order for sorting. Almost national order, except families are grouped together. weight: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The weight of this Pokémon in hectograms. abilities: type: array @@ -8531,32 +8531,32 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 100 + minimum: 1 description: The minimum required level of the evolving Pokémon species to evolve into this Pokémon species. min_happiness: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 255 + minimum: 0 description: The minimum required level of happiness the evolving Pokémon species to evolve into this Pokémon species. min_beauty: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 255 + minimum: 0 description: The minimum required level of beauty the evolving Pokémon species to evolve into this Pokémon species. min_affection: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 255 + minimum: 0 description: The minimum required level of affection the evolving Pokémon species to evolve into this Pokémon species. near_special_rock: @@ -8588,8 +8588,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 1 + minimum: -1 description: The required relation between the Pokémon's Attack and Defense stats. 1 means Attack > Defense. 0 means Attack = Defense. -1 means Attack < Defense. @@ -8632,24 +8632,24 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The minimum number of times a move must be used in order to evolve into this Pokémon species. min_steps: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The minimum number of steps that must be taken in order to evolve into this Pokémon species. min_damage_taken: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The minimum amount of damage taken during the evolution trigger event in order to evolve into this Pokémon species. allowed_natures: @@ -8699,8 +8699,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: -1 description: The order in which forms should be sorted within all forms. Multiple forms may have equal order, in which case they should fall back on sorting by name. @@ -8708,8 +8708,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The order in which forms should be sorted within a species' forms. is_default: @@ -8929,8 +8929,8 @@ components: properties: slot: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 2 + minimum: 1 description: The order the Pokémon's types are listed in. type: allOf: @@ -8945,7 +8945,7 @@ components: game_index: type: integer maximum: 2147483647 - minimum: -2147483648 + minimum: 0 description: The internal id of an API resource within game data. version: allOf: @@ -9255,32 +9255,32 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: -1 description: The order in which species should be sorted. Based on National Dex order, except families are grouped together and sorted by stage. gender_rate: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 8 + minimum: -1 description: The chance of this Pokémon being female, in eighths; or -1 for genderless. capture_rate: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 255 + minimum: 0 description: The base capture rate; up to 255. The higher the number, the easier the catch. base_happiness: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 255 + minimum: 0 description: The happiness when caught by a normal Pokéball; up to 255. The higher the number, the happier the Pokémon. is_baby: @@ -9296,8 +9296,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 255 + minimum: 0 description: 'Initial hatch counter: one must walk Y × (hatch_counter + 1) steps before this Pokémon''s egg hatches, unless utilizing bonuses like Flame Body''s. Y varies per generation. In Generations II, III, and @@ -9470,14 +9470,14 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The base score given to the player when the referenced Pokémon is caught during a pal park run. rate: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The base rate for encountering the referenced Pokémon in this pal park area. area: @@ -9738,13 +9738,13 @@ components: properties: base_stat: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 255 + minimum: 1 description: The base value of the stat. effort: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 255 + minimum: 0 description: The effort points (EV) the Pokémon has in the stat. stat: allOf: @@ -9774,8 +9774,8 @@ components: properties: slot: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 2 + minimum: 1 description: The order the Pokémon's types are listed in. type: allOf: @@ -9907,8 +9907,8 @@ components: maxLength: 200 game_index: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: ID the games use for this stat. is_battle_only: type: boolean @@ -9995,8 +9995,8 @@ components: description: The identifier for this resource. appeal: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: 0 description: The level of appeal this super contest effect has. flavor_text_entries: type: array @@ -10126,7 +10126,7 @@ components: game_index: type: integer maximum: 2147483647 - minimum: -2147483648 + minimum: 0 description: The internal id of an API resource within game data. generation: allOf: @@ -10184,8 +10184,8 @@ components: properties: slot: type: integer - maximum: 2147483647 - minimum: -2147483648 + maximum: 2 + minimum: 1 description: The order the Pokémon's types are listed in. pokemon: allOf: @@ -10294,8 +10294,8 @@ components: type: - integer - 'null' - maximum: 2147483647 - minimum: -2147483648 + maximum: 32767 + minimum: -1 description: Order for sorting. Almost by date of release, except similar versions are grouped together. generation: diff --git a/pokemon_v2/migrations/0038_alter_berry_growth_time_alter_berry_max_harvest_and_more.py b/pokemon_v2/migrations/0038_alter_berry_growth_time_alter_berry_max_harvest_and_more.py new file mode 100644 index 000000000..baa8e59de --- /dev/null +++ b/pokemon_v2/migrations/0038_alter_berry_growth_time_alter_berry_max_harvest_and_more.py @@ -0,0 +1,708 @@ +# Generated by Django 5.2.10 on 2026-11-17 08:16 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("pokemon_v2", "0037_evolutionvariable_source"), + ] + + operations = [ + migrations.AlterField( + model_name="berry", + name="growth_time", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="berry", + name="max_harvest", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(15)] + ), + ), + migrations.AlterField( + model_name="berry", + name="natural_gift_power", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="berry", + name="size", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="berry", + name="smoothness", + field=models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(20), django.core.validators.MaxValueValidator(60)], + ), + ), + migrations.AlterField( + model_name="berry", + name="soil_dryness", + field=models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(4), django.core.validators.MaxValueValidator(35)], + ), + ), + migrations.AlterField( + model_name="berryflavormap", + name="potency", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="characteristic", + name="gene_mod_5", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="contesteffect", + name="appeal", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="contesteffect", + name="jam", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="encounter", + name="max_level", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="encounter", + name="min_level", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="encountermethod", + name="order", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(-1), + django.core.validators.MaxValueValidator(32767), + ], + ), + ), + migrations.AlterField( + model_name="encounterpokemondetail", + name="min_perfect_ivs", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(31)] + ), + ), + migrations.AlterField( + model_name="encounterslot", + name="rarity", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="encounterslot", + name="slot", + field=models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(12)], + ), + ), + migrations.AlterField( + model_name="experience", + name="experience", + field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="experience", + name="level", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="item", + name="fling_power", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(130)] + ), + ), + migrations.AlterField( + model_name="itemgameindex", + name="game_index", + field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(2147483647)]), + ), + migrations.AlterField( + model_name="itemprice", + name="purchase_price", + field=models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="itemprice", + name="sell_price", + field=models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="language", + name="order", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(-1), + django.core.validators.MaxValueValidator(32767), + ], + ), + ), + migrations.AlterField( + model_name="locationarea", + name="game_index", + field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(2147483647)]), + ), + migrations.AlterField( + model_name="locationareaencounterrate", + name="rate", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="locationgameindex", + name="game_index", + field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(2147483647)]), + ), + migrations.AlterField( + model_name="machine", + name="machine_number", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="move", + name="accuracy", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="move", + name="move_effect_chance", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="move", + name="power", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(250)] + ), + ), + migrations.AlterField( + model_name="move", + name="pp", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(40)] + ), + ), + migrations.AlterField( + model_name="move", + name="priority", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(-8), django.core.validators.MaxValueValidator(8)], + ), + ), + migrations.AlterField( + model_name="movechange", + name="accuracy", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="movechange", + name="move_effect_chance", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="movechange", + name="power", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(250)] + ), + ), + migrations.AlterField( + model_name="movechange", + name="pp", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(40)] + ), + ), + migrations.AlterField( + model_name="movemeta", + name="ailment_chance", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="movemeta", + name="crit_rate", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(8)] + ), + ), + migrations.AlterField( + model_name="movemeta", + name="drain", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(-100), + django.core.validators.MaxValueValidator(100), + ], + ), + ), + migrations.AlterField( + model_name="movemeta", + name="flinch_chance", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="movemeta", + name="healing", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(-100), + django.core.validators.MaxValueValidator(100), + ], + ), + ), + migrations.AlterField( + model_name="movemeta", + name="max_hits", + field=models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)], + ), + ), + migrations.AlterField( + model_name="movemeta", + name="max_turns", + field=models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(10)], + ), + ), + migrations.AlterField( + model_name="movemeta", + name="min_hits", + field=models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)], + ), + ), + migrations.AlterField( + model_name="movemeta", + name="min_turns", + field=models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(10)], + ), + ), + migrations.AlterField( + model_name="movemeta", + name="stat_chance", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="movemetastatchange", + name="change", + field=models.SmallIntegerField( + validators=[django.core.validators.MinValueValidator(-6), django.core.validators.MaxValueValidator(6)] + ), + ), + migrations.AlterField( + model_name="nature", + name="game_index", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="naturebattlestylepreference", + name="high_hp_preference", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(100)]), + ), + migrations.AlterField( + model_name="naturebattlestylepreference", + name="low_hp_preference", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(100)]), + ), + migrations.AlterField( + model_name="naturepokeathlonstat", + name="max_change", + field=models.SmallIntegerField( + validators=[django.core.validators.MinValueValidator(-2), django.core.validators.MaxValueValidator(2)] + ), + ), + migrations.AlterField( + model_name="palpark", + name="base_score", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="palpark", + name="rate", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="pokemon", + name="base_experience", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="pokemon", + name="height", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="pokemon", + name="order", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(-1), + django.core.validators.MaxValueValidator(32767), + ], + ), + ), + migrations.AlterField( + model_name="pokemon", + name="weight", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="pokemonability", + name="slot", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(3)] + ), + ), + migrations.AlterField( + model_name="pokemonabilitypast", + name="slot", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(3)] + ), + ), + migrations.AlterField( + model_name="pokemondexnumber", + name="pokedex_number", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="min_affection", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)] + ), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="min_beauty", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)] + ), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="min_damage_taken", + field=models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="min_happiness", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)] + ), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="min_level", + field=models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)], + ), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="min_move_count", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="min_steps", + field=models.PositiveIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="nature_bitmask", + field=models.PositiveIntegerField( + blank=True, help_text="25-bit bitmask of allowed nature IDs (1 << (nature_id - 1))", null=True + ), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="percentage_chance", + field=models.FloatField( + blank=True, + help_text="Percentage chance of evolution under this condition (0-100)", + null=True, + validators=[ + django.core.validators.MinValueValidator(0.0), + django.core.validators.MaxValueValidator(100.0), + ], + ), + ), + migrations.AlterField( + model_name="pokemonevolution", + name="relative_physical_stats", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(-1), django.core.validators.MaxValueValidator(1)], + ), + ), + migrations.AlterField( + model_name="pokemonform", + name="form_order", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="pokemonform", + name="order", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(-1), + django.core.validators.MaxValueValidator(32767), + ], + ), + ), + migrations.AlterField( + model_name="pokemonformgeneration", + name="game_index", + field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(2147483647)]), + ), + migrations.AlterField( + model_name="pokemonformtype", + name="slot", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(2)] + ), + ), + migrations.AlterField( + model_name="pokemongameindex", + name="game_index", + field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(2147483647)]), + ), + migrations.AlterField( + model_name="pokemonitem", + name="rarity", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(100)]), + ), + migrations.AlterField( + model_name="pokemonmove", + name="level", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100)] + ), + ), + migrations.AlterField( + model_name="pokemonmove", + name="mastery", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(32767)] + ), + ), + migrations.AlterField( + model_name="pokemonmove", + name="order", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(-1), + django.core.validators.MaxValueValidator(32767), + ], + ), + ), + migrations.AlterField( + model_name="pokemonspecies", + name="base_happiness", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)] + ), + ), + migrations.AlterField( + model_name="pokemonspecies", + name="capture_rate", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)] + ), + ), + migrations.AlterField( + model_name="pokemonspecies", + name="gender_rate", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[django.core.validators.MinValueValidator(-1), django.core.validators.MaxValueValidator(8)], + ), + ), + migrations.AlterField( + model_name="pokemonspecies", + name="hatch_counter", + field=models.PositiveSmallIntegerField( + blank=True, null=True, validators=[django.core.validators.MaxValueValidator(255)] + ), + ), + migrations.AlterField( + model_name="pokemonspecies", + name="order", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(-1), + django.core.validators.MaxValueValidator(32767), + ], + ), + ), + migrations.AlterField( + model_name="pokemonstat", + name="base_stat", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(255)] + ), + ), + migrations.AlterField( + model_name="pokemonstat", + name="effort", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(255)]), + ), + migrations.AlterField( + model_name="pokemonstatpast", + name="base_stat", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(255)] + ), + ), + migrations.AlterField( + model_name="pokemonstatpast", + name="effort", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(255)]), + ), + migrations.AlterField( + model_name="pokemontype", + name="slot", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(2)] + ), + ), + migrations.AlterField( + model_name="pokemontypepast", + name="slot", + field=models.PositiveSmallIntegerField( + validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(2)] + ), + ), + migrations.AlterField( + model_name="stat", + name="game_index", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="supercontesteffect", + name="appeal", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(32767)]), + ), + migrations.AlterField( + model_name="typeefficacy", + name="damage_factor", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(200)]), + ), + migrations.AlterField( + model_name="typeefficacypast", + name="damage_factor", + field=models.PositiveSmallIntegerField(validators=[django.core.validators.MaxValueValidator(200)]), + ), + migrations.AlterField( + model_name="typegameindex", + name="game_index", + field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(2147483647)]), + ), + migrations.AlterField( + model_name="versiongroup", + name="order", + field=models.SmallIntegerField( + blank=True, + null=True, + validators=[ + django.core.validators.MinValueValidator(-1), + django.core.validators.MaxValueValidator(32767), + ], + ), + ), + ] diff --git a/pokemon_v2/models.py b/pokemon_v2/models.py index 3be7f36c1..d87e3e6e0 100644 --- a/pokemon_v2/models.py +++ b/pokemon_v2/models.py @@ -4,6 +4,7 @@ from typing import Any, ClassVar, TypeVar +from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from typing_extensions import override @@ -461,7 +462,7 @@ class Meta: class HasGameIndex(PokeApiModel): - game_index = models.IntegerField() + game_index = models.PositiveIntegerField(validators=[MaxValueValidator(2147483647)]) class Meta: abstract = True @@ -684,7 +685,9 @@ class Meta: class HasOrder(PokeApiModel): - order = models.IntegerField(blank=True, null=True) + order = models.SmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(-1), MaxValueValidator(32767)] + ) class Meta: abstract = True @@ -871,7 +874,7 @@ class HasTypeEfficacy(PokeApiModel): on_delete=models.CASCADE, ) - damage_factor = models.IntegerField() + damage_factor = models.PositiveSmallIntegerField(validators=[MaxValueValidator(200)]) class Meta: abstract = True @@ -1072,7 +1075,7 @@ class TypeSprites(HasType): class Stat(HasName, HasMoveDamageClass): is_battle_only = models.BooleanField(default=False) - game_index = models.IntegerField() + game_index = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) class StatName(IsName, HasStat): @@ -1085,7 +1088,7 @@ class StatName(IsName, HasStat): class Characteristic(HasStat): - gene_mod_5 = models.IntegerField() + gene_mod_5 = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) class CharacteristicDescription(HasCharacteristic, IsDescription): @@ -1143,7 +1146,11 @@ class ItemFlingEffectEffectText(HasLanguage, HasEffect, HasFlingEffect): class Item(HasName, HasItemCategory, HasFlingEffect): - fling_power = models.IntegerField(blank=True, null=True) + fling_power = models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[MaxValueValidator(130)], + ) class ItemEffectText(HasItem, HasLanguage, HasEffect, HasShortEffect): @@ -1179,8 +1186,8 @@ class ItemGameIndex(HasItem, HasGeneration, HasGameIndex): class ItemPrice(HasItem, HasVersionGroup, HasCurrency): - purchase_price = models.IntegerField(blank=True, null=True) - sell_price = models.IntegerField(blank=True, null=True) + purchase_price = models.PositiveIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) + sell_price = models.PositiveIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) class ItemSprites(HasItem): @@ -1203,9 +1210,9 @@ class ContestTypeName(HasContestType, IsName): class ContestEffect(PokeApiModel): - appeal = models.IntegerField() + appeal = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) - jam = models.IntegerField() + jam = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) class ContestEffectEffectText(HasLanguage, HasEffect, HasContestEffect): @@ -1262,21 +1269,33 @@ class Berry(HasName, HasItem): on_delete=models.CASCADE, ) - natural_gift_power = models.IntegerField(blank=True, null=True) + natural_gift_power = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) natural_gift_type = models.ForeignKey( Type, blank=True, null=True, related_name="%(class)s", on_delete=models.CASCADE ) - size = models.IntegerField(blank=True, null=True) + size = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) - max_harvest = models.IntegerField(blank=True, null=True) + max_harvest = models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[MaxValueValidator(15)], + ) - growth_time = models.IntegerField(blank=True, null=True) + growth_time = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) - soil_dryness = models.IntegerField(blank=True, null=True) + soil_dryness = models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[MinValueValidator(4), MaxValueValidator(35)], + ) - smoothness = models.IntegerField(blank=True, null=True) + smoothness = models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[MinValueValidator(20), MaxValueValidator(60)], + ) # Berry Flavors are a bit of a hack because their relationship @@ -1317,7 +1336,7 @@ class BerryFlavorMap(PokeApiModel): on_delete=models.CASCADE, ) - potency = models.IntegerField() + potency = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) ######################## @@ -1359,7 +1378,7 @@ class Nature(HasName): on_delete=models.CASCADE, ) - game_index = models.IntegerField() + game_index = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) class NatureName(IsName, HasNature): @@ -1367,7 +1386,7 @@ class NatureName(IsName, HasNature): class NaturePokeathlonStat(HasNature, HasPokeathlonStat): - max_change = models.IntegerField() + max_change = models.SmallIntegerField(validators=[MinValueValidator(-2), MaxValueValidator(2)]) class NatureBattleStylePreference(HasNature): @@ -1379,9 +1398,13 @@ class NatureBattleStylePreference(HasNature): on_delete=models.CASCADE, ) - low_hp_preference = models.IntegerField() + low_hp_preference = models.PositiveSmallIntegerField( + validators=[MaxValueValidator(100)], + ) - high_hp_preference = models.IntegerField() + high_hp_preference = models.PositiveSmallIntegerField( + validators=[MaxValueValidator(100)], + ) ##################### @@ -1410,7 +1433,7 @@ class LocationAreaName(IsName, HasLocationArea): class LocationAreaEncounterRate(HasEncounterMethod, HasLocationArea, HasVersion): - rate = models.IntegerField() + rate = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) ###################### @@ -1427,17 +1450,23 @@ class EncounterMethodName(HasEncounterMethod, IsName): class EncounterSlot(HasVersionGroup, HasEncounterMethod): - slot = models.IntegerField(blank=True, null=True) + slot = models.PositiveSmallIntegerField( + blank=True, + null=True, + validators=[MinValueValidator(1), MaxValueValidator(12)], + ) - rarity = models.IntegerField() + rarity = models.PositiveSmallIntegerField( + validators=[MinValueValidator(1), MaxValueValidator(100)], + ) class Encounter(HasVersion, HasLocationArea, HasPokemon): encounter_slot = models.ForeignKey(EncounterSlot, blank=True, null=True, on_delete=models.CASCADE) - min_level = models.IntegerField() + min_level = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(100)]) - max_level = models.IntegerField() + max_level = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(100)]) class EncounterCondition(HasName): @@ -1473,7 +1502,7 @@ class EncounterConditionValueMap(PokeApiModel): class EncounterPokemonDetail(PokeApiModel): encounter = models.ForeignKey(Encounter, blank=True, null=True, on_delete=models.CASCADE) - min_perfect_ivs = models.IntegerField(blank=True, null=True) + min_perfect_ivs = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(31)]) always_shiny = models.BooleanField(default=False) @@ -1498,15 +1527,19 @@ class Move( HasContestEffect, HasSuperContestEffect, ): - power = models.IntegerField(blank=True, null=True) + power = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(250)]) - pp = models.IntegerField(blank=True, null=True) + pp = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(40)]) - accuracy = models.IntegerField(blank=True, null=True) + accuracy = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(100)]) - priority = models.IntegerField(blank=True, null=True) + priority = models.SmallIntegerField( + blank=True, + null=True, + validators=[MinValueValidator(-8), MaxValueValidator(8)], + ) - move_effect_chance = models.IntegerField(blank=True, null=True) + move_effect_chance = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(100)]) class MoveName(HasMove, IsName): @@ -1518,13 +1551,13 @@ class MoveFlavorText(HasMove, HasVersionGroup, IsFlavorText): class MoveChange(HasMove, HasVersionGroup, HasType, HasMoveEffect): - power = models.IntegerField(blank=True, null=True) + power = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(250)]) - pp = models.IntegerField(blank=True, null=True) + pp = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(40)]) - accuracy = models.IntegerField(blank=True, null=True) + accuracy = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(100)]) - move_effect_chance = models.IntegerField(blank=True, null=True) + move_effect_chance = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(100)]) ############################## @@ -1642,25 +1675,37 @@ class MoveMeta(HasMetaAilment, HasMetaCategory): on_delete=models.CASCADE, ) - min_hits = models.IntegerField(blank=True, null=True) + min_hits = models.PositiveSmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(5)] + ) - max_hits = models.IntegerField(blank=True, null=True) + max_hits = models.PositiveSmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(5)] + ) - min_turns = models.IntegerField(blank=True, null=True) + min_turns = models.PositiveSmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(10)] + ) - max_turns = models.IntegerField(blank=True, null=True) + max_turns = models.PositiveSmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(10)] + ) - drain = models.IntegerField(blank=True, null=True) + drain = models.SmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(-100), MaxValueValidator(100)] + ) - healing = models.IntegerField(blank=True, null=True) + healing = models.SmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(-100), MaxValueValidator(100)] + ) - crit_rate = models.IntegerField(blank=True, null=True) + crit_rate = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(8)]) - ailment_chance = models.IntegerField(blank=True, null=True) + ailment_chance = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(100)]) - flinch_chance = models.IntegerField(blank=True, null=True) + flinch_chance = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(100)]) - stat_chance = models.IntegerField(blank=True, null=True) + stat_chance = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(100)]) class MoveMetaAilment(HasName): @@ -1680,7 +1725,7 @@ class MoveMetaCategoryDescription(HasMetaCategory, IsDescription): class MoveMetaStatChange(HasMove, HasStat): - change = models.IntegerField() + change = models.SmallIntegerField(validators=[MinValueValidator(-6), MaxValueValidator(6)]) ####################### @@ -1689,9 +1734,9 @@ class MoveMetaStatChange(HasMove, HasStat): class Experience(HasGrowthRate): - level = models.IntegerField() + level = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(100)]) - experience = models.IntegerField() + experience = models.PositiveIntegerField(validators=[MaxValueValidator(32767)]) ################### @@ -1709,7 +1754,7 @@ class Gender(HasName): class Machine(HasGrowthRate, HasItem): - machine_number = models.IntegerField() + machine_number = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) version_group = models.ForeignKey(VersionGroup, blank=True, null=True, on_delete=models.CASCADE) @@ -1757,9 +1802,9 @@ class PalPark(HasPokemonSpecies): on_delete=models.CASCADE, ) - base_score = models.IntegerField(blank=True, null=True) + base_score = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) - rate = models.IntegerField() + rate = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) ########################## @@ -1768,7 +1813,7 @@ class PalPark(HasPokemonSpecies): class SuperContestEffect(PokeApiModel): - appeal = models.IntegerField() + appeal = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) class SuperContestEffectFlavorText(IsFlavorText, HasSuperContestEffect): @@ -1857,11 +1902,13 @@ class PokemonSpecies(HasName, HasGeneration, HasPokemonColor, HasPokemonShape, H on_delete=models.CASCADE, ) - gender_rate = models.IntegerField(blank=True, null=True) + gender_rate = models.SmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(-1), MaxValueValidator(8)] + ) - capture_rate = models.IntegerField(blank=True, null=True) + capture_rate = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(255)]) - base_happiness = models.IntegerField(blank=True, null=True) + base_happiness = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(255)]) is_baby = models.BooleanField(default=False) @@ -1869,7 +1916,7 @@ class PokemonSpecies(HasName, HasGeneration, HasPokemonColor, HasPokemonShape, H is_mythical = models.BooleanField(default=False) - hatch_counter = models.IntegerField(blank=True, null=True) + hatch_counter = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(255)]) has_gender_differences = models.BooleanField(default=False) @@ -1893,11 +1940,11 @@ class PokemonFormFlavorText(IsFlavorText, HasPokemonForm, HasVersion): class Pokemon(HasName, HasPokemonSpecies, HasOrder): - height = models.IntegerField(blank=True, null=True) + height = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) - weight = models.IntegerField(blank=True, null=True) + weight = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) - base_experience = models.IntegerField(blank=True, null=True) + base_experience = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) is_default = models.BooleanField(default=False) @@ -1905,14 +1952,14 @@ class Pokemon(HasName, HasPokemonSpecies, HasOrder): class PokemonAbility(HasPokemon, HasAbility): is_hidden = models.BooleanField(default=False) - slot = models.IntegerField() + slot = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(3)]) # model for a Pokemon's abilities that were used until a given generation class PokemonAbilityPast(HasPokemon, HasAbility, HasGeneration): is_hidden = models.BooleanField(default=False) - slot = models.IntegerField() + slot = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(3)]) class PokemonColor(HasName): @@ -1924,7 +1971,7 @@ class PokemonColorName(HasPokemonColor, IsName): class PokemonDexNumber(HasPokemonSpecies, HasPokedex): - pokedex_number = models.IntegerField() + pokedex_number = models.PositiveSmallIntegerField(validators=[MaxValueValidator(32767)]) class PokemonEggGroup(HasPokemonSpecies, HasEggGroup): @@ -1958,7 +2005,9 @@ class PokemonEvolution(HasEvolutionTrigger, HasGender): is_default = models.BooleanField(default=False) - min_level = models.IntegerField(blank=True, null=True) + min_level = models.PositiveSmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(1), MaxValueValidator(100)] + ) location = models.ForeignKey( Location, @@ -1978,13 +2027,15 @@ class PokemonEvolution(HasEvolutionTrigger, HasGender): Type, related_name="known_move", blank=True, null=True, on_delete=models.CASCADE ) - min_happiness = models.IntegerField(blank=True, null=True) + min_happiness = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(255)]) - min_beauty = models.IntegerField(blank=True, null=True) + min_beauty = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(255)]) - min_affection = models.IntegerField(blank=True, null=True) + min_affection = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(255)]) - relative_physical_stats = models.IntegerField(blank=True, null=True) + relative_physical_stats = models.SmallIntegerField( + blank=True, null=True, validators=[MinValueValidator(-1), MaxValueValidator(1)] + ) party_species = models.ForeignKey( PokemonSpecies, @@ -2041,13 +2092,13 @@ class PokemonEvolution(HasEvolutionTrigger, HasGender): used_move = models.ForeignKey(Move, related_name="used_move", blank=True, null=True, on_delete=models.CASCADE) - min_move_count = models.IntegerField(blank=True, null=True) + min_move_count = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) - min_steps = models.IntegerField(blank=True, null=True) + min_steps = models.PositiveIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) - min_damage_taken = models.IntegerField(blank=True, null=True) + min_damage_taken = models.PositiveIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) - nature_bitmask = models.IntegerField( + nature_bitmask = models.PositiveIntegerField( blank=True, null=True, help_text="25-bit bitmask of allowed nature IDs (1 << (nature_id - 1))", @@ -2064,6 +2115,7 @@ class PokemonEvolution(HasEvolutionTrigger, HasGender): blank=True, null=True, help_text="Percentage chance of evolution under this condition (0-100)", + validators=[MinValueValidator(0.0), MaxValueValidator(100.0)], ) @@ -2078,7 +2130,7 @@ class PokemonForm(HasName, HasPokemon, HasOrder): is_mega = models.BooleanField(default=False) - form_order = models.IntegerField(blank=True, null=True) + form_order = models.PositiveSmallIntegerField(blank=True, null=True, validators=[MaxValueValidator(32767)]) class PokemonFormGeneration(HasPokemonForm, HasGeneration, HasGameIndex): @@ -2130,7 +2182,7 @@ class PokemonHabitatName(IsName): class PokemonItem(HasPokemon, HasVersion, HasItem): - rarity = models.IntegerField() + rarity = models.PositiveSmallIntegerField(validators=[MaxValueValidator(100)]) # PokemonMoveMethod @@ -2148,8 +2200,8 @@ class MoveLearnMethodDescription(IsDescription, HasMoveLearnMethod): class PokemonMove(HasPokemon, HasMoveLearnMethod, HasVersionGroup, HasMove, HasOrder): - level = models.IntegerField() - mastery = models.IntegerField(null=True, blank=True) + level = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(100)]) + mastery = models.PositiveSmallIntegerField(null=True, blank=True, validators=[MaxValueValidator(32767)]) class PokemonShape(HasName): @@ -2169,28 +2221,28 @@ class PokemonShapeName(IsName): class PokemonStat(HasPokemon, HasStat): - base_stat = models.IntegerField() + base_stat = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(255)]) - effort = models.IntegerField() + effort = models.PositiveSmallIntegerField(validators=[MaxValueValidator(255)]) class PokemonStatPast(HasPokemon, HasStat, HasGeneration): - base_stat = models.IntegerField() + base_stat = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(255)]) - effort = models.IntegerField() + effort = models.PositiveSmallIntegerField(validators=[MaxValueValidator(255)]) class PokemonType(HasPokemon, HasType): - slot = models.IntegerField() + slot = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(2)]) class PokemonFormType(HasPokemonForm, HasType): - slot = models.IntegerField() + slot = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(2)]) # model for a Pokemon's types that were used until a given generation class PokemonTypePast(HasPokemon, HasType, HasGeneration): - slot = models.IntegerField() + slot = models.PositiveSmallIntegerField(validators=[MinValueValidator(1), MaxValueValidator(2)]) class PokemonSprites(HasPokemon):