diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Common.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Common.java index 6336870..4b9987a 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Common.java +++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Common.java @@ -270,21 +270,47 @@ public final class Common { public Integer hp_boost_max = null; public Integer ap_boost_min = null; public Integer ap_boost_max = null; + + public boolean isNull() { + if (ap_boost_min != null) return false; + if (ap_boost_max != null) return false; + if (hp_boost_min != null) return false; + if (hp_boost_max != null) return false; + return true; + } } public static class DeathEffect extends BasicEffect { //Available from parsed state public List conditions_source = null; + @Override + public boolean isNull(){ + if(!super.isNull()) return false; + if (conditions_source != null) return false; + return true; + } } public static class HitEffect extends DeathEffect { //Available from parsed state public List conditions_target = null; + @Override + public boolean isNull(){ + if(!super.isNull()) return false; + if (conditions_target != null) return false; + return true; + } } public static class HitReceivedEffect extends Common.HitEffect { //Available from parsed state public BasicEffect target = new BasicEffect(); + @Override + public boolean isNull(){ + if(!super.isNull()) return false; + if (!target.isNull()) return false; + return true; + } } diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/NPCEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/NPCEditor.java index c659962..7f33bb9 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/NPCEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/NPCEditor.java @@ -212,38 +212,6 @@ public class NPCEditor extends JSONElementEditor { } } - public static boolean isNull(Common.HitEffect effect) { - if (effect.ap_boost_min != null) return false; - if (effect.ap_boost_max != null) return false; - if (effect.hp_boost_min != null) return false; - if (effect.hp_boost_max != null) return false; - if (effect.conditions_source != null) return false; - if (effect.conditions_target != null) return false; - return true; - } - - public static boolean isNull(Common.HitReceivedEffect effect) { - if (effect.ap_boost_min != null) return false; - if (effect.ap_boost_max != null) return false; - if (effect.hp_boost_min != null) return false; - if (effect.hp_boost_max != null) return false; - if (effect.target.ap_boost_min != null) return false; - if (effect.target.ap_boost_max != null) return false; - if (effect.target.hp_boost_min != null) return false; - if (effect.target.hp_boost_max != null) return false; - if (effect.conditions_source != null) return false; - if (effect.conditions_target != null) return false; - return true; - } - - public static boolean isNull(Common.DeathEffect effect) { - if (effect.ap_boost_min != null) return false; - if (effect.ap_boost_max != null) return false; - if (effect.hp_boost_min != null) return false; - if (effect.hp_boost_max != null) return false; - if (effect.conditions_source != null) return false; - return true; - } public class NPCFieldUpdater implements FieldUpdateListener { @@ -346,21 +314,21 @@ public class NPCEditor extends JSONElementEditor { } if (updateHit) { - if (isNull(hitEffectPane.effect)) { + if (hitEffectPane.effect.isNull()) { npc.hit_effect = null; } else { npc.hit_effect = hitEffectPane.effect; } } if (updateHitReceived) { - if (isNull(hitEffectPane.effect)) { + if (hitEffectPane.effect.isNull()) { npc.hit_received_effect = null; } else { npc.hit_received_effect = hitReceivedEffectPane.effect; } } if (updateDeath) { - if (isNull(deathEffectPane. effect)) { + if (deathEffectPane.effect.isNull()) { npc.death_effect = null; } else { npc.death_effect = deathEffectPane. effect;