Browse Source

Fleshing out constructor

combat-2
MagicBot 9 months ago
parent
commit
88516d2857
  1. 7
      src/engine/objects/ItemTemplate.java

7
src/engine/objects/ItemTemplate.java

@ -13,7 +13,6 @@ import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
@ -64,9 +63,13 @@ public class ItemTemplate {
combat_attack_resist.put((String) key, resist); combat_attack_resist.put((String) key, resist);
} }
// Reading arraylist of ints
JSONArray combat_json = (JSONArray) jsonObject.get("combat_powers"); JSONArray combat_json = (JSONArray) jsonObject.get("combat_powers");
combatPowers = (ArrayList) Arrays.asList(combat_json.toArray());
if (combat_json.isEmpty() == false)
for (Object o : combat_json)
combatPowers.add(o);
} }
} }

Loading…
Cancel
Save