فهرست منبع

Clarifying bounds on distances.
Moving object definitions in character out of the properties page.

Samuel Jaffe 8 سال پیش
والد
کامیت
5cf2cea419
4فایلهای تغییر یافته به همراه68 افزوده شده و 44 حذف شده
  1. 29 24
      schema/character.json
  2. 10 0
      schema/common.json
  3. 4 1
      schema/inventory.json
  4. 25 19
      schema/spell.json

+ 29 - 24
schema/character.json

@@ -4,14 +4,7 @@
     "name": {"type": "string"},
     "player": {"type": "string"},
     "classes": {
-      "items": {
-        "properties": {
-          "level": {"type": "integer", "minimum": 1},
-          "name": {"type": "string"},
-          "spellBook": {"$ref": "file:spellbook.json#"}
-        },
-        "type": "object"
-      },
+      "items": {"$ref": "#/definitions/classDetail"},
       "type": "array"
     },
     "race": {"type": "string"},
@@ -36,7 +29,26 @@
     "hair": {"type": "string"},
     "skin": {"type": "string"},
     "experience": {"type": "integer"},
-    "health": {
+    "health": {"$ref": "#/definitions/hitpoints"},
+    "abilities": {
+    },
+    "skills": {
+      "items": {"$ref": "#/definitions/skill"},
+      "type": "array"
+    },
+    "inventory": {"$ref": "file:inventory.json#"}
+  },
+  "type": "object",
+  "definitions": {
+    "classDetail": {
+      "properties": {
+        "level": {"type": "integer", "minimum": 1},
+        "name": {"type": "string"},
+        "spellBook": {"$ref": "file:spellbook.json#"}
+      },
+      "type": "object"
+    },
+    "hitpoints": {
       "properties": {
         "total": {"type": "integer", "minimum": 1},
         "rolled": {"type": "integer", "minimum": 1},
@@ -46,20 +58,13 @@
       },
       "type":"object"
     },
-    "abilities": {
-    },
-    "skills": {
-      "items": {
-        "properties": {
-          "name": {"type": "string"},
-          "ranks": {"type": "integer"},
-          "pointsSpent": {"type": "integer"}
-        },
-        "type": "object"
+    "skill": {
+      "properties": {
+        "name": {"type": "string"},
+        "ranks": {"type": "integer"},
+        "pointsSpent": {"type": "integer"}
       },
-      "type": "array"
-    },
-    "inventory": {"$ref": "file:inventory.json#"}
-  },
-  "type": "object"
+      "type": "object"
+    }
+  }
 }

+ 10 - 0
schema/common.json

@@ -0,0 +1,10 @@
+{
+  "$schema": "http://json-schema.org/draft-06/schema#",
+  "definitions": {
+    "distance": {
+      "type": "integer",
+      "exclusiveMinimum": 0,
+      "multipleOf": 5
+    }
+  }
+}

+ 4 - 1
schema/inventory.json

@@ -91,7 +91,10 @@
         "criticalDamage": {"type": "integer", "minimum": 2},
         "secondaryCriticalDamage": {"type": "integer", "minimum": 2},
         "range": {
-          "type": "string"
+          "oneOf": [
+            {"type": "string", "const":"Melee"},
+            {"$ref": "file:common.json#/definitions/distance"}
+          ]
         },
         "type": {
           "type": "string", 

+ 25 - 19
schema/spell.json

@@ -13,7 +13,8 @@
       ]
     },
     "castingTime": {
-      "type": "string"
+      "type": "string",
+      "enum": ["Free", "Swift", "Move", "Standard", "Full"]
     },
     "classToLevel": {
       "patternProperties": {
@@ -85,7 +86,7 @@
       "Line": {
         "properties":{
           "@type": {"const": "Line"},
-          "distance": {"type": "integer"}
+          "distance": {"$ref": "file:common.json#/definitions/distance"}
         },
         "additionalProperties": false
       },
@@ -99,7 +100,12 @@
       "Sphere": {
         "properties":{
           "@type": {"const": "Sphere"},
-          "radius": {"type": "integer"},
+          "radius": {
+            "oneOf": [
+              {"const": 0},
+              {"$ref": "file:common.json#/definitions/distance"}
+            ]
+          },
           "emit": {"enum": ["BURST", "EMANATION", "SPREAD", "NONE"]},
           "aroundYou": {"type": "boolean"}
         },
@@ -108,8 +114,8 @@
       "Cylinder": {
         "properties":{
           "@type": {"const": "Cylinder"},
-          "radius": {"type": "integer"},
-          "height": {"type": "integer"}
+          "radius": {"$ref": "file:common.json#/definitions/distance"},
+          "height": {"$ref": "file:common.json#/definitions/distance"}
         },
         "additionalProperties": false
       }
@@ -119,9 +125,9 @@
         "per": ["step"]
       },
       "properties":{
-        "duration": {"type": "integer"},
-        "per": {"type": "integer"},
-        "step": {"type": "integer"},
+        "duration": {"type": "integer", "exclusiveMinimum": 0},
+        "per": {"type": "integer", "exclusiveMinimum": 0},
+        "step": {"type": "integer", "exclusiveMinimum": 0},
         "unit":{
           "enum": ["round", "minute", "hour", "day"]
         }
@@ -139,13 +145,13 @@
         "upto":["per", "resolved"]
       },
       "properties": {
-        "beyond": {"type": "integer"},
-        "count": {"type": "integer"},
+        "beyond": {"type": "integer", "exclusiveMinimum": 0},
+        "count": {"type": "integer", "exclusiveMinimum": 0},
         "format": {"type": "string"},
-        "per": {"type": "integer"},
+        "per": {"type": "integer", "exclusiveMinimum": 0},
         "resolved": {"type": "string"},
-        "step": {"type": "integer"},
-        "upto": {"type": "integer"}
+        "step": {"type": "integer", "exclusiveMinimum": 0},
+        "upto": {"type": "integer", "exclusiveMinimum": 0}
       },
       "required": ["format"],
       "type": "object",
@@ -157,9 +163,9 @@
       },
       "properties": {
         "name": {"type": "string"},
-        "range": {"type": "integer"},
-        "per": {"type": "integer"},
-        "step": {"type": "integer"}
+        "range": {"$ref": "file:common.json#/definitions/distance"},
+        "per": {"$ref": "file:common.json#/definitions/distance"},
+        "step": {"type": "integer", "exclusiveMinimum": 0}
       },
       "type": "object",
       "required": ["name", "range"],
@@ -167,11 +173,11 @@
     },
     "target": {
       "properties": {
-        "count": {"type": "integer"},
+        "count": {"type": "integer", "exclusiveMinimum": 0},
         "format": {"type": "string"},
-        "per": {"type": "integer"},
+        "per": {"type": "integer", "exclusiveMinimum": 0},
         "resolved": {"type": "string"},
-        "step": {"type": "integer"}
+        "step": {"type": "integer", "exclusiveMinimum": 0}
       },
       "required": ["format", "resolved", "count", "per", "step"],
       "type": "object",