瀏覽代碼

Adding ability scores, combining Base and Temp into a single structure, instead of existing in parallel. This will allow them to be used in concert safely.

Samuel Jaffe 8 年之前
父節點
當前提交
4025ccc7a5
共有 2 個文件被更改,包括 26 次插入17 次删除
  1. 7 17
      resources/Potato.json
  2. 19 0
      schema/character.json

+ 7 - 17
resources/Potato.json

@@ -87,23 +87,13 @@
     "nonlethal": 0
   },
   
-  "abilities":{
-    "base": {
-      "str": 14,
-      "dex": 10,
-      "con": 15,
-      "int": 12,
-      "wis": 17,
-      "cha": 11
-    },
-    "temp": {
-      "str": -1,
-      "dex": -1,
-      "con": -1,
-      "int": -1,
-      "wis": -1,
-      "cha": -1
-    }
+  "abilities": {
+    "str": {"base": 14, "temp": -1},
+    "dex": {"base": 10, "temp": -1},
+    "con": {"base": 15, "temp": -1},
+    "int": {"base": 12, "temp": -1},
+    "wis": {"base": 17, "temp": -1},
+    "cha": {"base": 11, "temp": -1}
   },
   
   "skills": [

+ 19 - 0
schema/character.json

@@ -31,6 +31,18 @@
     "experience": {"type": "integer"},
     "health": {"$ref": "#/definitions/hitpoints"},
     "abilities": {
+      "propertyNames": {
+        "type": "string",
+        "enum": ["str", "dex", "con", "int", "wis", "cha"]
+      },
+      "additionalProperties": {
+        "properties": {
+          "base": {"$ref": "#/definitions/abilityScore"},
+          "temp": {"$ref": "#/definitions/abilityScore"}
+        },
+        "additionalProperties": false,
+        "type": "object"
+      }
     },
     "skills": {
       "items": {"$ref": "#/definitions/skill"},
@@ -40,6 +52,13 @@
   },
   "type": "object",
   "definitions": {
+    "abilityScore": {
+      "type": "integer",
+      "oneOf": [
+        {"const": -1},
+        {"exclusiveMinimum": 0}
+      ]
+    },
     "classDetail": {
       "properties": {
         "level": {"type": "integer", "minimum": 1},