Skip to content

Commit

Permalink
Merge pull request #613 from open5e/540-api-v2-add-class-proficiencie…
Browse files Browse the repository at this point in the history
…s-to-characterclass-model

540 api v2 add class proficiencies to characterclass model
  • Loading branch information
augustjohnson authored Nov 25, 2024
2 parents 13a1a13 + fec2b1a commit af56be2
Show file tree
Hide file tree
Showing 9 changed files with 511 additions and 60 deletions.
18 changes: 18 additions & 0 deletions api_v2/migrations/0017_characterclass_saving_throws.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.2 on 2024-11-25 19:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api_v2', '0016_alter_creaturetrait_parent'),
]

operations = [
migrations.AddField(
model_name='characterclass',
name='saving_throws',
field=models.ManyToManyField(help_text='Saving throw proficiencies for this class.', related_name='characterclass_saving_throws', to='api_v2.ability'),
),
]
6 changes: 6 additions & 0 deletions api_v2/models/characterclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from .abstracts import HasName, HasDescription, Modification
from .abstracts import key_field
from .abilities import Ability
from .document import FromDocument
from .enums import DIE_TYPES
from drf_spectacular.utils import extend_schema_field, inline_serializer
Expand Down Expand Up @@ -57,6 +58,11 @@ class CharacterClass(HasName, FromDocument):
choices=DIE_TYPES,
help_text='Dice notation hit dice option.')


saving_throws = models.ManyToManyField(Ability,
related_name="characterclass_saving_throws",
help_text='Saving throw proficiencies for this class.')

@property
@extend_schema_field(inline_serializer(
name="hit_points",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"key": "srd_barbarian_danger-sense",
"name": "Danger Sense"
},
{
"desc": "You start with the following equipment, in addition to the equipment granted by your background:\r\n* (*a*) a greataxe or (*b*) any martial melee weapon\r\n* (*a*) two handaxes or (*b*) any simple weapon\r\n* An explorer\u2019s pack and four javelins",
"key": "srd_barbarian_equipment",
"name": "Equipment"
},
{
"desc": "Beginning at 5th level, you can attack twice, instead of once, whenever you take the Attack action on your turn.",
"key": "srd_barbarian_extra-attack",
Expand Down Expand Up @@ -51,6 +56,11 @@
"key": "srd_barbarian_primal-path",
"name": "Primal Path"
},
{
"desc": "**Armor:** Light armor, medium armor, shields\r\n**Weapons:** Simple weapons, martial weapons\r\n**Tools:** None\r\n**Saving Throws:** Strength, Constitution\r\n**Skills:** Choose two from Animal Handling, Athletics, Intimidation, Nature, Perception, and Survival",
"key": "srd_barbarian_proficiencies",
"name": "Proficiencies"
},
{
"desc": "In battle, you fight with primal ferocity. On your turn, you can enter a rage as a bonus action.\r\n\r\nWhile raging, you gain the following benefits if you aren't wearing heavy armor:\r\n\r\n* You have advantage on Strength checks and Strength saving throws.\r\n* When you make a melee weapon attack using Strength, you gain a bonus to the damage roll that increases as you gain levels as a barbarian, as shown in the Rage Damage column of the Barbarian table.\r\n* You have resistance to bludgeoning, piercing, and slashing damage. \r\n\r\nIf you are able to cast spells, you can't cast them or concentrate on them while raging.\r\n\r\nYour rage lasts for 1 minute. It ends early if you are knocked unconscious or if your turn ends and you haven't attacked a hostile creature since your last turn or taken damage since then. You can also end your rage on your turn as a bonus action.\r\n\r\nOnce you have raged the number of times shown for your barbarian level in the Rages column of the Barbarian table, you must finish a long rest before you can rage again.",
"key": "srd_barbarian_rage",
Expand All @@ -72,12 +82,12 @@
"name": "Unarmored Defense"
}
],
"hit_dice": "d12",
"hit_dice": "D12",
"hit_points": {
"hit_dice": "d12",
"hit_dice_name": "1d12 per Barbarian level",
"hit_dice": "D12",
"hit_dice_name": "1D12 per Barbarian level",
"hit_points_at_1st_level": "12 + your Constitution modifier",
"hit_points_at_higher_levels": "1d12 (or 7) + your Constitution modifier per barbarian level after 1st"
"hit_points_at_higher_levels": "1D12 (or 7) + your Constitution modifier per barbarian level after 1st"
},
"key": "srd_barbarian",
"levels": {
Expand Down Expand Up @@ -205,6 +215,10 @@
}
},
"name": "Barbarian",
"saving_throws": [
"http://localhost:8000/v2/abilities/con/",
"http://localhost:8000/v2/abilities/str/"
],
"subclass_of": null,
"url": "http://localhost:8000/v2/classes/srd_barbarian/"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
"key": "srd_sorcerer_ability-score-improvement",
"name": "Ability Score Improvement"
},
{
"desc": "You start with the following equipment, in addition to the equipment granted by your background:\r\n* (*a*) a light crossbow and 20 bolts or (*b*) any simple weapon\r\n* (*a*) a component pouch or (*b*) an arcane focus\r\n* (*a*) a dungeoneer\u2019s pack or (*b*) an explorer\u2019s pack\r\n* Two daggers",
"key": "srd_sorcerer_equipment",
"name": "Equipment"
},
{
"desc": "At 2nd level, you tap into a deep wellspring of magic within yourself. This wellspring is represented by sorcery points, which allow you to create a variety of magical effects.\r\n\r\n### Sorcery Points\r\n\r\nYou have 2 sorcery points, and you gain more as you reach higher levels, as shown in the Sorcery Points column of the Sorcerer table. You can never have more sorcery points than shown on the table for your level. You regain all spent sorcery points when you finish a long rest.\r\n\r\n### Flexible Casting\r\n\r\nYou can use your sorcery points to gain additional spell slots, or sacrifice spell slots to gain additional sorcery points. You learn other ways to use your sorcery points as you reach higher levels.\r\n\r\n***Creating Spell Slots.*** You can transform unexpended sorcery points into one spell slot as a bonus action on your turn. The Creating Spell Slots table shows the cost of creating a spell slot of a given level. You can create spell slots no higher in level than 5th.\r\n\r\nAny spell slot you create with this feature vanishes when you finish a long rest.\r\n\r\n### Creating Spell Slots (table)\r\n| Spell Slot Level | Sorcery Point Cost |\r\n| --- | --- |\r\n| 1st | 2 |\r\n| 2nd | 3 |\r\n| 3rd | 5 |\r\n| 4th | 6 |\r\n| 5th | 7|\r\n\r\n***Converting a Spell Slot to Sorcery Points.*** As a bonus action on your turn, you can expend one spell slot and gain a number of sorcery points equal to the slot's level.",
"key": "srd_sorcerer_font-of-magic",
Expand All @@ -99,14 +104,19 @@
"desc": "An event in your past, or in the life of a parent or ancestor, left an indelible mark on you, infusing you with arcane magic. This font of magic, whatever its origin, fuels your spells.\r\n\r\n### Cantrips\r\n\r\nAt 1st level, you know four cantrips of your choice from the sorcerer spell list. You learn additional sorcerer cantrips of your choice at higher levels, as shown in the Cantrips Known column of the Sorcerer table.\r\n\r\n### Spell Slots\r\n\r\nThe Sorcerer table shows how many spell slots you have to cast your spells of 1st level and higher. To cast one of these sorcerer spells, you must expend a slot of the spell's level or higher. You regain all expended spell slots when you finish a long rest.\r\n\r\nFor example, if you know the 1st-level spell burning hands and have a 1st-level and a 2nd-level spell slot available, you can cast burning hands using either slot.\r\n\r\n### Spells Known of 1st Level and Higher\r\n\r\nYou know two 1st-level spells of your choice from the sorcerer spell list.\r\n\r\nThe Spells Known column of the Sorcerer table shows when you learn more sorcerer spells of your choice. Each of these spells must be of a level for which you have spell slots. For instance, when you reach 3rd level in this class, you can learn one new spell of 1st or 2nd level.\r\n\r\nAdditionally, when you gain a level in this class, you can choose one of the sorcerer spells you know and replace it with another spell from the sorcerer spell list, which also must be of a level for which you have spell slots.\r\n\r\n### Spellcasting Ability\r\n\r\nCharisma is your spellcasting ability for your sorcerer spells, since the power of your magic relies on your ability to project your will into the world. You use your Charisma whenever a spell refers to your spellcasting ability. In addition, you use your Charisma modifier when setting the saving throw DC for a sorcerer spell you cast and when making an attack roll with one.\r\n\r\n**Spell save DC = 8** + your proficiency bonus + your Charisma modifier\r\n\r\n**Spell attack modifier** = your proficiency bonus + your Charisma modifier\r\nSpellcasting Focus\r\n\r\nYou can use an arcane focus as a spellcasting focus for your sorcerer spells.",
"key": "srd_sorcerer_spellcasting",
"name": "Spellcasting"
},
{
"desc": "**Armor:** None\r\n**Weapons:** Daggers, darts, slings, quarterstaffs, light crossbows\r\n**Tools:** None\r\n**Saving Throws:** Constitution, Charisma\r\n**Skills:** Choose two from Arcana, Deception, Insight, Intimidation, Persuasion, and Religion",
"key": "srd_sorceror_proficiencies",
"name": "Proficiencies"
}
],
"hit_dice": "d6",
"hit_dice": "D6",
"hit_points": {
"hit_dice": "d6",
"hit_dice_name": "1d6 per Sorcerer level",
"hit_dice": "D6",
"hit_dice_name": "1D6 per Sorcerer level",
"hit_points_at_1st_level": "6 + your Constitution modifier",
"hit_points_at_higher_levels": "1d6 (or 4) + your Constitution modifier per sorcerer level after 1st"
"hit_points_at_higher_levels": "1D6 (or 4) + your Constitution modifier per sorcerer level after 1st"
},
"key": "srd_sorcerer",
"levels": {
Expand Down Expand Up @@ -190,6 +200,10 @@
}
},
"name": "Sorcerer",
"saving_throws": [
"http://localhost:8000/v2/abilities/cha/",
"http://localhost:8000/v2/abilities/con/"
],
"subclass_of": null,
"url": "http://localhost:8000/v2/classes/srd_sorcerer/"
},
Expand All @@ -211,6 +225,16 @@
"key": "srd_wizard_arcane-tradition",
"name": "Arcane Tradition"
},
{
"desc": "You start with the following equipment, in addition to the equipment granted by your background:\r\n* (*a*) a quarterstaff or (*b*) a dagger\r\n* (*a*) a component pouch or (*b*) an arcane focus\r\n* (*a*) a scholar\u2019s pack or (*b*) an explorer\u2019s pack\r\n* A spellbook",
"key": "srd_wizard_equipment",
"name": "Equipment"
},
{
"desc": "**Armor:** None\r\n**Weapons:** Daggers, darts, slings, quarterstaffs, light crossbows\r\n**Tools:** None\r\n**Saving Throws:** Intelligence, Wisdom\r\n**Skills:** Choose two from Arcana, History, Insight, Investigation, Medicine, and Religion",
"key": "srd_wizard_proficiencies",
"name": "Proficiencies"
},
{
"desc": "When you reach 20th level, you gain mastery over two powerful spells and can cast them with little effort. Choose two 3rd-level wizard spells in your spellbook as your signature spells. You always have these spells prepared, they don't count against the number of spells you have prepared, and you can cast each of them once at 3rd level without expending a spell slot. When you do so, you can't do so again until you finish a short or long rest.\r\n\r\nIf you want to cast either spell at a higher level, you must expend a spell slot as normal.",
"key": "srd_wizard_signature-spells",
Expand All @@ -227,12 +251,12 @@
"name": "Spellcasting"
}
],
"hit_dice": "d6",
"hit_dice": "D6",
"hit_points": {
"hit_dice": "d6",
"hit_dice_name": "1d6 per Wizard level",
"hit_dice": "D6",
"hit_dice_name": "1D6 per Wizard level",
"hit_points_at_1st_level": "6 + your Constitution modifier",
"hit_points_at_higher_levels": "1d6 (or 4) + your Constitution modifier per wizard level after 1st"
"hit_points_at_higher_levels": "1D6 (or 4) + your Constitution modifier per wizard level after 1st"
},
"key": "srd_wizard",
"levels": {
Expand Down Expand Up @@ -302,6 +326,10 @@
}
},
"name": "Wizard",
"saving_throws": [
"http://localhost:8000/v2/abilities/int/",
"http://localhost:8000/v2/abilities/wis/"
],
"subclass_of": null,
"url": "http://localhost:8000/v2/classes/srd_wizard/"
}
Expand Down
Loading

0 comments on commit af56be2

Please sign in to comment.