Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

464 add monster filter for habitat similar to cr #599

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions api_v2/migrations/0014_environment_interior.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.2 on 2024-10-27 11:53

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api_v2', '0013_size_suggested_hit_dice'),
]

operations = [
migrations.AddField(
model_name='environment',
name='interior',
field=models.BooleanField(default=False, help_text='Whether or not this environment is an interior space.'),
),
]
18 changes: 18 additions & 0 deletions api_v2/migrations/0015_creature_environments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.1.2 on 2024-10-27 12:05

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api_v2', '0014_environment_interior'),
]

operations = [
migrations.AddField(
model_name='creature',
name='environments',
field=models.ManyToManyField(related_name='creature_environments', to='api_v2.environment'),
),
]
4 changes: 4 additions & 0 deletions api_v2/models/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .condition import Condition
from .damagetype import DamageType
from .document import FromDocument
from .environment import Environment
from .speed import HasSpeed
from .enums import CREATURE_ATTACK_TYPES, CREATURE_USES_TYPES, ACTION_TYPES
import decimal
Expand Down Expand Up @@ -81,6 +82,9 @@ class Creature(Object, HasAbilities, HasSenses, HasLanguage, HasSpeed, FromDocum
help_text="Optional override for calculated XP based on CR."
)

environments = models.ManyToManyField(Environment,
related_name="creature_environments")

def as_text(self):
text = self.name + '\n'
for action in self.creatureaction_set.all():
Expand Down
4 changes: 4 additions & 0 deletions api_v2/models/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class Environment(HasName, HasDescription, FromDocument):
help_text='Whether or not this environment is a plane of existence.',
default=False)

interior = models.BooleanField(
help_text='Whether or not this environment is an interior space.',
default=False)

class Meta:
"""To assist with the UI layer."""

Expand Down
3 changes: 2 additions & 1 deletion api_v2/serializers/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ class Meta:
'tremorsense_range',
'truesight_range',
'actions',
'creaturesets'
'creaturesets',
'environments'
]

@extend_schema_field(inline_serializer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@
"damage_vulnerabilities": [],
"darkvision_range": 120.0,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/hills/",
"http://localhost:8000/v2/environments/mountain/"
],
"experience_points": 62000,
"hit_dice": "28d20+252",
"hit_points": 546,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@
"damage_vulnerabilities": [],
"darkvision_range": 60.0,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/arctic/",
"http://localhost:8000/v2/environments/caves/",
"http://localhost:8000/v2/environments/desert/",
"http://localhost:8000/v2/environments/forest/",
"http://localhost:8000/v2/environments/grassland/",
"http://localhost:8000/v2/environments/hills/",
"http://localhost:8000/v2/environments/mountain/",
"http://localhost:8000/v2/environments/ruins/",
"http://localhost:8000/v2/environments/sewer/",
"http://localhost:8000/v2/environments/srd_feywild/",
"http://localhost:8000/v2/environments/swamp/",
"http://localhost:8000/v2/environments/underworld/",
"http://localhost:8000/v2/environments/urban/"
],
"experience_points": 50,
"hit_dice": "2d6",
"hit_points": 7,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/coast/",
"http://localhost:8000/v2/environments/desert/",
"http://localhost:8000/v2/environments/forest/",
"http://localhost:8000/v2/environments/grassland/",
"http://localhost:8000/v2/environments/hills/",
"http://localhost:8000/v2/environments/mountain/",
"http://localhost:8000/v2/environments/urban/"
],
"experience_points": 25,
"hit_dice": "2d8+2",
"hit_points": 11,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/desert/",
"http://localhost:8000/v2/environments/urban/"
],
"experience_points": 25,
"hit_dice": "2d10+4",
"hit_points": 15,
Expand Down Expand Up @@ -158,6 +162,7 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [],
"experience_points": 0,
"hit_dice": null,
"hit_points": 11,
Expand Down Expand Up @@ -291,6 +296,9 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/urban/"
],
"experience_points": 50,
"hit_dice": "3d10+3",
"hit_points": 19,
Expand Down Expand Up @@ -436,6 +444,11 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/desert/",
"http://localhost:8000/v2/environments/forest/",
"http://localhost:8000/v2/environments/grassland/"
],
"experience_points": 1100,
"hit_dice": "8d12+24",
"hit_points": 76,
Expand Down Expand Up @@ -569,6 +582,11 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/forest/",
"http://localhost:8000/v2/environments/hills/",
"http://localhost:8000/v2/environments/urban/"
],
"experience_points": 25,
"hit_dice": "1d8+1",
"hit_points": 5,
Expand Down Expand Up @@ -702,6 +720,11 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/grassland/",
"http://localhost:8000/v2/environments/hills/",
"http://localhost:8000/v2/environments/urban/"
],
"experience_points": 25,
"hit_dice": "2d8+2",
"hit_points": 11,
Expand Down Expand Up @@ -835,6 +858,10 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/mountain/",
"http://localhost:8000/v2/environments/urban/"
],
"experience_points": 25,
"hit_dice": "2d8+2",
"hit_points": 11,
Expand Down Expand Up @@ -968,6 +995,10 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/grassland/",
"http://localhost:8000/v2/environments/urban/"
],
"experience_points": 50,
"hit_dice": "2d10+2",
"hit_points": 13,
Expand Down Expand Up @@ -1101,6 +1132,9 @@
"damage_vulnerabilities": [],
"darkvision_range": null,
"document": "http://localhost:8000/v2/documents/srd/",
"environments": [
"http://localhost:8000/v2/environments/urban/"
],
"experience_points": 100,
"hit_dice": "3d10+3",
"hit_points": 19,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"aquatic": false,
"desc": "The **Astral Plane** is the realm of thought and dream, where visitors travel as disembodied souls to reach the planes of the divine and demonic. It is a great, silvery sea, the same above and below, with swirling wisps of white and gray streaking among motes of light resembling distant stars. Erratic whirlpools of color flicker in midair like spinning coins. Occasional bits of solid matter can be found here, but most of the Astral Plane is an endless, open domain.",
"document": "http://localhost:8000/v2/documents/srd/",
"interior": false,
"key": "srd_astral-plane",
"name": "Astral Plane",
"planar": true,
Expand Down
Loading
Loading