Browse Source

Fleshing out constructor

combat-2
MagicBot 9 months ago
parent
commit
9bf7c088cf
  1. 10
      src/engine/objects/ItemTemplate.java

10
src/engine/objects/ItemTemplate.java

@ -12,6 +12,8 @@ import engine.math.Vector3fImmutable;
import org.json.simple.JSONArray; import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -24,10 +26,13 @@ public class ItemTemplate {
public String obj_name = ""; public String obj_name = "";
public Vector3fImmutable obj_scale = new Vector3fImmutable(); public Vector3fImmutable obj_scale = new Vector3fImmutable();
public int obj_render_object; public int obj_render_object;
public int obj_icon;
public float combat_health_current; public float combat_health_current;
public float combat_health_full; public float combat_health_full;
public HashMap<String, Float> combat_attack_resist = new HashMap<>(); public HashMap<String, Float> combat_attack_resist = new HashMap<>();
public ArrayList combatPowers;
public ItemTemplate(JSONObject jsonObject) { public ItemTemplate(JSONObject jsonObject) {
// Reading a String // Reading a String
@ -43,6 +48,7 @@ public class ItemTemplate {
// Reading an integer value // Reading an integer value
obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue(); obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue();
obj_icon = ((Long) jsonObject.get("obj_icon")).intValue();
// Reading float values // Reading float values
@ -58,7 +64,9 @@ public class ItemTemplate {
combat_attack_resist.put((String) key, resist); combat_attack_resist.put((String) key, resist);
} }
} JSONArray combat_json = (JSONArray) jsonObject.get("combat_powers");
combatPowers = (ArrayList) Arrays.asList(combat_json.toArray());
} }
}

Loading…
Cancel
Save