mirror of
https://github.com/AndorsTrailRelease/ATCS.git
synced 2025-10-27 18:44:03 +01:00
use BasicEffect for HitReceivedEffect values to reuse logic
This commit is contained in:
@@ -88,12 +88,12 @@ public final class Common {
|
||||
HitReceivedEffect hit_received_effect = new Common.HitReceivedEffect();
|
||||
readHitEffect(hitReceivedEffect, hit_received_effect);
|
||||
if (hitReceivedEffect.get("increaseAttackerCurrentHP") != null) {
|
||||
hit_received_effect.hp_boost_max_target = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseAttackerCurrentHP")).get("max")));
|
||||
hit_received_effect.hp_boost_min_target = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseAttackerCurrentHP")).get("min")));
|
||||
hit_received_effect.target.hp_boost_max = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseAttackerCurrentHP")).get("max")));
|
||||
hit_received_effect.target.hp_boost_min = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseAttackerCurrentHP")).get("min")));
|
||||
}
|
||||
if (hitReceivedEffect.get("increaseAttackerCurrentAP") != null) {
|
||||
hit_received_effect.ap_boost_max_target = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseAttackerCurrentAP")).get("max")));
|
||||
hit_received_effect.ap_boost_min_target = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseAttackerCurrentAP")).get("min")));
|
||||
hit_received_effect.target.ap_boost_max = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseAttackerCurrentAP")).get("max")));
|
||||
hit_received_effect.target.ap_boost_min = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseAttackerCurrentAP")).get("min")));
|
||||
}
|
||||
return hit_received_effect;
|
||||
}
|
||||
@@ -138,10 +138,7 @@ public final class Common {
|
||||
|
||||
public static class HitReceivedEffect extends Common.HitEffect {
|
||||
//Available from parsed state
|
||||
public Integer hp_boost_min_target = null;
|
||||
public Integer hp_boost_max_target = null;
|
||||
public Integer ap_boost_min_target = null;
|
||||
public Integer ap_boost_max_target = null;
|
||||
public BasicEffect target = new BasicEffect();
|
||||
}
|
||||
|
||||
|
||||
@@ -182,10 +179,7 @@ public final class Common {
|
||||
|
||||
public static void copyHitReceivedEffectValues(Common.HitReceivedEffect target, Common.HitReceivedEffect source, GameDataElement backlink) {
|
||||
copyHitEffectValues(target, source, backlink);
|
||||
target.ap_boost_max_target = source.ap_boost_max_target;
|
||||
target.ap_boost_min_target = source.ap_boost_min_target;
|
||||
target.hp_boost_max_target = source.hp_boost_max_target;
|
||||
target.hp_boost_min_target = source.hp_boost_min_target;
|
||||
copyEffectValues(target.target, source.target);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -506,24 +506,24 @@ public class Item extends JSONElement {
|
||||
apJson.put("max", this.hit_received_effect.ap_boost_max);
|
||||
else apJson.put("max", 0);
|
||||
}
|
||||
if (this.hit_received_effect.hp_boost_min_target != null || this.hit_received_effect.hp_boost_max_target != null) {
|
||||
if (this.hit_received_effect.target.hp_boost_min != null || this.hit_received_effect.target.hp_boost_max != null) {
|
||||
Map hpJson = new LinkedHashMap();
|
||||
hitReceivedEffectJson.put("increaseAttackerCurrentHP", hpJson);
|
||||
if (this.hit_received_effect.hp_boost_min_target != null)
|
||||
hpJson.put("min", this.hit_received_effect.hp_boost_min_target);
|
||||
if (this.hit_received_effect.target.hp_boost_min != null)
|
||||
hpJson.put("min", this.hit_received_effect.target.hp_boost_min);
|
||||
else hpJson.put("min", 0);
|
||||
if (this.hit_received_effect.hp_boost_max_target != null)
|
||||
hpJson.put("max", this.hit_received_effect.hp_boost_max_target);
|
||||
if (this.hit_received_effect.target.hp_boost_max != null)
|
||||
hpJson.put("max", this.hit_received_effect.target.hp_boost_max);
|
||||
else hpJson.put("max", 0);
|
||||
}
|
||||
if (this.hit_received_effect.ap_boost_min_target != null || this.hit_received_effect.ap_boost_max_target != null) {
|
||||
if (this.hit_received_effect.target.ap_boost_min != null || this.hit_received_effect.target.ap_boost_max != null) {
|
||||
Map apJson = new LinkedHashMap();
|
||||
hitReceivedEffectJson.put("increaseAttackerCurrentAP", apJson);
|
||||
if (this.hit_received_effect.ap_boost_min_target != null)
|
||||
apJson.put("min", this.hit_received_effect.ap_boost_min_target);
|
||||
if (this.hit_received_effect.target.ap_boost_min != null)
|
||||
apJson.put("min", this.hit_received_effect.target.ap_boost_min);
|
||||
else apJson.put("min", 0);
|
||||
if (this.hit_received_effect.ap_boost_max_target != null)
|
||||
apJson.put("max", this.hit_received_effect.ap_boost_max_target);
|
||||
if (this.hit_received_effect.target.ap_boost_max != null)
|
||||
apJson.put("max", this.hit_received_effect.target.ap_boost_max);
|
||||
else apJson.put("max", 0);
|
||||
}
|
||||
if (this.hit_received_effect.conditions_source != null) {
|
||||
|
||||
@@ -452,24 +452,24 @@ public class NPC extends JSONElement {
|
||||
apJson.put("max", this.hit_received_effect.ap_boost_max);
|
||||
else apJson.put("max", 0);
|
||||
}
|
||||
if (this.hit_received_effect.hp_boost_min_target != null || this.hit_received_effect.hp_boost_max_target != null) {
|
||||
if (this.hit_received_effect.target.hp_boost_min != null || this.hit_received_effect.target.hp_boost_max != null) {
|
||||
Map hpJson = new LinkedHashMap();
|
||||
hitReceivedEffectJson.put("increaseAttackerCurrentHP", hpJson);
|
||||
if (this.hit_received_effect.hp_boost_min_target != null)
|
||||
hpJson.put("min", this.hit_received_effect.hp_boost_min_target);
|
||||
if (this.hit_received_effect.target.hp_boost_min != null)
|
||||
hpJson.put("min", this.hit_received_effect.target.hp_boost_min);
|
||||
else hpJson.put("min", 0);
|
||||
if (this.hit_received_effect.hp_boost_max_target != null)
|
||||
hpJson.put("max", this.hit_received_effect.hp_boost_max_target);
|
||||
if (this.hit_received_effect.target.hp_boost_max != null)
|
||||
hpJson.put("max", this.hit_received_effect.target.hp_boost_max);
|
||||
else hpJson.put("max", 0);
|
||||
}
|
||||
if (this.hit_received_effect.ap_boost_min_target != null || this.hit_received_effect.ap_boost_max_target != null) {
|
||||
if (this.hit_received_effect.target.ap_boost_min != null || this.hit_received_effect.target.ap_boost_max != null) {
|
||||
Map apJson = new LinkedHashMap();
|
||||
hitReceivedEffectJson.put("increaseAttackerCurrentAP", apJson);
|
||||
if (this.hit_received_effect.ap_boost_min_target != null)
|
||||
apJson.put("min", this.hit_received_effect.ap_boost_min_target);
|
||||
if (this.hit_received_effect.target.ap_boost_min != null)
|
||||
apJson.put("min", this.hit_received_effect.target.ap_boost_min);
|
||||
else apJson.put("min", 0);
|
||||
if (this.hit_received_effect.ap_boost_max_target != null)
|
||||
apJson.put("max", this.hit_received_effect.ap_boost_max_target);
|
||||
if (this.hit_received_effect.target.ap_boost_max != null)
|
||||
apJson.put("max", this.hit_received_effect.target.ap_boost_max);
|
||||
else apJson.put("max", 0);
|
||||
}
|
||||
if (this.hit_received_effect.conditions_source != null) {
|
||||
|
||||
@@ -1139,10 +1139,10 @@ public class ItemEditor extends JSONElementEditor {
|
||||
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.ap_boost_min_target != null) return false;
|
||||
if (effect.ap_boost_max_target != null) return false;
|
||||
if (effect.hp_boost_min_target != null) return false;
|
||||
if (effect.hp_boost_max_target != 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;
|
||||
@@ -1534,19 +1534,19 @@ public class ItemEditor extends JSONElementEditor {
|
||||
updatePrice = true;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedHPMinTarget) {
|
||||
hitReceivedEffect.hp_boost_min_target = (Integer) value;
|
||||
hitReceivedEffect.target.hp_boost_min = (Integer) value;
|
||||
updatePrice = true;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedHPMaxTarget) {
|
||||
hitReceivedEffect.hp_boost_max_target = (Integer) value;
|
||||
hitReceivedEffect.target.hp_boost_max = (Integer) value;
|
||||
updatePrice = true;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedAPMinTarget) {
|
||||
hitReceivedEffect.ap_boost_min_target = (Integer) value;
|
||||
hitReceivedEffect.target.ap_boost_min = (Integer) value;
|
||||
updatePrice = true;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedAPMaxTarget) {
|
||||
hitReceivedEffect.ap_boost_max_target = (Integer) value;
|
||||
hitReceivedEffect.target.ap_boost_max = (Integer) value;
|
||||
updatePrice = true;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedSourceConditionsList) {
|
||||
|
||||
@@ -945,10 +945,10 @@ public class NPCEditor extends JSONElementEditor {
|
||||
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.ap_boost_min_target != null) return false;
|
||||
if (effect.ap_boost_max_target != null) return false;
|
||||
if (effect.hp_boost_min_target != null) return false;
|
||||
if (effect.hp_boost_max_target != 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;
|
||||
@@ -1194,16 +1194,16 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitReceivedEffect.ap_boost_max = (Integer) value;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedEffectHPMinTarget) {
|
||||
hitReceivedEffect.hp_boost_min_target = (Integer) value;
|
||||
hitReceivedEffect.target.hp_boost_min = (Integer) value;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedEffectHPMaxTarget) {
|
||||
hitReceivedEffect.hp_boost_max_target = (Integer) value;
|
||||
hitReceivedEffect.target.hp_boost_max = (Integer) value;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedEffectAPMinTarget) {
|
||||
hitReceivedEffect.ap_boost_min_target = (Integer) value;
|
||||
hitReceivedEffect.target.ap_boost_min = (Integer) value;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedEffectAPMaxTarget) {
|
||||
hitReceivedEffect.ap_boost_max_target = (Integer) value;
|
||||
hitReceivedEffect.target.ap_boost_max = (Integer) value;
|
||||
updateHitReceived = true;
|
||||
} else if (source == hitReceivedSourceConditionsList) {
|
||||
updateHitReceived = true;
|
||||
|
||||
Reference in New Issue
Block a user