Skip to content

Commit

Permalink
Merge pull request #596 from open5e/458-add-hit-dice-to-sizes-model
Browse files Browse the repository at this point in the history
458 add hit dice to sizes model
  • Loading branch information
augustjohnson authored Oct 24, 2024
2 parents d997b3a + fb9e677 commit eec2960
Show file tree
Hide file tree
Showing 10 changed files with 463 additions and 370 deletions.
18 changes: 18 additions & 0 deletions api_v2/migrations/0012_alter_creature_subcategory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.2 on 2024-10-24 14:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api_v2', '0011_merge_20241022_1426'),
]

operations = [
migrations.AlterField(
model_name='creature',
name='subcategory',
field=models.CharField(blank=True, help_text='What subcategory this creature belongs to.', max_length=100, null=True),
),
]
18 changes: 18 additions & 0 deletions api_v2/migrations/0013_size_suggested_hit_dice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.2 on 2024-10-24 14:22

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api_v2', '0012_alter_creature_subcategory'),
]

operations = [
migrations.AddField(
model_name='size',
name='suggested_hit_dice',
field=models.CharField(blank=True, choices=[('D4', 'd4'), ('D6', 'd6'), ('D8', 'd8'), ('D10', 'd10'), ('D12', 'd12'), ('D20', 'd20')], help_text='What kind of die to roll for damage.', max_length=20, null=True),
),
]
1 change: 1 addition & 0 deletions api_v2/models/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Creature(Object, HasAbilities, HasSenses, HasLanguage, HasSpeed, FromDocum

subcategory = models.CharField(
max_length=100,
blank=True,
null=True,
help_text='What subcategory this creature belongs to.'
)
Expand Down
4 changes: 3 additions & 1 deletion api_v2/models/size.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.db import models

from .abstracts import HasName
from .abstracts import distance_field, distance_unit_field
from .abstracts import distance_field, distance_unit_field, damage_die_type_field
from .document import FromDocument

class Size(HasName, FromDocument):
Expand All @@ -19,6 +19,8 @@ class Size(HasName, FromDocument):
space_diameter = distance_field()
distance_unit = distance_unit_field()

suggested_hit_dice = damage_die_type_field()

@property
def get_distance_unit(self):
if self.distance_unit is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"name": "Huge",
"rank": 5,
"space_diameter": 15.0,
"suggested_hit_dice": "d12",
"url": "http://localhost:8000/v2/sizes/huge/"
}
3 changes: 2 additions & 1 deletion data/v2/en-publishing/mmenag/Size.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"document": "mmenag",
"rank": 7,
"space_diameter": 25.0,
"distance_unit": null
"distance_unit": null,
"suggested_hit_dice": "d20"
}
}
]
Loading

0 comments on commit eec2960

Please sign in to comment.