Kaynağa Gözat

Fixing formatting errors in spell schema.
Adding spell book schema for use in character definitions.

Samuel Jaffe 8 yıl önce
ebeveyn
işleme
fc492c5a1d
2 değiştirilmiş dosya ile 114 ekleme ve 20 silme
  1. 18 20
      schema/spell_schema.json
  2. 96 0
      schema/spellbook_schema.json

+ 18 - 20
schema/spell_schema.json

@@ -5,30 +5,30 @@
       "type": "boolean"
     },
     "area": {
-      "oneOf"[
+      "oneOf":[
         {
           "properties":{
-            "@type": {"type": "string", "enum": ["Line"]},
+            "@type": {"enum": ["Line"]},
             "distance": {"type": "integer"}
           }
         },
         {
           "properties":{
-            "@type": {"type": "string", "enum": ["Emission"]},
-            "emit": {"type": "string", "enum": ["BURST", "EMANATION", "SPREAD", "NONE"]}
+            "@type": {"enum": ["Emission"]},
+            "emit": {"enum": ["BURST", "EMANATION", "SPREAD", "NONE"]}
           }
         },
         {
           "properties":{
-            "@type": {"type": "string", "enum": ["Sphere"]},
+            "@type": {"enum": ["Sphere"]},
             "radius": {"type": "integer"},
-            "emit": {"type": "string", "enum": ["BURST", "EMANATION", "SPREAD", "NONE"]},
+            "emit": {"enum": ["BURST", "EMANATION", "SPREAD", "NONE"]},
             "aroundYou": {"type": "boolean"}
           }
         },
         {
           "properties":{
-            "@type": {"type": "string", "enum": ["Cylinder"]},
+            "@type": {"enum": ["Cylinder"]},
             "radius": {"type": "integer"},
             "height": {"type": "integer"}
           }
@@ -40,13 +40,12 @@
     },
     "classToLevel": {
       "patternProperties": {
-        "^.*$": {"type": "integer"}
+        "^.*$": {"type": "integer", "minimum":0, "maximum":9}
       },
       "type": "object"
     },
     "components": {
       "items": { 
-        "type": "string",
         "enum": ["V", "S", "M", "F", "DF", "M_DF", "F_DF", "XP"]
       },
       "type": "array"
@@ -60,16 +59,15 @@
         {
           "dependencies":{
             "per": ["step"]
-          }
-          "properties"{
+          },
+          "properties":{
             "duration": {"type": "integer"},
             "per": {"type": "integer"},
             "step": {"type": "integer"},
             "unit":{
-              "type": "string",
               "enum": ["round", "minute", "hour", "day"]
             }
-          }
+          },
           "required": ["unit", "duration"],
           "type": "object",
           "additionalProperties": false
@@ -79,10 +77,10 @@
     "effect": {
       "dependencies":{
         "beyond":["per", "resolved"],
-        "count":["resolved"]
+        "count":["resolved"],
         "per":["resolved"],
         "step":["per", "resolved"],
-        "upto":["per", "resolved"],
+        "upto":["per", "resolved"]
       },
       "properties": {
         "beyond": {"type": "integer"},
@@ -107,13 +105,12 @@
     "range": {
       "oneOf": [
         { 
-          "type": "string",
           "enum": ["Touch", "Close", "Medium", "Long", "Unlimited"]
         },
         {
           "dependencies": {
             "per": ["step"]
-          }
+          },
           "properties": {
             "name": {"type": "string"},
             "range": {"type": "integer"},
@@ -123,7 +120,7 @@
           "type": "object",
           "required": ["name", "range"],
           "additionalProperties": false
-        },
+        }
       ]
     },
     "savingThrow": {
@@ -146,7 +143,7 @@
             "format": {"type": "string"},
             "per": {"type": "integer"},
             "resolved": {"type": "string"},
-            "step": {"type": "integer"},
+            "step": {"type": "integer"}
           },
           "required": ["format", "resolved", "count", "per", "step"],
           "type": "object",
@@ -169,4 +166,5 @@
     "savingThrow"
   ],
   "type": "object"
-}
+}
+

+ 96 - 0
schema/spellbook_schema.json

@@ -0,0 +1,96 @@
+{
+  "$schema": "http://json-schema.org/draft-04/schema#",
+  "definitions": {
+    "names": {
+      "items": {"type": "string"},
+      "type": "array"
+    }
+  },
+  "properties": {
+    "@class": {"type": "string"},
+    "classRef": {"type": "string"},
+    "spellInfo": {
+      "patternProperties": {
+        "^[0-9]$": {
+          "properties": {
+            "spellsPerDay": {"type": "integer"},
+            "spellsPerDayRemaining": {"type": "integer"},
+            "spellsKnown": {"$ref": "#/definitions/names"},
+            "spellsPrepared": {"$ref": "#/definitions/names"},
+            "spellsPreparedPreviously": {"$ref": "#/definitions/names"}
+          },
+          "type": "object"
+        }
+      },
+      "type": "object"
+    }
+  },
+  "oneOf": [
+    {
+      "properties": {
+        "@class": {
+          "enum": [
+            "org.leumasjaffe.charsheet.model.magic.impl.Inspired"
+          ]
+        },
+        "spellInfo": {
+          "^[0-9]$": {
+            "required": [
+              "spellsPerDay",
+              "spellsPrepared",
+              "spellsPreparedPreviously"
+            ],
+            "additionalProperties":false
+          }
+        }
+      }
+    },
+    {
+      "properties": {
+        "@class": {
+          "enum": [
+            "org.leumasjaffe.charsheet.model.magic.impl.Spontaneous"
+          ]
+        },
+        "spellInfo": {
+          "^[0-9]$": {
+            "required": [
+              "spellsPerDay",
+              "spellsPerDayRemaining",
+              "spellsKnown"
+            ],
+            "additionalProperties":false
+          }
+        }
+      }
+    },
+    {
+      "properties": {
+        "@class": {
+          "enum": [
+            "org.leumasjaffe.charsheet.model.magic.impl.Researched",
+            "org.leumasjaffe.charsheet.model.magic.impl.Unearthed"
+          ]
+        },
+        "spellInfo": {
+          "^[0-9]$": {
+            "required": [
+              "spellsPerDay",
+              "spellsPerDayRemaining",
+              "spellsKnown",
+              "spellsPrepared",
+              "spellsPreparedPreviously"
+            ],
+            "additionalProperties":false
+          }
+        }
+      }
+    }
+  ],
+  "required": [
+    "@class",
+    "classRef",
+    "spellInfo"
+  ],
+  "type": "object"
+}