Ver código fonte

Fixing jsonization of Area objects.
Adding illustrative example.

Sam Jaffe 8 anos atrás
pai
commit
03b0441215

+ 29 - 0
resources/spells/default.json

@@ -50,6 +50,35 @@
     "allowsSpellResistance":true,
     "description":"When laying your hand upon a living creature, you channel positive energy that cures 1d8 points of damage +1 point per caster level (maximum +5). Since undead are powered by negative energy, this spell deals damage to them instead of curing their wounds. An undead creature can apply spell resistance, and can attempt a Will save to take half damage."
   },
+  "Flame Strike":{
+    "name":"Flame Strike",
+    "classToLevel":{
+      "Cleric":5,
+      "Druid":4,
+      "Sun":5,
+      "War":5
+    },
+    "school":"Evocation",
+    "keywords":["Fire"],
+    "components":["V", "S", "DF"],
+    "castingTime":"Standard",
+    "range":"Medium",
+    "area":{
+      "@type":"Cylinder",
+      "radius":10,
+      "height":40
+    },
+    "effect":{
+      "format":"1d6 fire damage/level",
+      "resolved":"{atlevel}d6 fire damage",
+      "per":1,
+      "upto":15
+    },
+    "duration":"Instantaneous",
+    "savingThrow":"Reflex half",
+    "allowsSpellResistance":false,
+    "description":"A flame strike produces a vertical column of divine fire roaring downward. The spell deals 1d6 points of damage per caster level (maximum 15d6). Half the damage is fire damage, but the other half results directly from divine power and is therefore not subject to being reduced by resistance to fire-based attacks, such as that granted by protection from energy (fire), fire shield (chill shield), and similar magic."
+  },
   "Know Direction":{
     "name":"Know Direction",
     "classToLevel":{

+ 8 - 0
src/org/leumasjaffe/charsheet/model/magic/dimension/Area.java

@@ -2,6 +2,8 @@ package org.leumasjaffe.charsheet.model.magic.dimension;
 
 import org.leumasjaffe.charsheet.util.StringHelper;
 
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
 import com.fasterxml.jackson.annotation.JsonTypeInfo;
 import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
 
@@ -11,6 +13,12 @@ import lombok.RequiredArgsConstructor;
 import lombok.experimental.FieldDefaults;
 
 @JsonTypeInfo(use=Id.NAME)
+@JsonSubTypes({
+	@Type(value=Area.Line.class, name="Line"),
+	@Type(value=Area.Cone.class, name="Cone"),
+	@Type(value=Area.Sphere.class, name="Sphere"),
+	@Type(value=Area.Cylinder.class, name="Cylinder")
+})
 public interface Area {
 	public static enum Emission { BURST, EMANATION, SPREAD, NONE }
 	public static enum Shape { CONE, CYLINDER, LINE, SPHERE }