From 88516d28574266dd54e96ce8efa37cba2f42b3c6 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 18 Feb 2024 13:40:16 -0500 Subject: [PATCH] Fleshing out constructor --- src/engine/objects/ItemTemplate.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 6ceb02ea..9615b3d0 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -13,7 +13,6 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; @@ -64,9 +63,13 @@ public class ItemTemplate { combat_attack_resist.put((String) key, resist); } + // Reading arraylist of ints + 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); } }