mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-26 23:57:25 +01:00
more de-duplication
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.gpl.rpg.atcontentstudio.model.gamedata;
|
||||
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -8,6 +9,14 @@ import java.util.Map;
|
||||
|
||||
public final class Common {
|
||||
|
||||
public static void linkConditions(List<?extends ConditionEffect> conditions, Project proj, GameDataElement backlink) {
|
||||
if (conditions != null) {
|
||||
for (ConditionEffect ce : conditions) {
|
||||
if (ce.condition_id != null) ce.condition = proj.getActorCondition(ce.condition_id);
|
||||
if (ce.condition != null) ce.condition.addBacklink(backlink);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static class TimedConditionEffect extends ConditionEffect {
|
||||
//Available from parsed state
|
||||
public Integer duration = null;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -235,39 +235,20 @@ public class NPC extends JSONElement {
|
||||
if (this.droplist_id != null) this.droplist = proj.getDroplist(this.droplist_id);
|
||||
if (this.droplist != null) this.droplist.addBacklink(this);
|
||||
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_source != null) {
|
||||
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) {
|
||||
linkConditions(this.hit_effect.conditions_source, proj, this);
|
||||
linkConditions(this.hit_effect.conditions_target, proj, this);
|
||||
}
|
||||
if (this.hit_effect != null && this.hit_effect.conditions_target != null) {
|
||||
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) {
|
||||
linkConditions(this.hit_received_effect.conditions_source, proj, this);
|
||||
linkConditions(this.hit_received_effect.conditions_target, proj, this);
|
||||
}
|
||||
if (this.hit_received_effect != null && this.hit_received_effect.conditions_source != null) {
|
||||
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 (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 (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);
|
||||
}
|
||||
if (this.death_effect != null) {
|
||||
linkConditions(this.death_effect.conditions_source, proj, this);
|
||||
}
|
||||
this.state = State.linked;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Image getIcon() {
|
||||
return getProject().getIcon(icon_id);
|
||||
|
||||
Reference in New Issue
Block a user