Skip to content

Commit c6588fd

Browse files
Merge pull request open5e#575 from open5e/574-api-v2-some-magic-items-marked-as-non-magical-in-items-data
574 api v2 some magic items marked as non magical in items data
2 parents a7d9c91 + 3fd0ee0 commit c6588fd

12 files changed

+9819
-2904
lines changed

api_v2/models/armor.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ class Armor(HasName, FromDocument):
3939
null=True,
4040
help_text='Integer representing the dexterity modifier cap.')
4141

42+
@property
43+
def category(self):
44+
category = 'heavy'
45+
if self.ac_add_dexmod:
46+
category= 'light'
47+
if self.ac_cap_dexmod:
48+
category= 'medium'
49+
return category
50+
51+
4252
@property
4353
def ac_display(self):
4454
"""Display text for armor class."""

api_v2/serializers/item.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
class ArmorSerializer(GameContentSerializer):
1313
key = serializers.ReadOnlyField()
1414
ac_display = serializers.ReadOnlyField()
15+
category = serializers.ReadOnlyField()
1516

1617
class Meta:
1718
model = models.Armor

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"ac_base": 17,
44
"ac_cap_dexmod": null,
55
"ac_display": "17",
6+
"category": "heavy",
67
"document": "http://localhost:8000/v2/documents/srd/",
78
"grants_stealth_disadvantage": true,
89
"key": "srd_splint",

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"ac_base": 17,
55
"ac_cap_dexmod": null,
66
"ac_display": "17",
7+
"category": "heavy",
78
"document": "http://localhost:8000/v2/documents/srd/",
89
"grants_stealth_disadvantage": true,
910
"key": "srd_splint",
@@ -14,7 +15,10 @@
1415
"armor_class": 0,
1516
"category": "http://localhost:8000/v2/itemcategories/armor/",
1617
"cost": "200.00",
17-
"damage_immunities": [],
18+
"damage_immunities": [
19+
"http://localhost:8000/v2/damagetypes/poison/",
20+
"http://localhost:8000/v2/damagetypes/psychic/"
21+
],
1822
"damage_resistances": [],
1923
"damage_vulnerabilities": [],
2024
"desc": "This armor is made of narrow vertical strips of metal riveted to a backing of leather that is worn over cloth padding. Flexible chain mail protects the joints.",

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

Lines changed: 2192 additions & 769 deletions
Large diffs are not rendered by default.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"armor_class": 0,
44
"category": "http://localhost:8000/v2/itemcategories/wondrous-item/",
55
"cost": "0.00",
6-
"damage_immunities": [],
6+
"damage_immunities": [
7+
"http://localhost:8000/v2/damagetypes/poison/",
8+
"http://localhost:8000/v2/damagetypes/psychic/"
9+
],
710
"damage_resistances": [],
811
"damage_vulnerabilities": [],
912
"desc": "This item first appears to be a Large sealed iron barrel weighing 500 pounds. The barrel has a hidden catch, which can be found with a successful DC 20 Intelligence (Investigation) check. Releasing the catch unlocks a hatch at one end of the barrel, allowing two Medium or smaller creatures to crawl inside. Ten levers are set in a row at the far end, each in a neutral position, able to move either up or down. When certain levers are used, the apparatus transforms to resemble a giant lobster.\r\n\r\nThe apparatus of the Crab is a Large object with the following statistics:\r\n\r\n**Armor Class:** 20\r\n\r\n**Hit Points:** 200\r\n\r\n**Speed:** 30 ft., swim 30 ft. (or 0 ft. for both if the legs and tail aren't extended)\r\n\r\n**Damage Immunities:** poison, psychic\r\n\r\nTo be used as a vehicle, the apparatus requires one pilot. While the apparatus's hatch is closed, the compartment is airtight and watertight. The compartment holds enough air for 10 hours of breathing, divided by the number of breathing creatures inside.\r\n\r\nThe apparatus floats on water. It can also go underwater to a depth of 900 feet. Below that, the vehicle takes 2d6 bludgeoning damage per minute from pressure.\r\n\r\nA creature in the compartment can use an action to move as many as two of the apparatus's levers up or down. After each use, a lever goes back to its neutral position. Each lever, from left to right, functions as shown in the Apparatus of the Crab Levers table.\r\n\r\n**Apparatus of the Crab Levers (table)**\r\n\r\n| Lever | Up | Down |\r\n|-------|----------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|\r\n| 1 | Legs and tail extend, allowing the apparatus to walk and swim. | Legs and tail retract, reducing the apparatus's speed to 0 and making it unable to benefit from bonuses to speed. |\r\n| 2 | Forward window shutter opens. | Forward window shutter closes. |\r\n| 3 | Side window shutters open (two per side). | Side window shutters close (two per side). |\r\n| 4 | Two claws extend from the front sides of the apparatus. | The claws retract. |\r\n| 5 | Each extended claw makes the following melee weapon attack: +8 to hit, reach 5 ft., one target. Hit: 7 (2d6) bludgeoning damage. | Each extended claw makes the following melee weapon attack: +8 to hit, reach 5 ft., one target. Hit: The target is grappled (escape DC 15). |\r\n| 6 | The apparatus walks or swims forward. | The apparatus walks or swims backward. |\r\n| 7 | The apparatus turns 90 degrees left. | The apparatus turns 90 degrees right. |\r\n| 8 | Eyelike fixtures emit bright light in a 30-foot radius and dim light for an additional 30 feet. | The light turns off. |\r\n| 9 | The apparatus sinks as much as 20 feet in liquid. | The apparatus rises up to 20 feet in liquid. |\r\n| 10 | The rear hatch unseals and opens. | The rear hatch closes and seals. |",

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"armor_class": 0,
44
"category": "http://localhost:8000/v2/itemcategories/weapon/",
55
"cost": "10.00",
6-
"damage_immunities": [],
6+
"damage_immunities": [
7+
"http://localhost:8000/v2/damagetypes/poison/",
8+
"http://localhost:8000/v2/damagetypes/psychic/"
9+
],
710
"damage_resistances": [],
811
"damage_vulnerabilities": [],
912
"desc": "A short sword.",

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
"armor_class": 0,
44
"category": "http://localhost:8000/v2/itemcategories/weapon/",
55
"cost": "50.00",
6-
"damage_immunities": [],
6+
"damage_immunities": [
7+
"http://localhost:8000/v2/damagetypes/poison/",
8+
"http://localhost:8000/v2/damagetypes/psychic/"
9+
],
710
"damage_resistances": [],
811
"damage_vulnerabilities": [],
912
"desc": "A longbow.",

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

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"armor_class": 0,
88
"category": "http://localhost:8000/v2/itemcategories/adventuring-gear/",
99
"cost": "10.00",
10-
"damage_immunities": [],
10+
"damage_immunities": [
11+
"http://localhost:8000/v2/damagetypes/poison/",
12+
"http://localhost:8000/v2/damagetypes/psychic/"
13+
],
1114
"damage_resistances": [],
1215
"damage_vulnerabilities": [],
1316
"desc": "Can be used as an arcane focus.",
@@ -31,7 +34,10 @@
3134
"armor_class": 0,
3235
"category": "http://localhost:8000/v2/itemcategories/adventuring-gear/",
3336
"cost": "20.00",
34-
"damage_immunities": [],
37+
"damage_immunities": [
38+
"http://localhost:8000/v2/damagetypes/poison/",
39+
"http://localhost:8000/v2/damagetypes/psychic/"
40+
],
3541
"damage_resistances": [],
3642
"damage_vulnerabilities": [],
3743
"desc": "Can be used as an Arcane Focus.",
@@ -55,7 +61,10 @@
5561
"armor_class": 0,
5662
"category": "http://localhost:8000/v2/itemcategories/rod/",
5763
"cost": "10.00",
58-
"damage_immunities": [],
64+
"damage_immunities": [
65+
"http://localhost:8000/v2/damagetypes/poison/",
66+
"http://localhost:8000/v2/damagetypes/psychic/"
67+
],
5968
"damage_resistances": [],
6069
"damage_vulnerabilities": [],
6170
"desc": "Can be used as an arcane focus.",
@@ -79,7 +88,10 @@
7988
"armor_class": 0,
8089
"category": "http://localhost:8000/v2/itemcategories/staff/",
8190
"cost": "5.00",
82-
"damage_immunities": [],
91+
"damage_immunities": [
92+
"http://localhost:8000/v2/damagetypes/poison/",
93+
"http://localhost:8000/v2/damagetypes/psychic/"
94+
],
8395
"damage_resistances": [],
8496
"damage_vulnerabilities": [],
8597
"desc": "Can be used as an arcane focus.",
@@ -135,7 +147,10 @@
135147
"armor_class": 0,
136148
"category": "http://localhost:8000/v2/itemcategories/wand/",
137149
"cost": "10.00",
138-
"damage_immunities": [],
150+
"damage_immunities": [
151+
"http://localhost:8000/v2/damagetypes/poison/",
152+
"http://localhost:8000/v2/damagetypes/psychic/"
153+
],
139154
"damage_resistances": [],
140155
"damage_vulnerabilities": [],
141156
"desc": "Can be used as an arcane focus.",

0 commit comments

Comments
 (0)