5e-bits / 5e-database

Database for the D&D 5th Edition API
http://dnd5eapi.co/
MIT License
716 stars 353 forks source link

Monster's damage vulnerabilities, resistances and immunities should be NamedAPIResource structures #246

Open fergcb opened 4 years ago

fergcb commented 4 years ago

Using full references makes the content better digestible by data-consuming applications, and also brings the structure of monsters' damage immunities/etc. in line with the structure of their condition immunities.

Instead of this:

damage_immunities: [
    "acid"
]

We should see this:

damage_immunities: [
    {
        "index": "acid",
        "name": "Acid",
        "url": "/api/damage-types/acid"
    }
]
bagelbits commented 4 years ago

I see your 100% reasonable suggestion and raise you Erinyes:

    "damage_resistances": [
      "cold",
      "bludgeoning, piercing, and slashing from nonmagical weapons that aren't silvered"
    ],

There's a bunch of other examples in monsters that make this a rather complicated problem. I suggestion taking a stroll through them. :D

fergcb commented 4 years ago

Perhaps other field(s) could be useful for information about the conditions necessary for the resistance/vulnerabilities?

ogregoire commented 4 years ago

Side question: what is that NamedAPIResource? It's the structure with name, index and url? Is it defined somewhere? I don't see it anywhere in the repo...

The damage resistance is the worst in terms of dataifying the SRD. I couldn't find anything rather simple without having a full-fledged interpreter.

fergcb commented 4 years ago

It's defined in the API documentation (which does actually need updating), but the definition there is this:

Name Description Data Type
index The resource index for shorthand searching. string
name The name of the referenced resource string
url The URL of the referenced resource string

Quite a few places in the actual data are missing the index attribute, but I'm looking to address that with a different issue I've opened, #243.

bagelbits commented 4 years ago

Perhaps other field(s) could be useful for information about the conditions necessary for the resistance/vulnerabilities?

We might be able to take a similar approach with what I suggested for languages. Keep the original string as is and break it apart into things that can be referenced and things that are weird.

Drazev commented 3 years ago

Hmmm, @bagelbits has quite the monster enigma there lol.

I think that it may be best to leave it as a list of strings. Really, damage types are nothing but an enumeration type since in DND5e the individual damage type themselves don't actually have a any game rules associated with them. The concequence of a damage type is generally left to the description of the attack.

With that being said, it could potentially work if there was a "special" damage type in the resource. That could allow the subdocument version in the monster docs to be customized with a description key added in. It would mostly just serve as a way for a programmer to identify special cases that they will need to resolve.

bagelbits commented 3 years ago

Really, damage types are nothing but an enumeration type since in DND5e the individual damage type themselves don't actually have a any game rules associated with them.

Though they are also left up to the imagination of the DM and players with certain damage types.