Skip to content

Commit cdb36ba

Browse files
Merge pull request open5e#593 from open5e/419-v2-casting-options-field-support
419 v2 casting options field support
2 parents e009405 + 8ffb815 commit cdb36ba

14 files changed

+16830
-5589
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 5.1.2 on 2024-10-22 14:04
2+
3+
import django.core.validators
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('api_v2', '0009_merge_20241010_0144'),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name='spellcastingoption',
16+
name='concentration',
17+
field=models.BooleanField(blank=True, help_text='Whether the effect requires concentration to be maintained.', null=True),
18+
),
19+
migrations.AddField(
20+
model_name='spellcastingoption',
21+
name='shape_size',
22+
field=models.FloatField(blank=True, help_text='Used to measure distance.', null=True, validators=[django.core.validators.MinValueValidator(0)]),
23+
),
24+
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Generated by Django 5.1.2 on 2024-10-22 14:26
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('api_v2', '0010_merge_20241016_1952'),
10+
('api_v2', '0010_spellcastingoption_concentration_and_more'),
11+
]
12+
13+
operations = [
14+
]

api_v2/models/spell.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ def search_result_extra_fields(self):
152152
"school": self.school.name,
153153
"level": self.level,
154154
}
155-
155+
156+
156157
class SpellCastingOption(models.Model):
157158
"""An object representing an alternative way to cast a spell."""
158159

@@ -179,3 +180,11 @@ class SpellCastingOption(models.Model):
179180
range = models.TextField(
180181
null=True, # Null values mean this value is unchanged from the default casting option.
181182
help_text='Description of the range of the spell.')
183+
184+
concentration = models.BooleanField(
185+
null=True, # Null values mean this value is unchanged from the default casting option.
186+
blank=True,
187+
help_text='Whether the effect requires concentration to be maintained.')
188+
189+
shape_size = distance_field()
190+
# Null values mean this value is unchanged from the default casting option.

api_v2/tests/responses/TestObjects.test_spell_cantrip_example.approved.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"attack_roll": false,
33
"casting_options": [
44
{
5+
"concentration": null,
56
"damage_roll": null,
67
"duration": null,
78
"range": null,
9+
"shape_size": null,
810
"target_count": null,
911
"type": "default"
1012
}

api_v2/tests/responses/TestObjects.test_spell_fireball.approved.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,65 @@
22
"attack_roll": false,
33
"casting_options": [
44
{
5+
"concentration": null,
56
"damage_roll": null,
67
"duration": null,
78
"range": null,
9+
"shape_size": null,
810
"target_count": null,
911
"type": "default"
1012
},
1113
{
14+
"concentration": null,
1215
"damage_roll": "9d6",
1316
"duration": null,
1417
"range": null,
18+
"shape_size": null,
1519
"target_count": null,
1620
"type": "slot_level_4"
1721
},
1822
{
23+
"concentration": null,
1924
"damage_roll": "10d6",
2025
"duration": null,
2126
"range": null,
27+
"shape_size": null,
2228
"target_count": null,
2329
"type": "slot_level_5"
2430
},
2531
{
32+
"concentration": null,
2633
"damage_roll": "11d6",
2734
"duration": null,
2835
"range": null,
36+
"shape_size": null,
2937
"target_count": null,
3038
"type": "slot_level_6"
3139
},
3240
{
41+
"concentration": null,
3342
"damage_roll": "12d6",
3443
"duration": null,
3544
"range": null,
45+
"shape_size": null,
3646
"target_count": null,
3747
"type": "slot_level_7"
3848
},
3949
{
50+
"concentration": null,
4051
"damage_roll": "13d6",
4152
"duration": null,
4253
"range": null,
54+
"shape_size": null,
4355
"target_count": null,
4456
"type": "slot_level_8"
4557
},
4658
{
59+
"concentration": null,
4760
"damage_roll": "14d6",
4861
"duration": null,
4962
"range": null,
63+
"shape_size": null,
5064
"target_count": null,
5165
"type": "slot_level_9"
5266
}

api_v2/tests/responses/TestObjects.test_spell_wish.approved.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
"attack_roll": false,
33
"casting_options": [
44
{
5+
"concentration": null,
56
"damage_roll": null,
67
"duration": null,
78
"range": null,
9+
"shape_size": null,
810
"target_count": null,
911
"type": "default"
1012
}

0 commit comments

Comments
 (0)