Pārlūkot izejas kodu

Fixing bug in Effect that hit step and upto because they lacked setters.
Fixing bug in spell json, spellResistance field has wrong name.
Add spell "Cure Light Wounds" to demo effect resolution.

Sam Jaffe 8 gadi atpakaļ
vecāks
revīzija
78daa12cb1

+ 7 - 2
resources/Potato.json

@@ -23,8 +23,13 @@
           },
           "1":{
             "spellsPerDay":2,
-            "spellsPrepared":[],
-            "spellsPreparedPreviously":[]
+            "spellsPrepared":[
+              "Cure Light Wounds"
+            ],
+            "spellsPreparedPreviously":[
+              "Cure Light Wounds",
+              "Cure Light Wounds"
+            ]
           },
           "2":{
             "spellsPerDay":1,

+ 2 - 1
resources/classes/Cleric.json

@@ -51,7 +51,8 @@
       [6, 5, 5, 5, 5, 5, 4, 4, 4, 4]
     ],
     "spellList":[
-      ["Create Water"]
+      ["Create Water"],
+      ["Cure Light Wounds"]
     ]
   }
 }

+ 29 - 1
resources/spells/default.json

@@ -19,9 +19,37 @@
     },
     "duration":"Instantaneous",
     "savingThrow":"None",
-    "spellResistence":false,
+    "allowsSpellResistance":false,
     "description":"This spell generates wholesome, drinkable water, just like clean rain water. Water can be created in an area as small as will actually contain the liquid, or in an area three times as large—possibly creating a downpour or filling many small receptacles. Note: Conjuration spells can't create substances or objects within a creature. Water weighs about 8 pounds per gallon. One cubic foot of water contains roughly 8 gallons and weighs about 60 pounds."
   },
+  "Cure Light Wounds":{
+    "name":"Cure Light Wounds",
+    "classToLevel":{
+      "Bard":1,
+      "Cleric":1,
+      "Druid":1,
+      "Healing":1,
+      "Paladin":1,
+      "Ranger":2
+    },
+    "school":"Conjuration",
+    "subSchool":"Healing",
+    "components":["V", "S"],
+    "keywords":[],
+    "castingTime":"Standard",
+    "range":"Touch",
+    "target":"Creature Touched",
+    "effect":{
+      "format":"1d8 + {perlevel} per level (maximum +{upto})",
+      "resolved":"1d8 + {atlevel}",
+      "perlevel":1,
+      "upto":5
+    },
+    "duration":"Instantaneous",
+    "savingThrow":"Will half (harmless)",
+    "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."
+  },
   "Know Direction":{
     "name":"Know Direction",
     "classToLevel":{

+ 3 - 1
src/org/leumasjaffe/charsheet/model/magic/Effect.java

@@ -4,8 +4,10 @@ import org.leumasjaffe.charsheet.util.StringHelper;
 import org.leumasjaffe.format.Named;
 
 import lombok.AccessLevel;
+import lombok.Getter;
 import lombok.NonNull;
 import lombok.RequiredArgsConstructor;
+import lombok.Setter;
 import lombok.experimental.FieldDefaults;
 import lombok.experimental.NonFinal;
 
@@ -15,7 +17,7 @@ public class Effect {
 	@NonNull String format;
 	String resolved;
 	int count, perlevel, beyond;
-	@NonFinal int step = 1, upto = Integer.MAX_VALUE;
+	@NonFinal @Setter(AccessLevel.PRIVATE) @Getter(AccessLevel.PRIVATE) int step = 1, upto = Integer.MAX_VALUE;
 	
 	public String getResolved(int level) {
 		final int result = count + perlevel * ((Math.min(level, upto)-beyond) / step);