mirror of
https://github.com/AndorsTrailRelease/ATCS.git
synced 2025-10-27 18:44:03 +01:00
de-dupe code
This commit is contained in:
100
src/com/gpl/rpg/atcontentstudio/model/gamedata/Common.java
Normal file
100
src/com/gpl/rpg/atcontentstudio/model/gamedata/Common.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package com.gpl.rpg.atcontentstudio.model.gamedata;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class Common {
|
||||
|
||||
public static class TimedConditionEffect extends ConditionEffect {
|
||||
//Available from parsed state
|
||||
public Integer duration = null;
|
||||
public Double chance = null;
|
||||
}
|
||||
|
||||
public static class ConditionEffect {
|
||||
//Available from parsed state
|
||||
public Integer magnitude = null;
|
||||
public String condition_id = null;
|
||||
|
||||
//Available from linked state
|
||||
public ActorCondition condition = null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ArrayList<TimedConditionEffect> parseTimedConditionEffects(List conditionsSourceJson) {
|
||||
ArrayList<TimedConditionEffect> conditions_source;
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
conditions_source = new ArrayList<TimedConditionEffect>();
|
||||
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"));
|
||||
condition.duration = JSONElement.getInteger((Number) conditionJson.get("duration"));
|
||||
if (conditionJson.get("chance") != null)
|
||||
condition.chance = JSONElement.parseChance(conditionJson.get("chance").toString());
|
||||
conditions_source.add(condition);
|
||||
}
|
||||
} else {
|
||||
conditions_source = null;
|
||||
}
|
||||
return conditions_source;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static HitReceivedEffect parseHitReceivedEffect(Map hitReceivedEffect) {
|
||||
if (hitReceivedEffect == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
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")));
|
||||
}
|
||||
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")));
|
||||
}
|
||||
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")));
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class DeathEffect {
|
||||
//Available from parsed state
|
||||
public Integer hp_boost_min = null;
|
||||
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 static class HitEffect extends DeathEffect {
|
||||
//Available from parsed state
|
||||
public List<Common.TimedConditionEffect> conditions_target = null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,39 +33,14 @@ public class Item extends JSONElement {
|
||||
public Integer base_market_cost = null;
|
||||
public String category_id = null;
|
||||
public String description = null;
|
||||
public HitEffect hit_effect = null;
|
||||
public HitReceivedEffect hit_received_effect = null;
|
||||
public KillEffect kill_effect = null;
|
||||
public Common.HitEffect hit_effect = null;
|
||||
public Common.HitReceivedEffect hit_received_effect = null;
|
||||
public Common.DeathEffect kill_effect = null;
|
||||
public EquipEffect equip_effect = null;
|
||||
|
||||
//Available from linked state
|
||||
public ItemCategory category = null;
|
||||
|
||||
|
||||
|
||||
public static class KillEffect {
|
||||
//Available from parsed state
|
||||
public Integer hp_boost_min = null;
|
||||
public Integer hp_boost_max = null;
|
||||
public Integer ap_boost_min = null;
|
||||
public Integer ap_boost_max = null;
|
||||
public List<TimedConditionEffect> conditions_source = null;
|
||||
|
||||
}
|
||||
|
||||
//Inheritance for code compactness, not semantically correct.
|
||||
public static class HitEffect extends KillEffect {
|
||||
//Available from parsed state
|
||||
public List<TimedConditionEffect> conditions_target = null;
|
||||
}
|
||||
|
||||
public static class HitReceivedEffect extends 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 static class EquipEffect {
|
||||
//Available from parsed state
|
||||
@@ -73,7 +48,7 @@ public class Item extends JSONElement {
|
||||
public Integer damage_boost_max = null;
|
||||
public Integer max_hp_boost = null;
|
||||
public Integer max_ap_boost = null;
|
||||
public List<ConditionEffect> conditions = null;
|
||||
public List<Common.ConditionEffect> conditions = null;
|
||||
public Integer increase_move_cost = null;
|
||||
public Integer increase_use_item_cost = null;
|
||||
public Integer increase_reequip_cost = null;
|
||||
@@ -85,21 +60,7 @@ public class Item extends JSONElement {
|
||||
public Double critical_multiplier = null;
|
||||
public Integer damage_modifier = null;
|
||||
}
|
||||
|
||||
public static class ConditionEffect {
|
||||
//Available from parsed state
|
||||
public Integer magnitude = null;
|
||||
public String condition_id = null;
|
||||
|
||||
//Available from linked state
|
||||
public ActorCondition condition = null;
|
||||
}
|
||||
|
||||
public static class TimedConditionEffect extends ConditionEffect {
|
||||
//Available from parsed state
|
||||
public Integer duration = null;
|
||||
public Double chance = null;
|
||||
}
|
||||
|
||||
|
||||
public static enum DisplayType {
|
||||
ordinary,
|
||||
@@ -207,10 +168,10 @@ public class Item extends JSONElement {
|
||||
|
||||
List conditionsJson = (List) equipEffect.get("addedConditions");
|
||||
if (conditionsJson != null && !conditionsJson.isEmpty()) {
|
||||
this.equip_effect.conditions = new ArrayList<Item.ConditionEffect>();
|
||||
this.equip_effect.conditions = new ArrayList<>();
|
||||
for (Object conditionJsonObj : conditionsJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
ConditionEffect condition = new ConditionEffect();
|
||||
Common.ConditionEffect condition = new Common.ConditionEffect();
|
||||
condition.condition_id = (String) conditionJson.get("condition");
|
||||
condition.magnitude = JSONElement.getInteger((Number) conditionJson.get("magnitude"));
|
||||
this.equip_effect.conditions.add(condition);
|
||||
@@ -221,46 +182,24 @@ public class Item extends JSONElement {
|
||||
|
||||
Map hitEffect = (Map) itemJson.get("hitEffect");
|
||||
if (hitEffect != null) {
|
||||
this.hit_effect = new HitEffect();
|
||||
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")));
|
||||
this.hit_effect.ap_boost_max = JSONElement.getInteger((Number) (((Map) hitEffect.get("increaseCurrentAP")).get("max")));
|
||||
}
|
||||
List conditionsSourceJson = (List) hitEffect.get("conditionsSource");
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
this.hit_effect.conditions_source = new ArrayList<Item.TimedConditionEffect>();
|
||||
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"));
|
||||
condition.duration = JSONElement.getInteger((Number) conditionJson.get("duration"));
|
||||
if (conditionJson.get("chance") != null) condition.chance = JSONElement.parseChance(conditionJson.get("chance").toString());
|
||||
this.hit_effect.conditions_source.add(condition);
|
||||
}
|
||||
}
|
||||
this.hit_effect.conditions_source = Common.parseTimedConditionEffects(conditionsSourceJson);
|
||||
List conditionsTargetJson = (List) hitEffect.get("conditionsTarget");
|
||||
if (conditionsTargetJson != null && !conditionsTargetJson.isEmpty()) {
|
||||
this.hit_effect.conditions_target = new ArrayList<Item.TimedConditionEffect>();
|
||||
for (Object conditionJsonObj : conditionsTargetJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
TimedConditionEffect condition = new 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_effect.conditions_target.add(condition);
|
||||
}
|
||||
}
|
||||
this.hit_effect.conditions_target = Common.parseTimedConditionEffects(conditionsTargetJson);
|
||||
}
|
||||
|
||||
Map hitReceivedEffect = (Map) itemJson.get("hitReceivedEffect");
|
||||
if (hitReceivedEffect != null) {
|
||||
this.hit_received_effect = new HitReceivedEffect();
|
||||
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")));
|
||||
@@ -279,10 +218,10 @@ public class Item extends JSONElement {
|
||||
}
|
||||
List conditionsSourceJson = (List) hitReceivedEffect.get("conditionsSource");
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
this.hit_received_effect.conditions_source = new ArrayList<Item.TimedConditionEffect>();
|
||||
this.hit_received_effect.conditions_source = new ArrayList<>();
|
||||
for (Object conditionJsonObj : conditionsSourceJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
TimedConditionEffect condition = new TimedConditionEffect();
|
||||
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"));
|
||||
@@ -292,10 +231,10 @@ public class Item extends JSONElement {
|
||||
}
|
||||
List conditionsTargetJson = (List) hitReceivedEffect.get("conditionsTarget");
|
||||
if (conditionsTargetJson != null && !conditionsTargetJson.isEmpty()) {
|
||||
this.hit_received_effect.conditions_target = new ArrayList<Item.TimedConditionEffect>();
|
||||
this.hit_received_effect.conditions_target = new ArrayList<>();
|
||||
for (Object conditionJsonObj : conditionsTargetJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
TimedConditionEffect condition = new TimedConditionEffect();
|
||||
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"));
|
||||
@@ -310,7 +249,7 @@ public class Item extends JSONElement {
|
||||
killEffect = (Map) itemJson.get("useEffect");
|
||||
}
|
||||
if (killEffect != null) {
|
||||
this.kill_effect = new KillEffect();
|
||||
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")));
|
||||
@@ -321,10 +260,10 @@ public class Item extends JSONElement {
|
||||
}
|
||||
List conditionsSourceJson = (List) killEffect.get("conditionsSource");
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
this.kill_effect.conditions_source = new ArrayList<Item.TimedConditionEffect>();
|
||||
this.kill_effect.conditions_source = new ArrayList<>();
|
||||
for (Object conditionJsonObj : conditionsSourceJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
TimedConditionEffect condition = new TimedConditionEffect();
|
||||
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"));
|
||||
@@ -363,37 +302,37 @@ public class Item extends JSONElement {
|
||||
if (this.category_id != null) this.category = proj.getItemCategory(this.category_id);
|
||||
if (this.category != null) this.category.addBacklink(this);
|
||||
if (this.equip_effect != null && this.equip_effect.conditions != null) {
|
||||
for (ConditionEffect ce : this.equip_effect.conditions) {
|
||||
for (Common.ConditionEffect ce : this.equip_effect.conditions) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
}
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_source != null) {
|
||||
for (TimedConditionEffect ce : this.hit_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect ce : this.hit_effect.conditions_source) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
}
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_target != null) {
|
||||
for (TimedConditionEffect ce : this.hit_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect ce : this.hit_effect.conditions_target) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect != null && this.hit_received_effect.conditions_source != null) {
|
||||
for (TimedConditionEffect ce : this.hit_received_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect ce : this.hit_received_effect.conditions_source) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect != null && this.hit_received_effect.conditions_target != null) {
|
||||
for (TimedConditionEffect ce : this.hit_received_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect ce : this.hit_received_effect.conditions_target) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
}
|
||||
if (this.kill_effect != null && this.kill_effect.conditions_source != null) {
|
||||
for (TimedConditionEffect ce : this.kill_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect ce : this.kill_effect.conditions_source) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
@@ -444,9 +383,9 @@ public class Item extends JSONElement {
|
||||
clone.equip_effect.max_ap_boost = this.equip_effect.max_ap_boost;
|
||||
clone.equip_effect.max_hp_boost = this.equip_effect.max_hp_boost;
|
||||
if (this.equip_effect.conditions != null) {
|
||||
clone.equip_effect.conditions = new ArrayList<Item.ConditionEffect>();
|
||||
for (ConditionEffect c : this.equip_effect.conditions) {
|
||||
ConditionEffect cclone = new ConditionEffect();
|
||||
clone.equip_effect.conditions = new ArrayList<>();
|
||||
for (Common.ConditionEffect c : this.equip_effect.conditions) {
|
||||
Common.ConditionEffect cclone = new Common.ConditionEffect();
|
||||
cclone.magnitude = c.magnitude;
|
||||
cclone.condition_id = c.condition_id;
|
||||
cclone.condition = c.condition;
|
||||
@@ -458,15 +397,15 @@ public class Item extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_effect != null) {
|
||||
clone.hit_effect = new HitEffect();
|
||||
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<Item.TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.hit_effect.conditions_source) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -479,9 +418,9 @@ public class Item extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_effect.conditions_target != null) {
|
||||
clone.hit_effect.conditions_target = new ArrayList<Item.TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.hit_effect.conditions_target) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -495,7 +434,7 @@ public class Item extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect != null) {
|
||||
clone.hit_received_effect = new HitReceivedEffect();
|
||||
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;
|
||||
@@ -505,9 +444,9 @@ public class Item extends JSONElement {
|
||||
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<Item.TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.hit_received_effect.conditions_source) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -520,9 +459,9 @@ public class Item extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect.conditions_target != null) {
|
||||
clone.hit_received_effect.conditions_target = new ArrayList<Item.TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.hit_received_effect.conditions_target) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -536,15 +475,15 @@ public class Item extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.kill_effect != null) {
|
||||
clone.kill_effect = new KillEffect();
|
||||
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<Item.TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.kill_effect.conditions_source) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -568,7 +507,7 @@ public class Item extends JSONElement {
|
||||
if (newOne != null) newOne.addBacklink(this);
|
||||
} else {
|
||||
if (this.equip_effect != null && this.equip_effect.conditions != null) {
|
||||
for (ConditionEffect c : this.equip_effect.conditions) {
|
||||
for (Common.ConditionEffect c : this.equip_effect.conditions) {
|
||||
if (c.condition == oldOne) {
|
||||
oldOne.removeBacklink(this);
|
||||
c.condition = (ActorCondition) newOne;
|
||||
@@ -577,7 +516,7 @@ public class Item extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_source != null) {
|
||||
for (TimedConditionEffect c : this.hit_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect c : this.hit_effect.conditions_source) {
|
||||
if (c.condition == oldOne) {
|
||||
oldOne.removeBacklink(this);
|
||||
c.condition = (ActorCondition) newOne;
|
||||
@@ -586,7 +525,7 @@ public class Item extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_target != null) {
|
||||
for (TimedConditionEffect c : this.hit_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect c : this.hit_effect.conditions_target) {
|
||||
if (c.condition == oldOne) {
|
||||
oldOne.removeBacklink(this);
|
||||
c.condition = (ActorCondition) newOne;
|
||||
@@ -596,7 +535,7 @@ public class Item extends JSONElement {
|
||||
}
|
||||
|
||||
if (this.kill_effect != null && this.kill_effect.conditions_source != null) {
|
||||
for (TimedConditionEffect c : this.kill_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect c : this.kill_effect.conditions_source) {
|
||||
if (c.condition == oldOne) {
|
||||
oldOne.removeBacklink(this);
|
||||
c.condition = (ActorCondition) newOne;
|
||||
@@ -650,7 +589,7 @@ public class Item extends JSONElement {
|
||||
if (this.equip_effect.conditions != null) {
|
||||
List conditionsJson = new ArrayList();
|
||||
equipEffectJson.put("addedConditions", conditionsJson);
|
||||
for (ConditionEffect condition : this.equip_effect.conditions) {
|
||||
for (Common.ConditionEffect condition : this.equip_effect.conditions) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
@@ -684,7 +623,7 @@ public class Item extends JSONElement {
|
||||
if (this.hit_effect.conditions_source != null) {
|
||||
List conditionsSourceJson = new ArrayList();
|
||||
hitEffectJson.put("conditionsSource", conditionsSourceJson);
|
||||
for (TimedConditionEffect condition : this.hit_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect condition : this.hit_effect.conditions_source) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsSourceJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
@@ -700,7 +639,7 @@ public class Item extends JSONElement {
|
||||
if (this.hit_effect.conditions_target != null) {
|
||||
List conditionsTargetJson = new ArrayList();
|
||||
hitEffectJson.put("conditionsTarget", conditionsTargetJson);
|
||||
for (TimedConditionEffect condition : this.hit_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect condition : this.hit_effect.conditions_target) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsTargetJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
@@ -752,7 +691,7 @@ public class Item extends JSONElement {
|
||||
if (this.hit_received_effect.conditions_source != null) {
|
||||
List conditionsSourceJson = new ArrayList();
|
||||
hitReceivedEffectJson.put("conditionsSource", conditionsSourceJson);
|
||||
for (TimedConditionEffect condition : this.hit_received_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect condition : this.hit_received_effect.conditions_source) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsSourceJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
@@ -768,7 +707,7 @@ public class Item extends JSONElement {
|
||||
if (this.hit_received_effect.conditions_target != null) {
|
||||
List conditionsTargetJson = new ArrayList();
|
||||
hitReceivedEffectJson.put("conditionsTarget", conditionsTargetJson);
|
||||
for (TimedConditionEffect condition : this.hit_received_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect condition : this.hit_received_effect.conditions_target) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsTargetJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
@@ -808,7 +747,7 @@ public class Item extends JSONElement {
|
||||
if (this.kill_effect.conditions_source != null) {
|
||||
List conditionsSourceJson = new ArrayList();
|
||||
killEffectJson.put("conditionsSource", conditionsSourceJson);
|
||||
for (TimedConditionEffect condition : this.kill_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect condition : this.kill_effect.conditions_source) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsSourceJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
|
||||
@@ -18,6 +18,9 @@ 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;
|
||||
|
||||
public class NPC extends JSONElement {
|
||||
|
||||
private static final long serialVersionUID = 1093728879485491933L;
|
||||
@@ -46,9 +49,9 @@ public class NPC extends JSONElement {
|
||||
public Double critical_multiplier = null;
|
||||
public Integer block_chance = null;
|
||||
public Integer damage_resistance = null;
|
||||
public HitEffect hit_effect = null;
|
||||
public HitReceivedEffect hit_received_effect = null;
|
||||
public DeathEffect death_effect = null;
|
||||
public Common.HitEffect hit_effect = null;
|
||||
public Common.HitReceivedEffect hit_received_effect = null;
|
||||
public Common.DeathEffect death_effect = null;
|
||||
|
||||
//Available from linked state
|
||||
public Dialogue dialogue = null;
|
||||
@@ -73,40 +76,6 @@ public class NPC extends JSONElement {
|
||||
wholeMap
|
||||
}
|
||||
|
||||
public static class DeathEffect {
|
||||
//Available from parsed state
|
||||
public Integer hp_boost_min = null;
|
||||
public Integer hp_boost_max = null;
|
||||
public Integer ap_boost_min = null;
|
||||
public Integer ap_boost_max = null;
|
||||
public List<TimedConditionEffect> conditions_source = null;
|
||||
}
|
||||
|
||||
public static class HitEffect extends DeathEffect {
|
||||
//Available from parsed state
|
||||
public List<TimedConditionEffect> conditions_target = null;
|
||||
}
|
||||
|
||||
public static class HitReceivedEffect extends 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 static class TimedConditionEffect {
|
||||
//Available from parsed state
|
||||
public Integer magnitude = null;
|
||||
public String condition_id = null;
|
||||
public Integer duration = null;
|
||||
public Double chance = null;
|
||||
|
||||
//Available from linked state
|
||||
public ActorCondition condition = null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc() {
|
||||
return (needsSaving() ? "*" : "")+name+" ("+id+")";
|
||||
@@ -201,7 +170,7 @@ public class NPC extends JSONElement {
|
||||
|
||||
Map hitEffect = (Map) npcJson.get("hitEffect");
|
||||
if (hitEffect != null) {
|
||||
this.hit_effect = new HitEffect();
|
||||
this.hit_effect = new Common.HitEffect();
|
||||
if (hitEffect.get("increaseCurrentHP") != null) {
|
||||
this.hit_effect.hp_boost_max = JSONElement.getInteger((Number) (((Map)hitEffect.get("increaseCurrentHP")).get("max")));
|
||||
this.hit_effect.hp_boost_min = JSONElement.getInteger((Number) (((Map)hitEffect.get("increaseCurrentHP")).get("min")));
|
||||
@@ -211,83 +180,17 @@ public class NPC extends JSONElement {
|
||||
this.hit_effect.ap_boost_min = JSONElement.getInteger((Number) (((Map)hitEffect.get("increaseCurrentAP")).get("min")));
|
||||
}
|
||||
List conditionsSourceJson = (List) hitEffect.get("conditionsSource");
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
this.hit_effect.conditions_source = new ArrayList<NPC.TimedConditionEffect>();
|
||||
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"));
|
||||
condition.duration = JSONElement.getInteger((Number) conditionJson.get("duration"));
|
||||
if (conditionJson.get("chance") != null) condition.chance = JSONElement.parseChance(conditionJson.get("chance").toString());
|
||||
this.hit_effect.conditions_source.add(condition);
|
||||
}
|
||||
}
|
||||
this.hit_effect.conditions_source = parseTimedConditionEffects(conditionsSourceJson);
|
||||
List conditionsTargetJson = (List) hitEffect.get("conditionsTarget");
|
||||
if (conditionsTargetJson != null && !conditionsTargetJson.isEmpty()) {
|
||||
this.hit_effect.conditions_target = new ArrayList<NPC.TimedConditionEffect>();
|
||||
for (Object conditionJsonObj : conditionsTargetJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
TimedConditionEffect condition = new 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_effect.conditions_target.add(condition);
|
||||
}
|
||||
}
|
||||
this.hit_effect.conditions_target = parseTimedConditionEffects(conditionsTargetJson);
|
||||
}
|
||||
|
||||
Map hitReceivedEffect = (Map) npcJson.get("hitReceivedEffect");
|
||||
if (hitReceivedEffect != null) {
|
||||
this.hit_received_effect = new HitReceivedEffect();
|
||||
if (hitReceivedEffect.get("increaseCurrentHP") != null) {
|
||||
this.hit_received_effect.hp_boost_max = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseCurrentHP")).get("max")));
|
||||
this.hit_received_effect.hp_boost_min = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseCurrentHP")).get("min")));
|
||||
}
|
||||
if (hitReceivedEffect.get("increaseCurrentAP") != null) {
|
||||
this.hit_received_effect.ap_boost_max = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseCurrentAP")).get("max")));
|
||||
this.hit_received_effect.ap_boost_min = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseCurrentAP")).get("min")));
|
||||
}
|
||||
if (hitReceivedEffect.get("increaseAttackerCurrentHP") != null) {
|
||||
this.hit_received_effect.hp_boost_max_target = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseAttackerCurrentHP")).get("max")));
|
||||
this.hit_received_effect.hp_boost_min_target = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseAttackerCurrentHP")).get("min")));
|
||||
}
|
||||
if (hitReceivedEffect.get("increaseAttackerCurrentAP") != null) {
|
||||
this.hit_received_effect.ap_boost_max_target = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseAttackerCurrentAP")).get("max")));
|
||||
this.hit_received_effect.ap_boost_min_target = JSONElement.getInteger((Number) (((Map)hitReceivedEffect.get("increaseAttackerCurrentAP")).get("min")));
|
||||
}
|
||||
List conditionsSourceJson = (List) hitReceivedEffect.get("conditionsSource");
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
this.hit_received_effect.conditions_source = new ArrayList<NPC.TimedConditionEffect>();
|
||||
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"));
|
||||
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<NPC.TimedConditionEffect>();
|
||||
for (Object conditionJsonObj : conditionsTargetJson) {
|
||||
Map conditionJson = (Map)conditionJsonObj;
|
||||
TimedConditionEffect condition = new 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map hitReceivedEffect = (Map) npcJson.get("Common.HitReceivedEffect");
|
||||
this.hit_received_effect = Common.parseHitReceivedEffect(hitReceivedEffect);
|
||||
|
||||
Map deathEffect = (Map) npcJson.get("deathEffect");
|
||||
if (deathEffect != null) {
|
||||
this.death_effect = new HitEffect();
|
||||
this.death_effect = new Common.HitEffect();
|
||||
if (deathEffect.get("increaseCurrentHP") != null) {
|
||||
this.death_effect.hp_boost_max = JSONElement.getInteger((Number) (((Map)deathEffect.get("increaseCurrentHP")).get("max")));
|
||||
this.death_effect.hp_boost_min = JSONElement.getInteger((Number) (((Map)deathEffect.get("increaseCurrentHP")).get("min")));
|
||||
@@ -297,22 +200,11 @@ public class NPC extends JSONElement {
|
||||
this.death_effect.ap_boost_min = JSONElement.getInteger((Number) (((Map)deathEffect.get("increaseCurrentAP")).get("min")));
|
||||
}
|
||||
List conditionsSourceJson = (List) deathEffect.get("conditionsSource");
|
||||
if (conditionsSourceJson != null && !conditionsSourceJson.isEmpty()) {
|
||||
this.death_effect.conditions_source = new ArrayList<NPC.TimedConditionEffect>();
|
||||
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"));
|
||||
condition.duration = JSONElement.getInteger((Number) conditionJson.get("duration"));
|
||||
if (conditionJson.get("chance") != null) condition.chance = JSONElement.parseChance(conditionJson.get("chance").toString());
|
||||
this.death_effect.conditions_source.add(condition);
|
||||
}
|
||||
}
|
||||
this.death_effect.conditions_source = parseTimedConditionEffects(conditionsSourceJson);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void link() {
|
||||
if (this.state == State.created || this.state == State.modified || this.state == State.saved) {
|
||||
@@ -343,31 +235,31 @@ public class NPC extends JSONElement {
|
||||
if (this.droplist != null) this.droplist.addBacklink(this);
|
||||
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_source != null) {
|
||||
for (TimedConditionEffect ce : this.hit_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect ce : this.hit_effect.conditions_source) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
}
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_target != null) {
|
||||
for (TimedConditionEffect ce : this.hit_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect ce : this.hit_effect.conditions_target) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect != null && this.hit_received_effect.conditions_source != null) {
|
||||
for (TimedConditionEffect ce : this.hit_received_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect ce : this.hit_received_effect.conditions_source) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect != null && this.hit_received_effect.conditions_target != null) {
|
||||
for (TimedConditionEffect ce : this.hit_received_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect ce : this.hit_received_effect.conditions_target) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
}
|
||||
if (this.death_effect != null && this.death_effect.conditions_source != null) {
|
||||
for (TimedConditionEffect ce : this.death_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect ce : this.death_effect.conditions_source) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(this);
|
||||
}
|
||||
@@ -412,15 +304,15 @@ 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 HitEffect();
|
||||
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<TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.hit_effect.conditions_source) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -433,9 +325,9 @@ public class NPC extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_effect.conditions_target != null) {
|
||||
clone.hit_effect.conditions_target = new ArrayList<TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.hit_effect.conditions_target) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -449,7 +341,7 @@ public class NPC extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect != null) {
|
||||
clone.hit_received_effect = new HitReceivedEffect();
|
||||
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;
|
||||
@@ -459,9 +351,9 @@ public class NPC extends JSONElement {
|
||||
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<TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.hit_received_effect.conditions_source) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -474,9 +366,9 @@ public class NPC extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_received_effect.conditions_target != null) {
|
||||
clone.hit_received_effect.conditions_target = new ArrayList<TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.hit_received_effect.conditions_target) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -490,15 +382,15 @@ public class NPC extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.death_effect != null) {
|
||||
clone.death_effect = new DeathEffect();
|
||||
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<TimedConditionEffect>();
|
||||
for (TimedConditionEffect c : this.death_effect.conditions_source) {
|
||||
TimedConditionEffect cclone = new TimedConditionEffect();
|
||||
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;
|
||||
@@ -534,7 +426,7 @@ public class NPC extends JSONElement {
|
||||
if (newOne != null) newOne.addBacklink(this);
|
||||
} else {
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_source != null) {
|
||||
for (TimedConditionEffect tce : this.hit_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect tce : this.hit_effect.conditions_source) {
|
||||
if (tce.condition == oldOne) {
|
||||
oldOne.removeBacklink(this);
|
||||
tce.condition = (ActorCondition) newOne;
|
||||
@@ -543,7 +435,7 @@ public class NPC extends JSONElement {
|
||||
}
|
||||
}
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_target != null) {
|
||||
for (TimedConditionEffect tce : this.hit_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect tce : this.hit_effect.conditions_target) {
|
||||
if (tce.condition == oldOne) {
|
||||
oldOne.removeBacklink(this);
|
||||
tce.condition = (ActorCondition) newOne;
|
||||
@@ -616,7 +508,7 @@ public class NPC extends JSONElement {
|
||||
if (this.hit_effect.conditions_source != null) {
|
||||
List conditionsSourceJson = new ArrayList();
|
||||
hitEffectJson.put("conditionsSource", conditionsSourceJson);
|
||||
for (TimedConditionEffect condition : this.hit_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect condition : this.hit_effect.conditions_source) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsSourceJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
@@ -632,7 +524,7 @@ public class NPC extends JSONElement {
|
||||
if (this.hit_effect.conditions_target != null) {
|
||||
List conditionsTargetJson = new ArrayList();
|
||||
hitEffectJson.put("conditionsTarget", conditionsTargetJson);
|
||||
for (TimedConditionEffect condition : this.hit_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect condition : this.hit_effect.conditions_target) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsTargetJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
@@ -675,7 +567,7 @@ public class NPC extends JSONElement {
|
||||
}
|
||||
if (this.hit_received_effect.ap_boost_min_target != null || this.hit_received_effect.ap_boost_max_target != null) {
|
||||
Map apJson = new LinkedHashMap();
|
||||
hitReceivedEffectJson.put("increaseAttackerCurrentAP", apJson);
|
||||
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);
|
||||
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);
|
||||
@@ -684,7 +576,7 @@ public class NPC extends JSONElement {
|
||||
if (this.hit_received_effect.conditions_source != null) {
|
||||
List conditionsSourceJson = new ArrayList();
|
||||
hitReceivedEffectJson.put("conditionsSource", conditionsSourceJson);
|
||||
for (TimedConditionEffect condition : this.hit_received_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect condition : this.hit_received_effect.conditions_source) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsSourceJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
@@ -700,7 +592,7 @@ public class NPC extends JSONElement {
|
||||
if (this.hit_received_effect.conditions_target != null) {
|
||||
List conditionsTargetJson = new ArrayList();
|
||||
hitReceivedEffectJson.put("conditionsTarget", conditionsTargetJson);
|
||||
for (TimedConditionEffect condition : this.hit_received_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect condition : this.hit_received_effect.conditions_target) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsTargetJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
@@ -736,7 +628,7 @@ public class NPC extends JSONElement {
|
||||
if (this.death_effect.conditions_source != null) {
|
||||
List conditionsSourceJson = new ArrayList();
|
||||
deathEffectJson.put("conditionsSource", conditionsSourceJson);
|
||||
for (TimedConditionEffect condition : this.death_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect condition : this.death_effect.conditions_source) {
|
||||
Map conditionJson = new LinkedHashMap();
|
||||
conditionsSourceJson.add(conditionJson);
|
||||
if (condition.condition != null) {
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.ActorCondition;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Common;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Item;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.ItemCategory;
|
||||
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
|
||||
@@ -53,12 +54,12 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private static final String useLabel = "Effect on use: ";
|
||||
|
||||
|
||||
private Item.ConditionEffect selectedEquipEffectCondition;
|
||||
private Item.TimedConditionEffect selectedHitEffectSourceCondition;
|
||||
private Item.TimedConditionEffect selectedHitEffectTargetCondition;
|
||||
private Item.TimedConditionEffect selectedKillEffectCondition;
|
||||
private Item.TimedConditionEffect selectedHitReceivedEffectSourceCondition;
|
||||
private Item.TimedConditionEffect selectedHitReceivedEffectTargetCondition;
|
||||
private Common.ConditionEffect selectedEquipEffectCondition;
|
||||
private Common.TimedConditionEffect selectedHitEffectSourceCondition;
|
||||
private Common.TimedConditionEffect selectedHitEffectTargetCondition;
|
||||
private Common.TimedConditionEffect selectedKillEffectCondition;
|
||||
private Common.TimedConditionEffect selectedHitReceivedEffectSourceCondition;
|
||||
private Common.TimedConditionEffect selectedHitReceivedEffectTargetCondition;
|
||||
|
||||
|
||||
private JButton itemIcon;
|
||||
@@ -97,7 +98,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JSpinner equipConditionMagnitude;
|
||||
|
||||
private CollapsiblePanel hitEffectPane;
|
||||
private Item.HitEffect hitEffect;
|
||||
private Common.HitEffect hitEffect;
|
||||
private JSpinner hitHPMin;
|
||||
private JSpinner hitHPMax;
|
||||
private JSpinner hitAPMin;
|
||||
@@ -128,7 +129,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JSpinner hitTargetConditionDuration;
|
||||
|
||||
private CollapsiblePanel killEffectPane;
|
||||
private Item.KillEffect killEffect;
|
||||
private Common.DeathEffect killEffect;
|
||||
private JSpinner killHPMin;
|
||||
private JSpinner killHPMax;
|
||||
private JSpinner killAPMin;
|
||||
@@ -147,7 +148,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JSpinner killSourceConditionDuration;
|
||||
|
||||
private CollapsiblePanel hitReceivedEffectPane;
|
||||
private Item.HitReceivedEffect hitReceivedEffect;
|
||||
private Common.HitReceivedEffect hitReceivedEffect;
|
||||
private JSpinner hitReceivedHPMin;
|
||||
private JSpinner hitReceivedHPMax;
|
||||
private JSpinner hitReceivedAPMin;
|
||||
@@ -243,7 +244,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
equipConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedEquipEffectCondition = (Item.ConditionEffect) equipConditionsList.getSelectedValue();
|
||||
selectedEquipEffectCondition = (Common.ConditionEffect) equipConditionsList.getSelectedValue();
|
||||
if (selectedEquipEffectCondition == null) {
|
||||
deleteEquipCondition.setEnabled(false);
|
||||
} else {
|
||||
@@ -258,7 +259,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
createEquipCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Item.ConditionEffect condition = new Item.ConditionEffect();
|
||||
Common.ConditionEffect condition = new Common.ConditionEffect();
|
||||
equipConditionsModel.addItem(condition);
|
||||
equipConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(equipConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -295,7 +296,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitEffectPane = new CollapsiblePanel("Effect on every hit: ");
|
||||
hitEffectPane.setLayout(new JideBoxLayout(hitEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (item.hit_effect == null) {
|
||||
hitEffect = new Item.HitEffect();
|
||||
hitEffect = new Common.HitEffect();
|
||||
} else {
|
||||
hitEffect = item.hit_effect;
|
||||
}
|
||||
@@ -316,7 +317,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitSourceConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedHitEffectSourceCondition = (Item.TimedConditionEffect) hitSourceConditionsList.getSelectedValue();
|
||||
selectedHitEffectSourceCondition = (Common.TimedConditionEffect) hitSourceConditionsList.getSelectedValue();
|
||||
updateHitSourceTimedConditionEditorPane(sourceTimedConditionsEditorPane, selectedHitEffectSourceCondition, listener);
|
||||
if (selectedHitEffectSourceCondition == null) {
|
||||
deleteHitSourceCondition.setEnabled(false);
|
||||
@@ -331,7 +332,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
createHitSourceCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Item.TimedConditionEffect condition = new Item.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
hitSourceConditionsModel.addItem(condition);
|
||||
hitSourceConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(hitSourceConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -373,7 +374,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitTargetConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedHitEffectTargetCondition = (Item.TimedConditionEffect) hitTargetConditionsList.getSelectedValue();
|
||||
selectedHitEffectTargetCondition = (Common.TimedConditionEffect) hitTargetConditionsList.getSelectedValue();
|
||||
updateHitTargetTimedConditionEditorPane(targetTimedConditionsEditorPane, selectedHitEffectTargetCondition, listener);
|
||||
if (selectedHitEffectTargetCondition == null) {
|
||||
deleteHitTargetCondition.setEnabled(false);
|
||||
@@ -388,7 +389,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
createHitTargetCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Item.TimedConditionEffect condition = new Item.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
hitTargetConditionsModel.addItem(condition);
|
||||
hitTargetConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(hitTargetConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -427,7 +428,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
killEffectPane = new CollapsiblePanel(killLabel);
|
||||
killEffectPane.setLayout(new JideBoxLayout(killEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (item.kill_effect == null) {
|
||||
killEffect = new Item.KillEffect();
|
||||
killEffect = new Common.DeathEffect();
|
||||
} else {
|
||||
killEffect = item.kill_effect;
|
||||
}
|
||||
@@ -448,7 +449,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
killSourceConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedKillEffectCondition = (Item.TimedConditionEffect) killSourceConditionsList.getSelectedValue();
|
||||
selectedKillEffectCondition = (Common.TimedConditionEffect) killSourceConditionsList.getSelectedValue();
|
||||
updateKillSourceTimedConditionEditorPane(killSourceTimedConditionsEditorPane, selectedKillEffectCondition, listener);
|
||||
if (selectedKillEffectCondition == null) {
|
||||
deleteKillSourceCondition.setEnabled(false);
|
||||
@@ -463,7 +464,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
createKillSourceCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Item.TimedConditionEffect condition = new Item.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
killSourceConditionsModel.addItem(condition);
|
||||
killSourceConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(killSourceConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -501,7 +502,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitReceivedEffectPane = new CollapsiblePanel("Effect on every hit received: ");
|
||||
hitReceivedEffectPane.setLayout(new JideBoxLayout(hitReceivedEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (item.hit_received_effect == null) {
|
||||
hitReceivedEffect = new Item.HitReceivedEffect();
|
||||
hitReceivedEffect = new Common.HitReceivedEffect();
|
||||
} else {
|
||||
hitReceivedEffect = item.hit_received_effect;
|
||||
}
|
||||
@@ -526,7 +527,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitReceivedSourceConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedHitReceivedEffectSourceCondition = (Item.TimedConditionEffect) hitReceivedSourceConditionsList.getSelectedValue();
|
||||
selectedHitReceivedEffectSourceCondition = (Common.TimedConditionEffect) hitReceivedSourceConditionsList.getSelectedValue();
|
||||
updateHitReceivedSourceTimedConditionEditorPane(hitReceivedSourceTimedConditionsEditorPane, selectedHitReceivedEffectSourceCondition, listener);
|
||||
if (selectedHitReceivedEffectSourceCondition == null) {
|
||||
deleteHitReceivedSourceCondition.setEnabled(false);
|
||||
@@ -541,7 +542,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
createHitReceivedSourceCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Item.TimedConditionEffect condition = new Item.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
hitReceivedSourceConditionsModel.addItem(condition);
|
||||
hitReceivedSourceConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(hitReceivedSourceConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -583,7 +584,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitReceivedTargetConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedHitReceivedEffectTargetCondition = (Item.TimedConditionEffect) hitReceivedTargetConditionsList.getSelectedValue();
|
||||
selectedHitReceivedEffectTargetCondition = (Common.TimedConditionEffect) hitReceivedTargetConditionsList.getSelectedValue();
|
||||
updateHitReceivedTargetTimedConditionEditorPane(hitReceivedTargetTimedConditionsEditorPane, selectedHitReceivedEffectTargetCondition, listener);
|
||||
if (selectedHitReceivedEffectTargetCondition == null) {
|
||||
deleteHitReceivedTargetCondition.setEnabled(false);
|
||||
@@ -598,7 +599,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
createHitReceivedTargetCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Item.TimedConditionEffect condition = new Item.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
hitReceivedTargetConditionsModel.addItem(condition);
|
||||
hitReceivedTargetConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(hitReceivedTargetConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -655,7 +656,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
|
||||
}
|
||||
|
||||
public void updateHitSourceTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateHitSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitSourceConditionBox != null) {
|
||||
removeElementListener(hitSourceConditionBox);
|
||||
@@ -733,7 +734,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateHitSourceTimedConditionWidgets(Item.TimedConditionEffect condition) {
|
||||
public void updateHitSourceTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -751,7 +752,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitSourceConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
public void updateHitTargetTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateHitTargetTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitTargetConditionBox != null) {
|
||||
removeElementListener(hitTargetConditionBox);
|
||||
@@ -829,7 +830,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateHitTargetTimedConditionWidgets(Item.TimedConditionEffect condition) {
|
||||
public void updateHitTargetTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -847,7 +848,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitTargetConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
public void updateKillSourceTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateKillSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (killSourceConditionBox != null) {
|
||||
removeElementListener(killSourceConditionBox);
|
||||
@@ -925,7 +926,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateKillSourceTimedConditionWidgets(Item.TimedConditionEffect condition) {
|
||||
public void updateKillSourceTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -943,7 +944,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
killSourceConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
public void updateEquipConditionEditorPane(JPanel pane, Item.ConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateEquipConditionEditorPane(JPanel pane, Common.ConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (equipConditionBox != null) {
|
||||
removeElementListener(equipConditionBox);
|
||||
@@ -991,7 +992,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateHitReceivedSourceTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateHitReceivedSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitReceivedSourceConditionBox != null) {
|
||||
removeElementListener(hitReceivedSourceConditionBox);
|
||||
@@ -1069,7 +1070,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateHitReceivedSourceTimedConditionWidgets(Item.TimedConditionEffect condition) {
|
||||
public void updateHitReceivedSourceTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -1087,7 +1088,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitReceivedSourceConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
public void updateHitReceivedTargetTimedConditionEditorPane(JPanel pane, Item.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateHitReceivedTargetTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitReceivedTargetConditionBox != null) {
|
||||
removeElementListener(hitReceivedTargetConditionBox);
|
||||
@@ -1165,7 +1166,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateHitReceivedTargetTimedConditionWidgets(Item.TimedConditionEffect condition) {
|
||||
public void updateHitReceivedTargetTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -1184,11 +1185,11 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
|
||||
public static class SourceTimedConditionsListModel implements ListModel<Item.TimedConditionEffect> {
|
||||
public static class SourceTimedConditionsListModel implements ListModel<Common.TimedConditionEffect> {
|
||||
|
||||
Item.KillEffect source;
|
||||
Common.DeathEffect source;
|
||||
|
||||
public SourceTimedConditionsListModel(Item.KillEffect effect) {
|
||||
public SourceTimedConditionsListModel(Common.DeathEffect effect) {
|
||||
this.source = effect;;
|
||||
}
|
||||
|
||||
@@ -1199,14 +1200,14 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item.TimedConditionEffect getElementAt(int index) {
|
||||
public Common.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_source == null) return null;
|
||||
return source.conditions_source.get(index);
|
||||
}
|
||||
|
||||
public void addItem(Item.TimedConditionEffect item) {
|
||||
public void addItem(Common.TimedConditionEffect item) {
|
||||
if (source.conditions_source == null) {
|
||||
source.conditions_source = new ArrayList<Item.TimedConditionEffect>();
|
||||
source.conditions_source = new ArrayList<Common.TimedConditionEffect>();
|
||||
}
|
||||
source.conditions_source.add(item);
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
@@ -1215,7 +1216,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Item.TimedConditionEffect item) {
|
||||
public void removeItem(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
source.conditions_source.remove(item);
|
||||
if (source.conditions_source.isEmpty()) {
|
||||
@@ -1226,7 +1227,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void itemChanged(Item.TimedConditionEffect item) {
|
||||
public void itemChanged(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index));
|
||||
@@ -1246,11 +1247,11 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public static class TargetTimedConditionsListModel implements ListModel<Item.TimedConditionEffect> {
|
||||
public static class TargetTimedConditionsListModel implements ListModel<Common.TimedConditionEffect> {
|
||||
|
||||
Item.HitEffect source;
|
||||
Common.HitEffect source;
|
||||
|
||||
public TargetTimedConditionsListModel(Item.HitEffect effect) {
|
||||
public TargetTimedConditionsListModel(Common.HitEffect effect) {
|
||||
this.source = effect;;
|
||||
}
|
||||
|
||||
@@ -1261,14 +1262,14 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item.TimedConditionEffect getElementAt(int index) {
|
||||
public Common.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_target == null) return null;
|
||||
return source.conditions_target.get(index);
|
||||
}
|
||||
|
||||
public void addItem(Item.TimedConditionEffect item) {
|
||||
public void addItem(Common.TimedConditionEffect item) {
|
||||
if (source.conditions_target == null) {
|
||||
source.conditions_target = new ArrayList<Item.TimedConditionEffect>();
|
||||
source.conditions_target = new ArrayList<Common.TimedConditionEffect>();
|
||||
}
|
||||
source.conditions_target.add(item);
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
@@ -1277,7 +1278,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Item.TimedConditionEffect item) {
|
||||
public void removeItem(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
source.conditions_target.remove(item);
|
||||
if (source.conditions_target.isEmpty()) {
|
||||
@@ -1288,7 +1289,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void itemChanged(Item.TimedConditionEffect item) {
|
||||
public void itemChanged(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index));
|
||||
@@ -1316,7 +1317,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
Item.TimedConditionEffect effect = (Item.TimedConditionEffect) value;
|
||||
Common.TimedConditionEffect effect = (Common.TimedConditionEffect) value;
|
||||
|
||||
if (effect.condition != null) {
|
||||
|
||||
@@ -1342,7 +1343,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public static class ConditionsListModel implements ListModel<Item.ConditionEffect> {
|
||||
public static class ConditionsListModel implements ListModel<Common.ConditionEffect> {
|
||||
|
||||
Item.EquipEffect source;
|
||||
|
||||
@@ -1357,14 +1358,14 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item.ConditionEffect getElementAt(int index) {
|
||||
public Common.ConditionEffect getElementAt(int index) {
|
||||
if (source.conditions == null) return null;
|
||||
return source.conditions.get(index);
|
||||
}
|
||||
|
||||
public void addItem(Item.ConditionEffect item) {
|
||||
public void addItem(Common.ConditionEffect item) {
|
||||
if (source.conditions == null) {
|
||||
source.conditions = new ArrayList<Item.ConditionEffect>();
|
||||
source.conditions = new ArrayList<Common.ConditionEffect>();
|
||||
}
|
||||
source.conditions.add(item);
|
||||
int index = source.conditions.indexOf(item);
|
||||
@@ -1373,7 +1374,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Item.ConditionEffect item) {
|
||||
public void removeItem(Common.ConditionEffect item) {
|
||||
int index = source.conditions.indexOf(item);
|
||||
source.conditions.remove(item);
|
||||
if (source.conditions.isEmpty()) {
|
||||
@@ -1384,7 +1385,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void itemChanged(Item.ConditionEffect item) {
|
||||
public void itemChanged(Common.ConditionEffect item) {
|
||||
int index = source.conditions.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index));
|
||||
@@ -1412,7 +1413,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
Item.ConditionEffect effect = (Item.ConditionEffect) value;
|
||||
Common.ConditionEffect effect = (Common.ConditionEffect) value;
|
||||
|
||||
if (effect.condition != null) {
|
||||
if (effect.magnitude == ActorCondition.MAGNITUDE_CLEAR) {
|
||||
@@ -1450,7 +1451,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
|
||||
public static boolean isNull(Item.HitEffect effect) {
|
||||
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;
|
||||
@@ -1461,7 +1462,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
|
||||
public static boolean isNull(Item.KillEffect effect) {
|
||||
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;
|
||||
@@ -1470,7 +1471,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isNull(Item.HitReceivedEffect effect) {
|
||||
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;
|
||||
|
||||
@@ -32,10 +32,7 @@ import com.gpl.rpg.atcontentstudio.ATContentStudio;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.ActorCondition;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Droplist;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.NPC;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.*;
|
||||
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
|
||||
import com.gpl.rpg.atcontentstudio.ui.CollapsiblePanel;
|
||||
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
|
||||
@@ -53,11 +50,11 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private static final String json_view_id = "JSON";
|
||||
private static final String dialogue_tree_id = "Dialogue Tree";
|
||||
|
||||
private NPC.TimedConditionEffect selectedHitEffectSourceCondition;
|
||||
private NPC.TimedConditionEffect selectedHitEffectTargetCondition;
|
||||
private NPC.TimedConditionEffect selectedHitReceivedEffectSourceCondition;
|
||||
private NPC.TimedConditionEffect selectedHitReceivedEffectTargetCondition;
|
||||
private NPC.TimedConditionEffect selectedDeathEffectSourceCondition;
|
||||
private Common.TimedConditionEffect selectedHitEffectSourceCondition;
|
||||
private Common.TimedConditionEffect selectedHitEffectTargetCondition;
|
||||
private Common.TimedConditionEffect selectedHitReceivedEffectSourceCondition;
|
||||
private Common.TimedConditionEffect selectedHitReceivedEffectTargetCondition;
|
||||
private Common.TimedConditionEffect selectedDeathEffectSourceCondition;
|
||||
|
||||
private JButton npcIcon;
|
||||
private JTextField idField;
|
||||
@@ -86,7 +83,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JSpinner blockChance;
|
||||
private JSpinner dmgRes;
|
||||
|
||||
private NPC.HitEffect hitEffect;
|
||||
private Common.HitEffect hitEffect;
|
||||
private CollapsiblePanel hitEffectPane;
|
||||
private JSpinner hitEffectHPMin;
|
||||
private JSpinner hitEffectHPMax;
|
||||
@@ -119,7 +116,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JRadioButton hitTargetConditionForever;
|
||||
private JSpinner hitTargetConditionDuration;
|
||||
|
||||
private NPC.HitReceivedEffect hitReceivedEffect;
|
||||
private Common.HitReceivedEffect hitReceivedEffect;
|
||||
private CollapsiblePanel hitReceivedEffectPane;
|
||||
private JSpinner hitReceivedEffectHPMin;
|
||||
private JSpinner hitReceivedEffectHPMax;
|
||||
@@ -156,7 +153,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JRadioButton hitReceivedTargetConditionForever;
|
||||
private JSpinner hitReceivedTargetConditionDuration;
|
||||
|
||||
private NPC.DeathEffect deathEffect;
|
||||
private Common.DeathEffect deathEffect;
|
||||
private CollapsiblePanel deathEffectPane;
|
||||
private JSpinner deathEffectHPMin;
|
||||
private JSpinner deathEffectHPMax;
|
||||
@@ -270,7 +267,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitEffectPane = new CollapsiblePanel("Effect on every hit: ");
|
||||
hitEffectPane.setLayout(new JideBoxLayout(hitEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (npc.hit_effect == null) {
|
||||
hitEffect = new NPC.HitEffect();
|
||||
hitEffect = new Common.HitEffect();
|
||||
} else {
|
||||
hitEffect = npc.hit_effect;
|
||||
}
|
||||
@@ -292,7 +289,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitSourceConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedHitEffectSourceCondition = (NPC.TimedConditionEffect) hitSourceConditionsList.getSelectedValue();
|
||||
selectedHitEffectSourceCondition = (Common.TimedConditionEffect) hitSourceConditionsList.getSelectedValue();
|
||||
updateHitSourceTimedConditionEditorPane(hitSourceTimedConditionsEditorPane, selectedHitEffectSourceCondition, listener);
|
||||
}
|
||||
});
|
||||
@@ -302,7 +299,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
createHitSourceCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
NPC.TimedConditionEffect condition = new NPC.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
hitSourceConditionsListModel.addItem(condition);
|
||||
hitSourceConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(hitSourceConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -344,7 +341,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitTargetConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedHitEffectTargetCondition = (NPC.TimedConditionEffect) hitTargetConditionsList.getSelectedValue();
|
||||
selectedHitEffectTargetCondition = (Common.TimedConditionEffect) hitTargetConditionsList.getSelectedValue();
|
||||
updateHitTargetTimedConditionEditorPane(hitTargetTimedConditionsEditorPane, selectedHitEffectTargetCondition, listener);
|
||||
}
|
||||
});
|
||||
@@ -354,7 +351,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
createHitTargetCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
NPC.TimedConditionEffect condition = new NPC.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
hitTargetConditionsListModel.addItem(condition);
|
||||
hitTargetConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(hitTargetConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -388,7 +385,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitReceivedEffectPane = new CollapsiblePanel("Effect on every hit received: ");
|
||||
hitReceivedEffectPane.setLayout(new JideBoxLayout(hitReceivedEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (npc.hit_received_effect == null) {
|
||||
hitReceivedEffect = new NPC.HitReceivedEffect();
|
||||
hitReceivedEffect = new Common.HitReceivedEffect();
|
||||
} else {
|
||||
hitReceivedEffect = npc.hit_received_effect;
|
||||
}
|
||||
@@ -414,7 +411,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitReceivedSourceConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedHitReceivedEffectSourceCondition = (NPC.TimedConditionEffect) hitReceivedSourceConditionsList.getSelectedValue();
|
||||
selectedHitReceivedEffectSourceCondition = (Common.TimedConditionEffect) hitReceivedSourceConditionsList.getSelectedValue();
|
||||
updateHitReceivedSourceTimedConditionEditorPane(hitReceivedSourceTimedConditionsEditorPane, selectedHitReceivedEffectSourceCondition, listener);
|
||||
}
|
||||
});
|
||||
@@ -424,7 +421,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
createHitReceivedSourceCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
NPC.TimedConditionEffect condition = new NPC.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
hitReceivedSourceConditionsListModel.addItem(condition);
|
||||
hitReceivedSourceConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(hitReceivedSourceConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -466,7 +463,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitReceivedTargetConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedHitReceivedEffectTargetCondition = (NPC.TimedConditionEffect) hitReceivedTargetConditionsList.getSelectedValue();
|
||||
selectedHitReceivedEffectTargetCondition = (Common.TimedConditionEffect) hitReceivedTargetConditionsList.getSelectedValue();
|
||||
updateHitReceivedTargetTimedConditionEditorPane(hitReceivedTargetTimedConditionsEditorPane, selectedHitReceivedEffectTargetCondition, listener);
|
||||
}
|
||||
});
|
||||
@@ -476,7 +473,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
createHitReceivedTargetCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
NPC.TimedConditionEffect condition = new NPC.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
hitReceivedTargetConditionsListModel.addItem(condition);
|
||||
hitReceivedTargetConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(hitReceivedTargetConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -510,7 +507,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
deathEffectPane = new CollapsiblePanel("Effect when killed: ");
|
||||
deathEffectPane.setLayout(new JideBoxLayout(deathEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (npc.death_effect == null) {
|
||||
deathEffect = new NPC.DeathEffect();
|
||||
deathEffect = new Common.DeathEffect();
|
||||
} else {
|
||||
deathEffect = npc.death_effect;
|
||||
}
|
||||
@@ -532,7 +529,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
deathSourceConditionsList.addListSelectionListener(new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
selectedDeathEffectSourceCondition = (NPC.TimedConditionEffect) deathSourceConditionsList.getSelectedValue();
|
||||
selectedDeathEffectSourceCondition = (Common.TimedConditionEffect) deathSourceConditionsList.getSelectedValue();
|
||||
updateDeathSourceTimedConditionEditorPane(deathSourceTimedConditionsEditorPane, selectedDeathEffectSourceCondition, listener);
|
||||
}
|
||||
});
|
||||
@@ -542,7 +539,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
createDeathSourceCondition.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
NPC.TimedConditionEffect condition = new NPC.TimedConditionEffect();
|
||||
Common.TimedConditionEffect condition = new Common.TimedConditionEffect();
|
||||
deathSourceConditionsListModel.addItem(condition);
|
||||
deathSourceConditionsList.setSelectedValue(condition, true);
|
||||
listener.valueChanged(deathSourceConditionsList, null); //Item changed, but we took care of it, just do the usual notification and JSON update stuff.
|
||||
@@ -577,7 +574,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.add(combatTraitPane, JideBoxLayout.FIX);
|
||||
}
|
||||
|
||||
public void updateHitSourceTimedConditionEditorPane(JPanel pane, NPC.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateHitSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitSourceConditionBox != null) {
|
||||
removeElementListener(hitSourceConditionBox);
|
||||
@@ -649,7 +646,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateHitSourceTimedConditionWidgets(NPC.TimedConditionEffect condition) {
|
||||
public void updateHitSourceTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -668,7 +665,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
|
||||
public void updateHitTargetTimedConditionEditorPane(JPanel pane, NPC.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateHitTargetTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitTargetConditionBox != null) {
|
||||
removeElementListener(hitTargetConditionBox);
|
||||
@@ -739,7 +736,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateHitTargetTimedConditionWidgets(NPC.TimedConditionEffect condition) {
|
||||
public void updateHitTargetTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -758,7 +755,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
|
||||
public void updateHitReceivedSourceTimedConditionEditorPane(JPanel pane, NPC.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateHitReceivedSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitReceivedSourceConditionBox != null) {
|
||||
removeElementListener(hitReceivedSourceConditionBox);
|
||||
@@ -830,7 +827,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateHitReceivedSourceTimedConditionWidgets(NPC.TimedConditionEffect condition) {
|
||||
public void updateHitReceivedSourceTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -849,7 +846,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
|
||||
public void updateHitReceivedTargetTimedConditionEditorPane(JPanel pane, NPC.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateHitReceivedTargetTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitReceivedTargetConditionBox != null) {
|
||||
removeElementListener(hitReceivedTargetConditionBox);
|
||||
@@ -920,7 +917,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateHitReceivedTargetTimedConditionWidgets(NPC.TimedConditionEffect condition) {
|
||||
public void updateHitReceivedTargetTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -938,7 +935,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitReceivedTargetConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
public void updateDeathSourceTimedConditionEditorPane(JPanel pane, NPC.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
public void updateDeathSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (deathSourceConditionBox != null) {
|
||||
removeElementListener(deathSourceConditionBox);
|
||||
@@ -1010,7 +1007,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public void updateDeathSourceTimedConditionWidgets(NPC.TimedConditionEffect condition) {
|
||||
public void updateDeathSourceTimedConditionWidgets(Common.TimedConditionEffect condition) {
|
||||
|
||||
boolean immunity = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration != null && condition.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (condition.duration == null || condition.duration == ActorCondition.DURATION_NONE);
|
||||
@@ -1028,11 +1025,11 @@ public class NPCEditor extends JSONElementEditor {
|
||||
deathSourceConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
public static class TargetTimedConditionsListModel implements ListModel<NPC.TimedConditionEffect> {
|
||||
public static class TargetTimedConditionsListModel implements ListModel<Common.TimedConditionEffect> {
|
||||
|
||||
NPC.HitEffect source;
|
||||
Common.HitEffect source;
|
||||
|
||||
public TargetTimedConditionsListModel(NPC.HitEffect effect) {
|
||||
public TargetTimedConditionsListModel(Common.HitEffect effect) {
|
||||
this.source = effect;
|
||||
}
|
||||
|
||||
@@ -1043,14 +1040,14 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC.TimedConditionEffect getElementAt(int index) {
|
||||
public Common.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_target == null) return null;
|
||||
return source.conditions_target.get(index);
|
||||
}
|
||||
|
||||
public void addItem(NPC.TimedConditionEffect item) {
|
||||
public void addItem(Common.TimedConditionEffect item) {
|
||||
if (source.conditions_target == null) {
|
||||
source.conditions_target = new ArrayList<NPC.TimedConditionEffect>();
|
||||
source.conditions_target = new ArrayList<Common.TimedConditionEffect>();
|
||||
}
|
||||
source.conditions_target.add(item);
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
@@ -1059,7 +1056,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(NPC.TimedConditionEffect item) {
|
||||
public void removeItem(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
source.conditions_target.remove(item);
|
||||
if (source.conditions_target.isEmpty()) {
|
||||
@@ -1070,7 +1067,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void itemChanged(NPC.TimedConditionEffect item) {
|
||||
public void itemChanged(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index));
|
||||
@@ -1090,11 +1087,11 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public static class SourceTimedConditionsListModel implements ListModel<NPC.TimedConditionEffect> {
|
||||
public static class SourceTimedConditionsListModel implements ListModel<Common.TimedConditionEffect> {
|
||||
|
||||
NPC.DeathEffect source;
|
||||
Common.DeathEffect source;
|
||||
|
||||
public SourceTimedConditionsListModel(NPC.DeathEffect effect) {
|
||||
public SourceTimedConditionsListModel(Common.DeathEffect effect) {
|
||||
this.source = effect;
|
||||
}
|
||||
|
||||
@@ -1105,14 +1102,14 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPC.TimedConditionEffect getElementAt(int index) {
|
||||
public Common.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_source == null) return null;
|
||||
return source.conditions_source.get(index);
|
||||
}
|
||||
|
||||
public void addItem(NPC.TimedConditionEffect item) {
|
||||
public void addItem(Common.TimedConditionEffect item) {
|
||||
if (source.conditions_source == null) {
|
||||
source.conditions_source = new ArrayList<NPC.TimedConditionEffect>();
|
||||
source.conditions_source = new ArrayList<Common.TimedConditionEffect>();
|
||||
}
|
||||
source.conditions_source.add(item);
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
@@ -1121,7 +1118,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(NPC.TimedConditionEffect item) {
|
||||
public void removeItem(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
source.conditions_source.remove(item);
|
||||
if (source.conditions_source.isEmpty()) {
|
||||
@@ -1132,7 +1129,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public void itemChanged(NPC.TimedConditionEffect item) {
|
||||
public void itemChanged(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index));
|
||||
@@ -1160,7 +1157,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
NPC.TimedConditionEffect effect = (NPC.TimedConditionEffect) value;
|
||||
Common.TimedConditionEffect effect = (Common.TimedConditionEffect) value;
|
||||
|
||||
if (effect.condition != null) {
|
||||
|
||||
@@ -1186,7 +1183,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNull(NPC.HitEffect effect) {
|
||||
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;
|
||||
@@ -1196,7 +1193,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isNull(NPC.HitReceivedEffect effect) {
|
||||
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;
|
||||
@@ -1210,7 +1207,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isNull(NPC.DeathEffect effect) {
|
||||
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;
|
||||
|
||||
@@ -5,14 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameSource;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.ActorCondition;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Droplist;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Item;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.ItemCategory;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.NPC;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Quest;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Requirement;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.*;
|
||||
import com.gpl.rpg.atcontentstudio.model.maps.ContainerArea;
|
||||
import com.gpl.rpg.atcontentstudio.model.maps.KeyArea;
|
||||
import com.gpl.rpg.atcontentstudio.model.maps.MapChange;
|
||||
@@ -111,18 +104,18 @@ public class GDEVisitor {
|
||||
visit(element.category, visited, includeSource);
|
||||
if (element.icon_id != null) visit(element.getProject().getSpritesheet(element.icon_id.split(":")[0]), visited, includeSource);
|
||||
if (element.equip_effect != null && element.equip_effect.conditions != null) {
|
||||
for (Item.ConditionEffect condEffect : element.equip_effect.conditions) {
|
||||
for (Common.ConditionEffect condEffect : element.equip_effect.conditions) {
|
||||
visit(condEffect.condition, visited, includeSource);
|
||||
}
|
||||
}
|
||||
if (element.hit_effect != null) {
|
||||
if (element.hit_effect.conditions_source != null) {
|
||||
for (Item.ConditionEffect condEffect : element.hit_effect.conditions_source) {
|
||||
for (Common.ConditionEffect condEffect : element.hit_effect.conditions_source) {
|
||||
visit(condEffect.condition, visited, includeSource);
|
||||
}
|
||||
}
|
||||
if (element.hit_effect.conditions_target != null) {
|
||||
for (Item.ConditionEffect condEffect : element.hit_effect.conditions_target) {
|
||||
for (Common.ConditionEffect condEffect : element.hit_effect.conditions_target) {
|
||||
visit(condEffect.condition, visited, includeSource);
|
||||
}
|
||||
}
|
||||
@@ -144,12 +137,12 @@ public class GDEVisitor {
|
||||
if (element.icon_id != null) visit(element.getProject().getSpritesheet(element.icon_id.split(":")[0]), visited, includeSource);
|
||||
if (element.hit_effect != null) {
|
||||
if (element.hit_effect.conditions_source != null) {
|
||||
for (NPC.TimedConditionEffect condEffect : element.hit_effect.conditions_source) {
|
||||
for (Common.TimedConditionEffect condEffect : element.hit_effect.conditions_source) {
|
||||
visit(condEffect.condition, visited, includeSource);
|
||||
}
|
||||
}
|
||||
if (element.hit_effect.conditions_target != null) {
|
||||
for (NPC.TimedConditionEffect condEffect : element.hit_effect.conditions_target) {
|
||||
for (Common.TimedConditionEffect condEffect : element.hit_effect.conditions_target) {
|
||||
visit(condEffect.condition, visited, includeSource);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user