mirror of
https://github.com/AndorsTrailRelease/ATCS.git
synced 2025-10-27 18:44:03 +01:00
more de-duplication
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.gpl.rpg.atcontentstudio.model.gamedata;
|
||||
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -10,6 +12,16 @@ public final class Common {
|
||||
//Available from parsed state
|
||||
public Integer duration = null;
|
||||
public Double chance = null;
|
||||
|
||||
public TimedConditionEffect createClone() {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
cclone.magnitude = this.magnitude;
|
||||
cclone.condition_id = this.condition_id;
|
||||
cclone.condition = this.condition;
|
||||
cclone.chance = this.chance;
|
||||
cclone.duration = this.duration;
|
||||
return cclone;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ConditionEffect {
|
||||
@@ -25,12 +37,11 @@ public final class Common {
|
||||
public static ArrayList<TimedConditionEffect> parseTimedConditionEffects(List conditionsSourceJson) {
|
||||
ArrayList<TimedConditionEffect> conditions_source;
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
conditions_source = new ArrayList<TimedConditionEffect>();
|
||||
conditions_source = new ArrayList<>();
|
||||
for (Object conditionJsonObj : conditionsSourceJson) {
|
||||
Map conditionJson = (Map) conditionJsonObj;
|
||||
TimedConditionEffect condition = new TimedConditionEffect();
|
||||
condition.condition_id = (String) conditionJson.get("condition");
|
||||
condition.magnitude = JSONElement.getInteger((Number) conditionJson.get("magnitude"));
|
||||
readConditionEffect(condition, conditionJson);
|
||||
condition.duration = JSONElement.getInteger((Number) conditionJson.get("duration"));
|
||||
if (conditionJson.get("chance") != null)
|
||||
condition.chance = JSONElement.parseChance(conditionJson.get("chance").toString());
|
||||
@@ -43,20 +54,29 @@ public final class Common {
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static HitReceivedEffect parseHitReceivedEffect(Map hitReceivedEffect) {
|
||||
if (hitReceivedEffect == null) {
|
||||
return null;
|
||||
}
|
||||
private static void readConditionEffect(ConditionEffect condition, Map conditionJson) {
|
||||
condition.condition_id = (String) conditionJson.get("condition");
|
||||
condition.magnitude = JSONElement.getInteger((Number) conditionJson.get("magnitude"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static Common.DeathEffect parseDeathEffect(Map killEffect) {
|
||||
Common.DeathEffect kill_effect = new Common.DeathEffect();
|
||||
readDeathEffect(killEffect, kill_effect);
|
||||
return kill_effect;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static HitEffect parseHitEffect(Map hitEffect) {
|
||||
Common.HitEffect hit_effect = new Common.HitEffect();
|
||||
readHitEffect(hitEffect, hit_effect);
|
||||
return hit_effect;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static HitReceivedEffect parseHitReceivedEffect(Map hitReceivedEffect) {
|
||||
HitReceivedEffect hit_received_effect = new Common.HitReceivedEffect();
|
||||
if (hitReceivedEffect.get("increaseCurrentHP") != null) {
|
||||
hit_received_effect.hp_boost_max = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseCurrentHP")).get("max")));
|
||||
hit_received_effect.hp_boost_min = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseCurrentHP")).get("min")));
|
||||
}
|
||||
if (hitReceivedEffect.get("increaseCurrentAP") != null) {
|
||||
hit_received_effect.ap_boost_max = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseCurrentAP")).get("max")));
|
||||
hit_received_effect.ap_boost_min = JSONElement.getInteger((Number) (((Map) hitReceivedEffect.get("increaseCurrentAP")).get("min")));
|
||||
}
|
||||
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")));
|
||||
@@ -65,14 +85,29 @@ public final class Common {
|
||||
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")));
|
||||
}
|
||||
List conditionsSourceJson = (List) hitReceivedEffect.get("conditionsSource");
|
||||
hit_received_effect.conditions_source = parseTimedConditionEffects(conditionsSourceJson);
|
||||
List conditionsTargetJson = (List) hitReceivedEffect.get("conditionsTarget");
|
||||
hit_received_effect.conditions_target = parseTimedConditionEffects(conditionsTargetJson);
|
||||
return hit_received_effect;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static void readDeathEffect(Map killEffect, DeathEffect kill_effect) {
|
||||
if (killEffect.get("increaseCurrentHP") != null) {
|
||||
kill_effect.hp_boost_min = JSONElement.getInteger((Number) (((Map) killEffect.get("increaseCurrentHP")).get("min")));
|
||||
kill_effect.hp_boost_max = JSONElement.getInteger((Number) (((Map) killEffect.get("increaseCurrentHP")).get("max")));
|
||||
}
|
||||
if (killEffect.get("increaseCurrentAP") != null) {
|
||||
kill_effect.ap_boost_min = JSONElement.getInteger((Number) (((Map) killEffect.get("increaseCurrentAP")).get("min")));
|
||||
kill_effect.ap_boost_max = JSONElement.getInteger((Number) (((Map) killEffect.get("increaseCurrentAP")).get("max")));
|
||||
}
|
||||
List conditionsSourceJson = (List) killEffect.get("conditionsSource");
|
||||
kill_effect.conditions_source = parseTimedConditionEffects(conditionsSourceJson);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static void readHitEffect(Map hitEffect, HitEffect hit_effect) {
|
||||
readDeathEffect(hitEffect, hit_effect);
|
||||
List conditionsTargetJson = (List) hitEffect.get("conditionsTarget");
|
||||
hit_effect.conditions_target = parseTimedConditionEffects(conditionsTargetJson);
|
||||
}
|
||||
|
||||
|
||||
public static class DeathEffect {
|
||||
@@ -81,12 +116,12 @@ public final class Common {
|
||||
public Integer hp_boost_max = null;
|
||||
public Integer ap_boost_min = null;
|
||||
public Integer ap_boost_max = null;
|
||||
public List<Common.TimedConditionEffect> conditions_source = null;
|
||||
public List<TimedConditionEffect> conditions_source = null;
|
||||
}
|
||||
|
||||
public static class HitEffect extends DeathEffect {
|
||||
//Available from parsed state
|
||||
public List<Common.TimedConditionEffect> conditions_target = null;
|
||||
public List<TimedConditionEffect> conditions_target = null;
|
||||
}
|
||||
|
||||
public static class HitReceivedEffect extends Common.HitEffect {
|
||||
@@ -97,4 +132,44 @@ public final class Common {
|
||||
public Integer ap_boost_max_target = null;
|
||||
}
|
||||
|
||||
|
||||
public static void copyDeathEffectValues(Common.DeathEffect target, Common.DeathEffect source, GameDataElement backlink) {
|
||||
target.ap_boost_max = source.ap_boost_max;
|
||||
target.ap_boost_min = source.ap_boost_min;
|
||||
target.hp_boost_max = source.hp_boost_max;
|
||||
target.hp_boost_min = source.hp_boost_min;
|
||||
if (source.conditions_source != null) {
|
||||
target.conditions_source = new ArrayList<>();
|
||||
for (Common.TimedConditionEffect c : source.conditions_source) {
|
||||
Common.TimedConditionEffect cclone = c.createClone();
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(backlink);
|
||||
}
|
||||
target.conditions_source.add(cclone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyHitEffectValues(Common.HitEffect target, Common.HitEffect source, GameDataElement backlink) {
|
||||
copyDeathEffectValues(target, source, backlink);
|
||||
if (source.conditions_target != null) {
|
||||
target.conditions_target = new ArrayList<>();
|
||||
for (Common.TimedConditionEffect c : source.conditions_target) {
|
||||
Common.TimedConditionEffect cclone = c.createClone();
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(backlink);
|
||||
}
|
||||
target.conditions_target.add(cclone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameSource;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
|
||||
import static com.gpl.rpg.atcontentstudio.model.gamedata.Common.*;
|
||||
|
||||
public class Item extends JSONElement {
|
||||
|
||||
private static final long serialVersionUID = -516874303672548638L;
|
||||
@@ -33,9 +35,9 @@ public class Item extends JSONElement {
|
||||
public Integer base_market_cost = null;
|
||||
public String category_id = null;
|
||||
public String description = null;
|
||||
public Common.HitEffect hit_effect = null;
|
||||
public Common.HitReceivedEffect hit_received_effect = null;
|
||||
public Common.DeathEffect kill_effect = null;
|
||||
public HitEffect hit_effect = null;
|
||||
public HitReceivedEffect hit_received_effect = null;
|
||||
public DeathEffect kill_effect = null;
|
||||
public EquipEffect equip_effect = null;
|
||||
|
||||
//Available from linked state
|
||||
@@ -182,66 +184,12 @@ public class Item extends JSONElement {
|
||||
|
||||
Map hitEffect = (Map) itemJson.get("hitEffect");
|
||||
if (hitEffect != null) {
|
||||
this.hit_effect = new Common.HitEffect();
|
||||
if (hitEffect.get("increaseCurrentHP") != null) {
|
||||
this.hit_effect.hp_boost_min = JSONElement.getInteger((Number) (((Map)hitEffect.get("increaseCurrentHP")).get("min")));
|
||||
this.hit_effect.hp_boost_max = JSONElement.getInteger((Number) (((Map)hitEffect.get("increaseCurrentHP")).get("max")));
|
||||
}
|
||||
if (hitEffect.get("increaseCurrentAP") != null) {
|
||||
this.hit_effect.ap_boost_min = JSONElement.getInteger((Number) (((Map)hitEffect.get("increaseCurrentAP")).get("min")));
|
||||
this.hit_effect.ap_boost_max = JSONElement.getInteger((Number) (((Map) hitEffect.get("increaseCurrentAP")).get("max")));
|
||||
}
|
||||
List conditionsSourceJson = (List) hitEffect.get("conditionsSource");
|
||||
this.hit_effect.conditions_source = Common.parseTimedConditionEffects(conditionsSourceJson);
|
||||
List conditionsTargetJson = (List) hitEffect.get("conditionsTarget");
|
||||
this.hit_effect.conditions_target = Common.parseTimedConditionEffects(conditionsTargetJson);
|
||||
this.hit_effect = Common.parseHitEffect(hitEffect);
|
||||
}
|
||||
|
||||
Map hitReceivedEffect = (Map) itemJson.get("hitReceivedEffect");
|
||||
if (hitReceivedEffect != null) {
|
||||
this.hit_received_effect = new Common.HitReceivedEffect();
|
||||
if (hitReceivedEffect.get("increaseCurrentHP") != null) {
|
||||
this.hit_received_effect.hp_boost_min = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseCurrentHP")).get("min")));
|
||||
this.hit_received_effect.hp_boost_max = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseCurrentHP")).get("max")));
|
||||
}
|
||||
if (hitReceivedEffect.get("increaseCurrentAP") != null) {
|
||||
this.hit_received_effect.ap_boost_min = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseCurrentAP")).get("min")));
|
||||
this.hit_received_effect.ap_boost_max = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseCurrentAP")).get("max")));
|
||||
}
|
||||
if (hitReceivedEffect.get("increaseAttackerCurrentHP") != null) {
|
||||
this.hit_received_effect.hp_boost_min_target = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseAttackerCurrentHP")).get("min")));
|
||||
this.hit_received_effect.hp_boost_max_target = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseAttackerCurrentHP")).get("max")));
|
||||
}
|
||||
if (hitReceivedEffect.get("increaseAttackerCurrentAP") != null) {
|
||||
this.hit_received_effect.ap_boost_min_target = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseAttackerCurrentAP")).get("min")));
|
||||
this.hit_received_effect.ap_boost_max_target = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseAttackerCurrentAP")).get("max")));
|
||||
}
|
||||
List conditionsSourceJson = (List) hitReceivedEffect.get("conditionsSource");
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
this.hit_received_effect.conditions_source = new ArrayList<>();
|
||||
for (Object conditionJsonObj : conditionsSourceJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
condition.condition_id = (String) conditionJson.get("condition");
|
||||
condition.magnitude = JSONElement.getInteger((Number) conditionJson.get("magnitude"));
|
||||
condition.duration = JSONElement.getInteger((Number) conditionJson.get("duration"));
|
||||
if (conditionJson.get("chance") != null) condition.chance = JSONElement.parseChance(conditionJson.get("chance").toString());
|
||||
this.hit_received_effect.conditions_source.add(condition);
|
||||
}
|
||||
}
|
||||
List conditionsTargetJson = (List) hitReceivedEffect.get("conditionsTarget");
|
||||
if (conditionsTargetJson != null && !conditionsTargetJson.isEmpty()) {
|
||||
this.hit_received_effect.conditions_target = new ArrayList<>();
|
||||
for (Object conditionJsonObj : conditionsTargetJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
condition.condition_id = (String) conditionJson.get("condition");
|
||||
condition.magnitude = JSONElement.getInteger((Number) conditionJson.get("magnitude"));
|
||||
condition.duration = JSONElement.getInteger((Number) conditionJson.get("duration"));
|
||||
if (conditionJson.get("chance") != null) condition.chance = JSONElement.parseChance(conditionJson.get("chance").toString());
|
||||
this.hit_received_effect.conditions_target.add(condition);
|
||||
}
|
||||
}
|
||||
this.hit_received_effect = Common.parseHitReceivedEffect(hitReceivedEffect);
|
||||
}
|
||||
|
||||
Map killEffect = (Map) itemJson.get("killEffect");
|
||||
@@ -249,33 +197,13 @@ public class Item extends JSONElement {
|
||||
killEffect = (Map) itemJson.get("useEffect");
|
||||
}
|
||||
if (killEffect != null) {
|
||||
this.kill_effect = new Common.DeathEffect();
|
||||
if (killEffect.get("increaseCurrentHP") != null) {
|
||||
this.kill_effect.hp_boost_min = JSONElement.getInteger((Number) (((Map)killEffect.get("increaseCurrentHP")).get("min")));
|
||||
this.kill_effect.hp_boost_max = JSONElement.getInteger((Number) (((Map)killEffect.get("increaseCurrentHP")).get("max")));
|
||||
}
|
||||
if (killEffect.get("increaseCurrentAP") != null) {
|
||||
this.kill_effect.ap_boost_min = JSONElement.getInteger((Number) (((Map)killEffect.get("increaseCurrentAP")).get("min")));
|
||||
this.kill_effect.ap_boost_max = JSONElement.getInteger((Number) (((Map)killEffect.get("increaseCurrentAP")).get("max")));
|
||||
}
|
||||
List conditionsSourceJson = (List) killEffect.get("conditionsSource");
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
this.kill_effect.conditions_source = new ArrayList<>();
|
||||
for (Object conditionJsonObj : conditionsSourceJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
condition.condition_id = (String) conditionJson.get("condition");
|
||||
condition.magnitude = JSONElement.getInteger((Number) conditionJson.get("magnitude"));
|
||||
condition.duration = JSONElement.getInteger((Number) conditionJson.get("duration"));
|
||||
if (conditionJson.get("chance") != null) condition.chance = JSONElement.parseChance(conditionJson.get("chance").toString());
|
||||
this.kill_effect.conditions_source.add(condition);
|
||||
}
|
||||
}
|
||||
this.kill_effect = Common.parseDeathEffect(killEffect);
|
||||
}
|
||||
this.state = State.parsed;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void link() {
|
||||
if (this.state == State.created || this.state == State.modified || this.state == State.saved) {
|
||||
@@ -397,104 +325,16 @@ public class Item extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_effect != null) {
|
||||
clone.hit_effect = new Common.HitEffect();
|
||||
clone.hit_effect.ap_boost_max = this.hit_effect.ap_boost_max;
|
||||
clone.hit_effect.ap_boost_min = this.hit_effect.ap_boost_min;
|
||||
clone.hit_effect.hp_boost_max = this.hit_effect.hp_boost_max;
|
||||
clone.hit_effect.hp_boost_min = this.hit_effect.hp_boost_min;
|
||||
if (this.hit_effect.conditions_source != null) {
|
||||
clone.hit_effect.conditions_source = new ArrayList<>();
|
||||
for (Common.TimedConditionEffect c : this.hit_effect.conditions_source) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.hit_effect.conditions_source.add(cclone);
|
||||
}
|
||||
}
|
||||
if (this.hit_effect.conditions_target != null) {
|
||||
clone.hit_effect.conditions_target = new ArrayList<>();
|
||||
for (Common.TimedConditionEffect c : this.hit_effect.conditions_target) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.hit_effect.conditions_target.add(cclone);
|
||||
}
|
||||
}
|
||||
clone.hit_effect = new HitEffect();
|
||||
copyHitEffectValues(clone.hit_effect, this.hit_effect, clone);
|
||||
}
|
||||
if (this.hit_received_effect != null) {
|
||||
clone.hit_received_effect = new Common.HitReceivedEffect();
|
||||
clone.hit_received_effect.ap_boost_max = this.hit_received_effect.ap_boost_max;
|
||||
clone.hit_received_effect.ap_boost_min = this.hit_received_effect.ap_boost_min;
|
||||
clone.hit_received_effect.hp_boost_max = this.hit_received_effect.hp_boost_max;
|
||||
clone.hit_received_effect.hp_boost_min = this.hit_received_effect.hp_boost_min;
|
||||
clone.hit_received_effect.ap_boost_max_target = this.hit_received_effect.ap_boost_max_target;
|
||||
clone.hit_received_effect.ap_boost_min_target = this.hit_received_effect.ap_boost_min_target;
|
||||
clone.hit_received_effect.hp_boost_max_target = this.hit_received_effect.hp_boost_max_target;
|
||||
clone.hit_received_effect.hp_boost_min_target = this.hit_received_effect.hp_boost_min_target;
|
||||
if (this.hit_received_effect.conditions_source != null) {
|
||||
clone.hit_received_effect.conditions_source = new ArrayList<>();
|
||||
for (Common.TimedConditionEffect c : this.hit_received_effect.conditions_source) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.hit_received_effect.conditions_source.add(cclone);
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect.conditions_target != null) {
|
||||
clone.hit_received_effect.conditions_target = new ArrayList<>();
|
||||
for (Common.TimedConditionEffect c : this.hit_received_effect.conditions_target) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.hit_received_effect.conditions_target.add(cclone);
|
||||
}
|
||||
}
|
||||
clone.hit_received_effect = new HitReceivedEffect();
|
||||
copyHitReceivedEffectValues(clone.hit_received_effect, this.hit_received_effect, clone);
|
||||
}
|
||||
if (this.kill_effect != null) {
|
||||
clone.kill_effect = new Common.DeathEffect();
|
||||
clone.kill_effect.ap_boost_max = this.kill_effect.ap_boost_max;
|
||||
clone.kill_effect.ap_boost_min = this.kill_effect.ap_boost_min;
|
||||
clone.kill_effect.hp_boost_max = this.kill_effect.hp_boost_max;
|
||||
clone.kill_effect.hp_boost_min = this.kill_effect.hp_boost_min;
|
||||
if (this.kill_effect.conditions_source != null) {
|
||||
clone.kill_effect.conditions_source = new ArrayList<>();
|
||||
for (Common.TimedConditionEffect c : this.kill_effect.conditions_source) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.kill_effect.conditions_source.add(cclone);
|
||||
}
|
||||
}
|
||||
clone.kill_effect = new DeathEffect();
|
||||
copyDeathEffectValues(clone.kill_effect, this.kill_effect, clone);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,7 @@ import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameSource;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
|
||||
import static com.gpl.rpg.atcontentstudio.model.gamedata.Common.parseHitReceivedEffect;
|
||||
import static com.gpl.rpg.atcontentstudio.model.gamedata.Common.parseTimedConditionEffects;
|
||||
import static com.gpl.rpg.atcontentstudio.model.gamedata.Common.*;
|
||||
|
||||
public class NPC extends JSONElement {
|
||||
|
||||
@@ -304,104 +303,16 @@ public class NPC extends JSONElement {
|
||||
clone.droplist_id = this.droplist_id;
|
||||
clone.faction_id = this.faction_id;
|
||||
if (this.hit_effect != null) {
|
||||
clone.hit_effect = new Common.HitEffect();
|
||||
clone.hit_effect.ap_boost_max = this.hit_effect.ap_boost_max;
|
||||
clone.hit_effect.ap_boost_min = this.hit_effect.ap_boost_min;
|
||||
clone.hit_effect.hp_boost_max = this.hit_effect.hp_boost_max;
|
||||
clone.hit_effect.hp_boost_min = this.hit_effect.hp_boost_min;
|
||||
if (this.hit_effect.conditions_source != null) {
|
||||
clone.hit_effect.conditions_source = new ArrayList<Common.TimedConditionEffect>();
|
||||
for (Common.TimedConditionEffect c : this.hit_effect.conditions_source) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.hit_effect.conditions_source.add(cclone);
|
||||
}
|
||||
}
|
||||
if (this.hit_effect.conditions_target != null) {
|
||||
clone.hit_effect.conditions_target = new ArrayList<Common.TimedConditionEffect>();
|
||||
for (Common.TimedConditionEffect c : this.hit_effect.conditions_target) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.hit_effect.conditions_target.add(cclone);
|
||||
}
|
||||
}
|
||||
clone.hit_effect = new HitEffect();
|
||||
copyHitEffectValues(clone.hit_effect, this.hit_effect, clone);
|
||||
}
|
||||
if (this.hit_received_effect != null) {
|
||||
clone.hit_received_effect = new Common.HitReceivedEffect();
|
||||
clone.hit_received_effect.ap_boost_max = this.hit_received_effect.ap_boost_max;
|
||||
clone.hit_received_effect.ap_boost_min = this.hit_received_effect.ap_boost_min;
|
||||
clone.hit_received_effect.hp_boost_max = this.hit_received_effect.hp_boost_max;
|
||||
clone.hit_received_effect.hp_boost_min = this.hit_received_effect.hp_boost_min;
|
||||
clone.hit_received_effect.ap_boost_max_target = this.hit_received_effect.ap_boost_max_target;
|
||||
clone.hit_received_effect.ap_boost_min_target = this.hit_received_effect.ap_boost_min_target;
|
||||
clone.hit_received_effect.hp_boost_max_target = this.hit_received_effect.hp_boost_max_target;
|
||||
clone.hit_received_effect.hp_boost_min_target = this.hit_received_effect.hp_boost_min_target;
|
||||
if (this.hit_received_effect.conditions_source != null) {
|
||||
clone.hit_received_effect.conditions_source = new ArrayList<Common.TimedConditionEffect>();
|
||||
for (Common.TimedConditionEffect c : this.hit_received_effect.conditions_source) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.hit_received_effect.conditions_source.add(cclone);
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect.conditions_target != null) {
|
||||
clone.hit_received_effect.conditions_target = new ArrayList<Common.TimedConditionEffect>();
|
||||
for (Common.TimedConditionEffect c : this.hit_received_effect.conditions_target) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.hit_received_effect.conditions_target.add(cclone);
|
||||
}
|
||||
}
|
||||
clone.hit_received_effect = new HitReceivedEffect();
|
||||
copyHitReceivedEffectValues(clone.hit_received_effect, this.hit_received_effect, clone);
|
||||
}
|
||||
if (this.death_effect != null) {
|
||||
clone.death_effect = new Common.DeathEffect();
|
||||
clone.death_effect.ap_boost_max = this.death_effect.ap_boost_max;
|
||||
clone.death_effect.ap_boost_min = this.death_effect.ap_boost_min;
|
||||
clone.death_effect.hp_boost_max = this.death_effect.hp_boost_max;
|
||||
clone.death_effect.hp_boost_min = this.death_effect.hp_boost_min;
|
||||
if (this.death_effect.conditions_source != null) {
|
||||
clone.death_effect.conditions_source = new ArrayList<Common.TimedConditionEffect>();
|
||||
for (Common.TimedConditionEffect c : this.death_effect.conditions_source) {
|
||||
Common.TimedConditionEffect cclone = new Common.TimedConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
cclone.chance = c.chance;
|
||||
cclone.duration = c.duration;
|
||||
if (cclone.condition != null) {
|
||||
cclone.condition.addBacklink(clone);
|
||||
}
|
||||
clone.death_effect.conditions_source.add(cclone);
|
||||
}
|
||||
}
|
||||
clone.death_effect = new DeathEffect();
|
||||
copyDeathEffectValues(clone.death_effect, this.death_effect, clone);
|
||||
}
|
||||
clone.max_ap = this.max_ap;
|
||||
clone.max_hp = this.max_hp;
|
||||
@@ -412,7 +323,7 @@ public class NPC extends JSONElement {
|
||||
clone.unique = this.unique;
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void elementChanged(GameDataElement oldOne, GameDataElement newOne) {
|
||||
if (dialogue == oldOne) {
|
||||
|
||||
Reference in New Issue
Block a user