Skip to content

Commit

Permalink
Merge pull request #593 from open5e/419-v2-casting-options-field-support
Browse files Browse the repository at this point in the history
419 v2 casting options field support
  • Loading branch information
augustjohnson authored Oct 22, 2024
2 parents e009405 + 8ffb815 commit cdb36ba
Show file tree
Hide file tree
Showing 14 changed files with 16,830 additions and 5,589 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.1.2 on 2024-10-22 14:04

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api_v2', '0009_merge_20241010_0144'),
]

operations = [
migrations.AddField(
model_name='spellcastingoption',
name='concentration',
field=models.BooleanField(blank=True, help_text='Whether the effect requires concentration to be maintained.', null=True),
),
migrations.AddField(
model_name='spellcastingoption',
name='shape_size',
field=models.FloatField(blank=True, help_text='Used to measure distance.', null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
]
14 changes: 14 additions & 0 deletions api_v2/migrations/0011_merge_20241022_1426.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 5.1.2 on 2024-10-22 14:26

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('api_v2', '0010_merge_20241016_1952'),
('api_v2', '0010_spellcastingoption_concentration_and_more'),
]

operations = [
]
11 changes: 10 additions & 1 deletion api_v2/models/spell.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ def search_result_extra_fields(self):
"school": self.school.name,
"level": self.level,
}



class SpellCastingOption(models.Model):
"""An object representing an alternative way to cast a spell."""

Expand All @@ -179,3 +180,11 @@ class SpellCastingOption(models.Model):
range = models.TextField(
null=True, # Null values mean this value is unchanged from the default casting option.
help_text='Description of the range of the spell.')

concentration = models.BooleanField(
null=True, # Null values mean this value is unchanged from the default casting option.
blank=True,
help_text='Whether the effect requires concentration to be maintained.')

shape_size = distance_field()
# Null values mean this value is unchanged from the default casting option.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"attack_roll": false,
"casting_options": [
{
"concentration": null,
"damage_roll": null,
"duration": null,
"range": null,
"shape_size": null,
"target_count": null,
"type": "default"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,65 @@
"attack_roll": false,
"casting_options": [
{
"concentration": null,
"damage_roll": null,
"duration": null,
"range": null,
"shape_size": null,
"target_count": null,
"type": "default"
},
{
"concentration": null,
"damage_roll": "9d6",
"duration": null,
"range": null,
"shape_size": null,
"target_count": null,
"type": "slot_level_4"
},
{
"concentration": null,
"damage_roll": "10d6",
"duration": null,
"range": null,
"shape_size": null,
"target_count": null,
"type": "slot_level_5"
},
{
"concentration": null,
"damage_roll": "11d6",
"duration": null,
"range": null,
"shape_size": null,
"target_count": null,
"type": "slot_level_6"
},
{
"concentration": null,
"damage_roll": "12d6",
"duration": null,
"range": null,
"shape_size": null,
"target_count": null,
"type": "slot_level_7"
},
{
"concentration": null,
"damage_roll": "13d6",
"duration": null,
"range": null,
"shape_size": null,
"target_count": null,
"type": "slot_level_8"
},
{
"concentration": null,
"damage_roll": "14d6",
"duration": null,
"range": null,
"shape_size": null,
"target_count": null,
"type": "slot_level_9"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"attack_roll": false,
"casting_options": [
{
"concentration": null,
"damage_roll": null,
"duration": null,
"range": null,
"shape_size": null,
"target_count": null,
"type": "default"
}
Expand Down
Loading

0 comments on commit cdb36ba

Please sign in to comment.