Browse Source

Skill and mastery work.

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

19
src/engine/objects/ItemTemplate.java

@ -44,6 +44,7 @@ public class ItemTemplate { @@ -44,6 +44,7 @@ public class ItemTemplate {
public float item_health_full;
public EnumSet<Enum.CharacterSkills> item_skill_used = EnumSet.noneOf(Enum.CharacterSkills.class);
public EnumSet<Enum.CharacterSkills> item_skill_mastery_used = EnumSet.noneOf(Enum.CharacterSkills.class);
public ItemTemplate(JSONObject jsonObject) {
@ -108,7 +109,21 @@ public class ItemTemplate { @@ -108,7 +109,21 @@ public class ItemTemplate {
Object skills_used = jsonObject.get("item_skill_used");
if (skills_used instanceof JSONArray)
for (Object o : (JSONArray) skills_used)
item_skill_used.add(Enum.CharacterSkills.valueOf((String) o));
for (Object o : (JSONArray) skills_used) {
String skilString = ((String) o).replaceAll("\\s", "");
;
Enum.CharacterSkills characterSkill = Enum.CharacterSkills.valueOf(skilString);
item_skill_used.add(characterSkill);
}
Object mastery_used = jsonObject.get("item_skill_mastery_used");
if (mastery_used instanceof JSONArray)
for (Object o : (JSONArray) mastery_used) {
String masteryString = ((String) o).replaceAll("\\s", "");
;
Enum.CharacterSkills masterySkill = Enum.CharacterSkills.valueOf(masteryString);
item_skill_mastery_used.add(masterySkill);
}
}
}

Loading…
Cancel
Save