mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-26 15:57:22 +01:00
improve isNull check
This commit is contained in:
@@ -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<TimedActorConditionEffect> 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<TimedActorConditionEffect> 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user