Skip to content

Commit 0aea7c5

Browse files
Merge pull request open5e#780 from open5e/709-revisit-object-stats-for-size-immunities-ac-and-hp
709 revisit object stats for size immunities ac and hp
2 parents ba269b5 + 6108b17 commit 0aea7c5

7 files changed

+37
-101
lines changed

api_v2/serializers/item.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def get_distance_unit(self, Weapon):
7979
return Weapon.get_distance_unit
8080

8181
def get_properties(self, instance):
82-
properties = instance.properties.all().order_by('-property_id')
82+
properties = instance.properties.all().order_by("pk")
8383
return WeaponPropertyAssignmentSerializer(properties, context={'request': None}, many=True).data
8484

8585
class WeaponSummarySerializer(GameContentSerializer):
@@ -139,7 +139,7 @@ class ItemSerializer(GameContentSerializer):
139139
document = DocumentSummarySerializer()
140140
category = ItemCategorySummarySerializer()
141141
rarity = ItemRaritySerializer()
142-
damage_immunities = DamageTypeSummarySerializer(many=True)
142+
#damage_immunities = DamageTypeSummarySerializer(many=True)
143143
size = SizeSummarySerializer()
144144
weight_unit = serializers.SerializerMethodField()
145145

@@ -149,7 +149,23 @@ def get_weight_unit(self, item):
149149

150150
class Meta:
151151
model = models.Item
152-
fields = '__all__'
152+
fields = [
153+
'url',
154+
'key',
155+
'name',
156+
'desc',
157+
'category',
158+
'rarity',
159+
'is_magic_item',
160+
'weapon',
161+
'armor',
162+
'size',
163+
'weight',
164+
'weight_unit',
165+
'cost',
166+
'requires_attunement',
167+
'document',]
168+
153169

154170
class ItemSummarySerializer(GameContentSerializer):
155171
class Meta:

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,12 @@
1111
"strength_score_required": 15,
1212
"url": "http://localhost:8000/v2/armor/srd_splint/"
1313
},
14-
"armor_class": 0,
15-
"armor_detail": "",
1614
"category": {
1715
"key": "armor",
1816
"name": "Armor",
1917
"url": "http://localhost:8000/v2/itemcategories/armor/"
2018
},
2119
"cost": "200.00",
22-
"damage_immunities": [
23-
{
24-
"key": "poison",
25-
"name": "Poison",
26-
"url": "http://localhost:8000/v2/damagetypes/poison/"
27-
},
28-
{
29-
"key": "psychic",
30-
"name": "Psychic",
31-
"url": "http://localhost:8000/v2/damagetypes/psychic/"
32-
}
33-
],
34-
"damage_resistances": [],
35-
"damage_vulnerabilities": [],
3620
"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.",
3721
"document": {
3822
"display_name": "5e 2014 Rules",
@@ -50,13 +34,9 @@
5034
"url": "http://localhost:8000/v2/publishers/wizards-of-the-coast/"
5135
}
5236
},
53-
"hit_dice": null,
54-
"hit_points": 0,
5537
"is_magic_item": false,
5638
"key": "srd_splint-armor",
5739
"name": "Splint Armor",
58-
"nonmagical_attack_immunity": false,
59-
"nonmagical_attack_resistance": false,
6040
"rarity": null,
6141
"requires_attunement": false,
6242
"size": {

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
11
{
22
"armor": null,
3-
"armor_class": 0,
4-
"armor_detail": "",
53
"category": {
64
"key": "wondrous-item",
75
"name": "Wondrous Item",
86
"url": "http://localhost:8000/v2/itemcategories/wondrous-item/"
97
},
108
"cost": "0.00",
11-
"damage_immunities": [
12-
{
13-
"key": "poison",
14-
"name": "Poison",
15-
"url": "http://localhost:8000/v2/damagetypes/poison/"
16-
},
17-
{
18-
"key": "psychic",
19-
"name": "Psychic",
20-
"url": "http://localhost:8000/v2/damagetypes/psychic/"
21-
}
22-
],
23-
"damage_resistances": [],
24-
"damage_vulnerabilities": [],
259
"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. |",
2610
"document": {
2711
"display_name": "5e 2014 Rules",
@@ -39,13 +23,9 @@
3923
"url": "http://localhost:8000/v2/publishers/wizards-of-the-coast/"
4024
}
4125
},
42-
"hit_dice": null,
43-
"hit_points": 0,
4426
"is_magic_item": true,
4527
"key": "srd_apparatus-of-the-crab",
4628
"name": "Apparatus of the Crab",
47-
"nonmagical_attack_immunity": false,
48-
"nonmagical_attack_resistance": false,
4929
"rarity": {
5030
"key": "legendary",
5131
"name": "Legendary",

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
11
{
22
"armor": null,
3-
"armor_class": 0,
4-
"armor_detail": "",
53
"category": {
64
"key": "weapon",
75
"name": "Weapon",
86
"url": "http://localhost:8000/v2/itemcategories/weapon/"
97
},
108
"cost": "10.00",
11-
"damage_immunities": [
12-
{
13-
"key": "poison",
14-
"name": "Poison",
15-
"url": "http://localhost:8000/v2/damagetypes/poison/"
16-
},
17-
{
18-
"key": "psychic",
19-
"name": "Psychic",
20-
"url": "http://localhost:8000/v2/damagetypes/psychic/"
21-
}
22-
],
23-
"damage_resistances": [],
24-
"damage_vulnerabilities": [],
259
"desc": "A short sword.",
2610
"document": {
2711
"display_name": "5e 2014 Rules",
@@ -39,13 +23,9 @@
3923
"url": "http://localhost:8000/v2/publishers/wizards-of-the-coast/"
4024
}
4125
},
42-
"hit_dice": null,
43-
"hit_points": 0,
4426
"is_magic_item": false,
4527
"key": "srd_shortsword",
4628
"name": "Shortsword",
47-
"nonmagical_attack_immunity": false,
48-
"nonmagical_attack_resistance": false,
4929
"rarity": null,
5030
"requires_attunement": false,
5131
"size": {

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

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
11
{
22
"armor": null,
3-
"armor_class": 0,
4-
"armor_detail": "",
53
"category": {
64
"key": "weapon",
75
"name": "Weapon",
86
"url": "http://localhost:8000/v2/itemcategories/weapon/"
97
},
108
"cost": "50.00",
11-
"damage_immunities": [
12-
{
13-
"key": "poison",
14-
"name": "Poison",
15-
"url": "http://localhost:8000/v2/damagetypes/poison/"
16-
},
17-
{
18-
"key": "psychic",
19-
"name": "Psychic",
20-
"url": "http://localhost:8000/v2/damagetypes/psychic/"
21-
}
22-
],
23-
"damage_resistances": [],
24-
"damage_vulnerabilities": [],
259
"desc": "A longbow.",
2610
"document": {
2711
"display_name": "5e 2014 Rules",
@@ -39,13 +23,9 @@
3923
"url": "http://localhost:8000/v2/publishers/wizards-of-the-coast/"
4024
}
4125
},
42-
"hit_dice": null,
43-
"hit_points": 0,
4426
"is_magic_item": false,
4527
"key": "srd_longbow",
4628
"name": "Longbow",
47-
"nonmagical_attack_immunity": false,
48-
"nonmagical_attack_resistance": false,
4929
"rarity": null,
5030
"requires_attunement": false,
5131
"size": {
@@ -69,19 +49,19 @@
6949
"name": "Longbow",
7050
"properties": [
7151
{
72-
"detail": null,
52+
"detail": "range 150/600",
7353
"property": {
74-
"name": "Two-Handed",
54+
"name": "Ammunition",
7555
"type": null,
76-
"url": "http://localhost:8000/v2/weaponproperties/srd-2014_two-handed-wp/"
56+
"url": "http://localhost:8000/v2/weaponproperties/srd-2014_ammunition-wp/"
7757
}
7858
},
7959
{
80-
"detail": "range 150/600",
60+
"detail": null,
8161
"property": {
82-
"name": "Ammunition",
62+
"name": "Two-Handed",
8363
"type": null,
84-
"url": "http://localhost:8000/v2/weaponproperties/srd-2014_ammunition-wp/"
64+
"url": "http://localhost:8000/v2/weaponproperties/srd-2014_two-handed-wp/"
8565
}
8666
}
8767
],

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@
3131
{
3232
"detail": null,
3333
"property": {
34-
"name": "Light",
34+
"name": "Finesse",
3535
"type": null,
36-
"url": "/v2/weaponproperties/srd-2014_light-wp/"
36+
"url": "/v2/weaponproperties/srd-2014_finesse-wp/"
3737
}
3838
},
3939
{
4040
"detail": null,
4141
"property": {
42-
"name": "Finesse",
42+
"name": "Light",
4343
"type": null,
44-
"url": "/v2/weaponproperties/srd-2014_finesse-wp/"
44+
"url": "/v2/weaponproperties/srd-2014_light-wp/"
4545
}
4646
}
4747
],

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@
2828
"long_range": 0.0,
2929
"name": "Longsword",
3030
"properties": [
31-
{
32-
"detail": "1d10",
33-
"property": {
34-
"name": "Versatile",
35-
"type": null,
36-
"url": "/v2/weaponproperties/srd-2024_versatile-wp/"
37-
}
38-
},
3931
{
4032
"detail": null,
4133
"property": {
4234
"name": "Sap",
4335
"type": "Mastery",
4436
"url": "/v2/weaponproperties/srd-2024_sap-mastery/"
4537
}
38+
},
39+
{
40+
"detail": "1d10",
41+
"property": {
42+
"name": "Versatile",
43+
"type": null,
44+
"url": "/v2/weaponproperties/srd-2024_versatile-wp/"
45+
}
4646
}
4747
],
4848
"range": 0.0,

0 commit comments

Comments
 (0)