mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-26 23:57:25 +01:00
refactor: change more ListModel implementations to AtListModel
This commit is contained in:
@@ -65,12 +65,12 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private static final String form_view_id = "Form";
|
||||
private static final String json_view_id = "JSON";
|
||||
private static final String graph_view_id = "Dialogue Tree";
|
||||
|
||||
|
||||
private Dialogue.Reward selectedReward;
|
||||
private Dialogue.Reply selectedReply;
|
||||
private Requirement selectedRequirement;
|
||||
|
||||
|
||||
|
||||
|
||||
private static final String[] replyTypes = new String[]{
|
||||
"Phrase leads to another without replies.",
|
||||
"NPC replies too.",
|
||||
@@ -85,11 +85,11 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private static final int FIGHT_INDEX = 3;
|
||||
private static final int REMOVE_INDEX = 4;
|
||||
private static final int SHOP_INDEX = 5;
|
||||
|
||||
|
||||
private JTextField idField;
|
||||
private JTextArea messageField;
|
||||
private MyComboBox switchToNpcBox;
|
||||
|
||||
|
||||
private RewardsListModel rewardsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList rewardsList;
|
||||
@@ -105,7 +105,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private JRadioButton rewardConditionTimed;
|
||||
private JRadioButton rewardConditionForever;
|
||||
private JRadioButton rewardConditionClear;
|
||||
|
||||
|
||||
private RepliesListModel repliesListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList repliesList;
|
||||
@@ -115,7 +115,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private MyComboBox replyNextPhrase;
|
||||
private String replyTextCache = null;
|
||||
private JTextField replyText;
|
||||
|
||||
|
||||
private ReplyRequirementsListModel requirementsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList requirementsList;
|
||||
@@ -128,32 +128,32 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private JComponent requirementObjId;
|
||||
private JComponent requirementValue;
|
||||
private BooleanBasedCheckBox requirementNegated;
|
||||
|
||||
|
||||
private DialogueGraphView dialogueGraphView;
|
||||
|
||||
|
||||
|
||||
|
||||
public DialogueEditor(Dialogue dialogue) {
|
||||
super(dialogue, dialogue.getDesc(), dialogue.getIcon());
|
||||
addEditorTab(form_view_id, getFormView());
|
||||
addEditorTab(json_view_id, getJSONView());
|
||||
addEditorTab(graph_view_id, createDialogueGraphView(dialogue));
|
||||
}
|
||||
|
||||
|
||||
public JPanel createDialogueGraphView(final Dialogue dialogue) {
|
||||
final JPanel pane = new JPanel();
|
||||
pane.setLayout(new BorderLayout());
|
||||
|
||||
|
||||
dialogueGraphView = new DialogueGraphView(dialogue, null);
|
||||
pane.add(dialogueGraphView, BorderLayout.CENTER);
|
||||
|
||||
|
||||
JPanel buttonPane = new JPanel();
|
||||
buttonPane.setLayout(new JideBoxLayout(buttonPane, JideBoxLayout.LINE_AXIS));
|
||||
JButton reloadButton = new JButton("Refresh graph");
|
||||
buttonPane.add(reloadButton, JideBoxLayout.FIX);
|
||||
buttonPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
pane.add(buttonPane, BorderLayout.NORTH);
|
||||
|
||||
|
||||
|
||||
|
||||
reloadButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -164,22 +164,22 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return pane;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void insertFormViewDataField(final JPanel pane) {
|
||||
|
||||
|
||||
final Dialogue dialogue = (Dialogue) target;
|
||||
final FieldUpdateListener listener = new DialogueFieldUpdater();
|
||||
|
||||
|
||||
createButtonPane(pane, dialogue.getProject(), dialogue, Dialogue.class, dialogue.getImage(), null, listener);
|
||||
|
||||
|
||||
idField = addTextField(pane, "Internal ID: ", dialogue.id, dialogue.writable, listener);
|
||||
messageField = addTranslatableTextArea(pane, "Message: ", dialogue.message, dialogue.writable, listener);
|
||||
switchToNpcBox = addNPCBox(pane, dialogue.getProject(), "Switch active NPC to: ", dialogue.switch_to_npc, dialogue.writable, listener);
|
||||
|
||||
|
||||
CollapsiblePanel rewards = new CollapsiblePanel("Reaching this phrase gives the following rewards: ");
|
||||
rewards.setLayout(new JideBoxLayout(rewards, JideBoxLayout.PAGE_AXIS));
|
||||
rewardsListModel = new RewardsListModel(dialogue);
|
||||
@@ -226,7 +226,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createReward, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteReward, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -269,7 +269,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
|
||||
pane.add(replies, JideBoxLayout.FIX);
|
||||
}
|
||||
|
||||
|
||||
public void updateRewardsEditorPane(final JPanel pane, final Dialogue.Reward reward, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (rewardMap != null) {
|
||||
@@ -278,7 +278,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
if (rewardObj != null) {
|
||||
removeElementListener(rewardObj);
|
||||
}
|
||||
|
||||
|
||||
if (reward != null) {
|
||||
rewardTypeCombo = addEnumValueBox(pane, "Reward type: ", Dialogue.Reward.RewardType.values(), reward.type, ((Dialogue)target).writable, listener);
|
||||
rewardsParamsPane = new JPanel();
|
||||
@@ -289,7 +289,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
public void updateRewardsParamsEditorPane(final JPanel pane, final Dialogue.Reward reward, final FieldUpdateListener listener) {
|
||||
boolean writable = ((Dialogue)target).writable;
|
||||
pane.removeAll();
|
||||
@@ -336,7 +336,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
case actorConditionImmunity:
|
||||
immunity = true;
|
||||
case actorCondition:
|
||||
|
||||
|
||||
rewardMap = null;
|
||||
rewardObjId = null;
|
||||
rewardObjIdCombo = null;
|
||||
@@ -350,12 +350,12 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
rewardConditionClear = new JRadioButton("Clear actor condition");
|
||||
pane.add(rewardConditionClear, JideBoxLayout.FIX);
|
||||
}
|
||||
|
||||
|
||||
ButtonGroup radioGroup = new ButtonGroup();
|
||||
radioGroup.add(rewardConditionTimed);
|
||||
radioGroup.add(rewardConditionForever);
|
||||
if (!immunity) radioGroup.add(rewardConditionClear);
|
||||
|
||||
|
||||
if (immunity) {
|
||||
rewardConditionTimed.setSelected(reward.reward_value == null || (reward.reward_value != ActorCondition.DURATION_FOREVER && reward.reward_value != ActorCondition.MAGNITUDE_CLEAR));
|
||||
rewardConditionForever.setSelected(reward.reward_value != null && reward.reward_value != ActorCondition.DURATION_FOREVER);
|
||||
@@ -365,7 +365,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
rewardConditionForever.setSelected(reward.reward_value == null || reward.reward_value == ActorCondition.DURATION_FOREVER);
|
||||
}
|
||||
rewardValue.setEnabled(rewardConditionTimed.isSelected());
|
||||
|
||||
|
||||
rewardConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -440,7 +440,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void updateRepliesEditorPane(final JPanel pane, final Dialogue.Reply reply, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
@@ -451,12 +451,12 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
removeElementListener(requirementObj);
|
||||
}
|
||||
if (reply == null) return;
|
||||
|
||||
|
||||
JPanel comboPane = new JPanel();
|
||||
comboPane.setLayout(new BorderLayout());
|
||||
JLabel comboLabel = new JLabel("Reply type: ");
|
||||
comboPane.add(comboLabel, BorderLayout.WEST);
|
||||
|
||||
|
||||
replyTypeCombo = new JComboBox(replyTypes);
|
||||
replyTypeCombo.setEnabled(((Dialogue)target).writable);
|
||||
repliesParamsPane = new JPanel();
|
||||
@@ -518,7 +518,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
pane.add(comboPane, JideBoxLayout.FIX);
|
||||
updateRepliesParamsEditorPane(repliesParamsPane, reply, listener);
|
||||
pane.add(repliesParamsPane, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
CollapsiblePanel requirementsPane = new CollapsiblePanel("Requirements the player must fulfill to select this reply: ");
|
||||
requirementsPane.setLayout(new JideBoxLayout(requirementsPane, JideBoxLayout.PAGE_AXIS));
|
||||
requirementsListModel = new ReplyRequirementsListModel(reply);
|
||||
@@ -585,7 +585,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createReq, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteReq, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -597,11 +597,11 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
requirementsPane.collapse();
|
||||
}
|
||||
pane.add(requirementsPane, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
public void updateRepliesParamsEditorPane(final JPanel pane, final Dialogue.Reply reply, final FieldUpdateListener listener) {
|
||||
boolean writable = ((Dialogue)target).writable;
|
||||
pane.removeAll();
|
||||
@@ -612,7 +612,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
if (requirementObj != null) {
|
||||
removeElementListener(requirementObj);
|
||||
}
|
||||
|
||||
|
||||
if (Dialogue.Reply.GO_NEXT_TEXT.equals(reply.text)) {
|
||||
replyText = null;
|
||||
replyNextPhrase = addDialogueBox(pane, ((Dialogue)target).getProject(), "Next phrase: ", reply.next_phrase, writable, listener);
|
||||
@@ -623,7 +623,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
replyText = addTranslatableTextField(pane, "Reply text: ", reply.text, writable, listener);
|
||||
replyNextPhrase = addDialogueBox(pane, ((Dialogue)target).getProject(), "Next phrase: ", reply.next_phrase, writable, listener);
|
||||
}
|
||||
|
||||
|
||||
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
@@ -636,7 +636,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
if (requirementObj != null) {
|
||||
removeElementListener(requirementObj);
|
||||
}
|
||||
|
||||
|
||||
requirementTypeCombo = addEnumValueBox(pane, "Requirement type: ", Requirement.RequirementType.values(), requirement == null ? null : requirement.type, writable, listener);
|
||||
requirementParamsPane = new JPanel();
|
||||
requirementParamsPane.setLayout(new JideBoxLayout(requirementParamsPane, JideBoxLayout.PAGE_AXIS));
|
||||
@@ -645,7 +645,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
public void updateRequirementParamsEditorPane(final JPanel pane, final Requirement requirement, final FieldUpdateListener listener) {
|
||||
boolean writable = ((Dialogue)target).writable;
|
||||
Project project = ((Dialogue)target).getProject();
|
||||
@@ -653,7 +653,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
if (requirementObj != null) {
|
||||
removeElementListener(requirementObj);
|
||||
}
|
||||
|
||||
|
||||
if (requirement != null && requirement.type != null) {
|
||||
switch (requirement.type) {
|
||||
case consumedBonemeals:
|
||||
@@ -743,70 +743,25 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
public static class RewardsListModel implements ListModel<Dialogue.Reward> {
|
||||
|
||||
Dialogue source;
|
||||
|
||||
|
||||
|
||||
public static class RewardsListModel extends CommonEditor.AtListModel<Dialogue.Reward, Dialogue> {
|
||||
|
||||
public RewardsListModel(Dialogue dialogue) {
|
||||
this.source = dialogue;
|
||||
super(dialogue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if (source.rewards == null) return 0;
|
||||
return source.rewards.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialogue.Reward getElementAt(int index) {
|
||||
if (source.rewards == null) return null;
|
||||
return source.rewards.get(index);
|
||||
}
|
||||
|
||||
public void addItem(Dialogue.Reward item) {
|
||||
if (source.rewards == null) {
|
||||
source.rewards = new ArrayList<Dialogue.Reward>();
|
||||
}
|
||||
source.rewards.add(item);
|
||||
int index = source.rewards.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Dialogue.Reward item) {
|
||||
int index = source.rewards.indexOf(item);
|
||||
source.rewards.remove(item);
|
||||
if (source.rewards.isEmpty()) {
|
||||
source.rewards = null;
|
||||
}
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index));
|
||||
}
|
||||
protected List<Dialogue.Reward> getInner() {
|
||||
return source.rewards;
|
||||
}
|
||||
|
||||
public void itemChanged(Dialogue.Reward item) {
|
||||
int index = source.rewards.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
List<ListDataListener> listeners = new CopyOnWriteArrayList<ListDataListener>();
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
listeners.remove(l);
|
||||
protected void setInner(List<Dialogue.Reward> value) {
|
||||
source.rewards = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class RewardsCellRenderer extends DefaultListCellRenderer {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@@ -816,13 +771,13 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
Dialogue.Reward reward = (Dialogue.Reward)value;
|
||||
|
||||
|
||||
decorateRewardJLabel(label, reward);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void decorateRewardJLabel(JLabel label, Dialogue.Reward reward) {
|
||||
if (reward.type != null) {
|
||||
String rewardObjDesc = null;
|
||||
@@ -912,8 +867,8 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
label.setText("New, undefined reward");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static class RepliesListModel extends CommonEditor.AtListModel<Dialogue.Reply, Dialogue> {
|
||||
public RepliesListModel(Dialogue dialogue) {
|
||||
super(dialogue);
|
||||
@@ -980,71 +935,23 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public static class ReplyRequirementsListModel implements ListModel<Requirement> {
|
||||
public static class ReplyRequirementsListModel extends CommonEditor.AtListModel<Requirement, Dialogue.Reply> {
|
||||
|
||||
Dialogue.Reply reply;
|
||||
|
||||
public ReplyRequirementsListModel(Dialogue.Reply reply) {
|
||||
this.reply = reply;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if (reply.requirements == null) return 0;
|
||||
return reply.requirements.size();
|
||||
super(reply);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Requirement getElementAt(int index) {
|
||||
if (reply.requirements == null) return null;
|
||||
return reply.requirements.get(index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void addItem(Requirement item) {
|
||||
if (reply.requirements == null) {
|
||||
reply.requirements = new ArrayList<Requirement>();
|
||||
}
|
||||
reply.requirements.add(item);
|
||||
int index = reply.requirements.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Requirement item) {
|
||||
int index = reply.requirements.indexOf(item);
|
||||
reply.requirements.remove(item);
|
||||
if (reply.requirements.isEmpty()) {
|
||||
reply.requirements = null;
|
||||
}
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index));
|
||||
}
|
||||
protected List<Requirement> getInner() {
|
||||
return source.requirements;
|
||||
}
|
||||
|
||||
public void itemChanged(Requirement item) {
|
||||
int index = reply.requirements.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
List<ListDataListener> listeners = new CopyOnWriteArrayList<ListDataListener>();
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
listeners.add(l);
|
||||
protected void setInner(List<Requirement> value) {
|
||||
source.requirements = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
listeners.remove(l);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class ReplyRequirementsCellRenderer extends DefaultListCellRenderer {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@@ -1057,7 +964,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void decorateRequirementJLabel(JLabel label, Requirement req) {
|
||||
label.setText(req.getDesc());
|
||||
if (req.required_obj != null) {
|
||||
@@ -1082,7 +989,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
label.setText("New, undefined requirement.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class DialogueFieldUpdater implements FieldUpdateListener {
|
||||
@Override
|
||||
public void valueChanged(JComponent source, Object value) {
|
||||
@@ -1094,7 +1001,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
return;
|
||||
}
|
||||
if (target.id.equals((String) value)) return;
|
||||
|
||||
|
||||
if (idChanging()) {
|
||||
dialogue.id = (String) value;
|
||||
DialogueEditor.this.name = dialogue.getDesc();
|
||||
@@ -1257,7 +1164,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
} else if (source == requirementNegated) {
|
||||
selectedRequirement.negated = (Boolean) value;
|
||||
}
|
||||
|
||||
|
||||
if (dialogue.state != GameDataElement.State.modified) {
|
||||
dialogue.state = GameDataElement.State.modified;
|
||||
DialogueEditor.this.name = dialogue.getDesc();
|
||||
@@ -1267,5 +1174,5 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
updateJsonViewText(dialogue.toJsonString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -41,27 +41,28 @@ import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
|
||||
import com.gpl.rpg.atcontentstudio.ui.FieldUpdateListener;
|
||||
import com.gpl.rpg.atcontentstudio.ui.IntegerBasedCheckBox;
|
||||
import com.gpl.rpg.atcontentstudio.ui.OverlayIcon;
|
||||
import com.gpl.rpg.atcontentstudio.ui.tools.CommonEditor;
|
||||
import com.jidesoft.swing.JideBoxLayout;
|
||||
|
||||
public class ItemEditor extends JSONElementEditor {
|
||||
|
||||
private static final long serialVersionUID = 7538154592029351986L;
|
||||
|
||||
|
||||
private static final String form_view_id = "Form";
|
||||
private static final String json_view_id = "JSON";
|
||||
|
||||
|
||||
private static final String killLabel = "Effect on every kill: ";
|
||||
private static final String useLabel = "Effect on use: ";
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
private JTextField idField;
|
||||
private JTextField nameField;
|
||||
@@ -72,7 +73,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JSpinner baseCostField;
|
||||
private MyComboBox categoryBox;
|
||||
private Integer baseManualPrice = null;
|
||||
|
||||
|
||||
private CollapsiblePanel equipEffectPane;
|
||||
private Item.EquipEffect equipEffect;
|
||||
private JSpinner equipDmgMin;
|
||||
@@ -127,7 +128,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JRadioButton hitTargetConditionTimed;
|
||||
private JRadioButton hitTargetConditionForever;
|
||||
private JSpinner hitTargetConditionDuration;
|
||||
|
||||
|
||||
private CollapsiblePanel killEffectPane;
|
||||
private Common.DeathEffect killEffect;
|
||||
private JSpinner killHPMin;
|
||||
@@ -146,7 +147,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JRadioButton killSourceConditionTimed;
|
||||
private JRadioButton killSourceConditionForever;
|
||||
private JSpinner killSourceConditionDuration;
|
||||
|
||||
|
||||
private CollapsiblePanel hitReceivedEffectPane;
|
||||
private Common.HitReceivedEffect hitReceivedEffect;
|
||||
private JSpinner hitReceivedHPMin;
|
||||
@@ -181,23 +182,23 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JRadioButton hitReceivedTargetConditionTimed;
|
||||
private JRadioButton hitReceivedTargetConditionForever;
|
||||
private JSpinner hitReceivedTargetConditionDuration;
|
||||
|
||||
|
||||
public ItemEditor(Item item) {
|
||||
super(item, item.getDesc(), item.getIcon());
|
||||
addEditorTab(form_view_id, getFormView());
|
||||
addEditorTab(json_view_id, getJSONView());
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void insertFormViewDataField(JPanel pane) {
|
||||
|
||||
final Item item = (Item) target;
|
||||
|
||||
|
||||
final FieldUpdateListener listener = new ItemFieldUpdater();
|
||||
|
||||
|
||||
itemIcon = createButtonPane(pane, item.getProject(), item, Item.class, item.getImage(), Spritesheet.Category.item, listener);
|
||||
|
||||
|
||||
idField = addTextField(pane, "Internal ID: ", item.id, item.writable, listener);
|
||||
nameField = addTranslatableTextField(pane, "Display name: ", item.name, item.writable, listener);
|
||||
descriptionField = addTranslatableTextField(pane, "Description: ", item.description, item.writable, listener);
|
||||
@@ -209,7 +210,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
baseCostField.setEnabled(false);
|
||||
}
|
||||
categoryBox = addItemCategoryBox(pane, item.getProject(), "Category: ", item.category, item.writable, listener);
|
||||
|
||||
|
||||
equipEffectPane = new CollapsiblePanel("Effect when equipped: ");
|
||||
equipEffectPane.setLayout(new JideBoxLayout(equipEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (item.equip_effect == null) {
|
||||
@@ -276,7 +277,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createEquipCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteEquipCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -292,7 +293,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
if (item.equip_effect == null) {
|
||||
equipEffectPane.collapse();
|
||||
}
|
||||
|
||||
|
||||
hitEffectPane = new CollapsiblePanel("Effect on every hit: ");
|
||||
hitEffectPane.setLayout(new JideBoxLayout(hitEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (item.hit_effect == null) {
|
||||
@@ -349,7 +350,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createHitSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteHitSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -406,7 +407,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createHitTargetCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteHitTargetCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -422,9 +423,9 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitEffectPane.collapse();
|
||||
}
|
||||
pane.add(hitEffectPane, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
killEffectPane = new CollapsiblePanel(killLabel);
|
||||
killEffectPane.setLayout(new JideBoxLayout(killEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (item.kill_effect == null) {
|
||||
@@ -481,7 +482,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createKillSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteKillSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -497,8 +498,8 @@ public class ItemEditor extends JSONElementEditor {
|
||||
killEffectPane.collapse();
|
||||
}
|
||||
pane.add(killEffectPane, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
|
||||
|
||||
hitReceivedEffectPane = new CollapsiblePanel("Effect on every hit received: ");
|
||||
hitReceivedEffectPane.setLayout(new JideBoxLayout(hitReceivedEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (item.hit_received_effect == null) {
|
||||
@@ -559,7 +560,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createHitReceivedSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteHitReceivedSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -616,7 +617,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createHitReceivedTargetCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteHitReceivedTargetCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -632,8 +633,8 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitReceivedEffectPane.collapse();
|
||||
}
|
||||
pane.add(hitReceivedEffectPane, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
|
||||
|
||||
if (item.category == null || item.category.action_type == null || item.category.action_type == ItemCategory.ActionType.none) {
|
||||
equipEffectPane.setVisible(false);
|
||||
hitEffectPane.setVisible(false);
|
||||
@@ -653,9 +654,9 @@ public class ItemEditor extends JSONElementEditor {
|
||||
killEffectPane.revalidate();
|
||||
killEffectPane.repaint();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void updateHitSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitSourceConditionBox != null) {
|
||||
@@ -666,13 +667,13 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((Item)target).writable;
|
||||
Project proj = ((Item)target).getProject();
|
||||
|
||||
|
||||
hitSourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
|
||||
hitSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
|
||||
|
||||
|
||||
hitSourceConditionClear = new JRadioButton("Clear active condition");
|
||||
pane.add(hitSourceConditionClear, JideBoxLayout.FIX);
|
||||
hitSourceConditionApply = new JRadioButton("Apply condition with magnitude");
|
||||
@@ -680,24 +681,24 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
hitSourceConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(hitSourceConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(hitSourceConditionApply);
|
||||
radioEffectGroup.add(hitSourceConditionClear);
|
||||
radioEffectGroup.add(hitSourceConditionImmunity);
|
||||
|
||||
|
||||
hitSourceConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitSourceConditionTimed, JideBoxLayout.FIX);
|
||||
hitSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitSourceConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitSourceConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(hitSourceConditionTimed);
|
||||
radioDurationGroup.add(hitSourceConditionForever);
|
||||
|
||||
|
||||
updateHitSourceTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
hitSourceConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -716,7 +717,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitSourceConditionImmunity, new Boolean(hitSourceConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
hitSourceConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -729,22 +730,22 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitSourceConditionForever, new Boolean(hitSourceConditionForever.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
hitSourceConditionClear.setSelected(clear);
|
||||
hitSourceConditionApply.setSelected(!clear && !immunity);
|
||||
hitSourceConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
hitSourceConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
hitSourceConditionTimed.setSelected(!forever);
|
||||
hitSourceConditionTimed.setEnabled(!clear);
|
||||
hitSourceConditionDuration.setEnabled(!clear && !forever);
|
||||
@@ -762,7 +763,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((Item)target).writable;
|
||||
Project proj = ((Item)target).getProject();
|
||||
|
||||
@@ -776,24 +777,24 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
hitTargetConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(hitTargetConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(hitTargetConditionApply);
|
||||
radioEffectGroup.add(hitTargetConditionClear);
|
||||
radioEffectGroup.add(hitTargetConditionImmunity);
|
||||
|
||||
|
||||
hitTargetConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitTargetConditionTimed, JideBoxLayout.FIX);
|
||||
hitTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitTargetConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitTargetConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(hitTargetConditionTimed);
|
||||
radioDurationGroup.add(hitTargetConditionForever);
|
||||
|
||||
|
||||
updateHitTargetTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
hitTargetConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -812,7 +813,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitTargetConditionImmunity, new Boolean(hitTargetConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
hitTargetConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -825,7 +826,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitTargetConditionForever, new Boolean(hitTargetConditionForever.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
@@ -835,19 +836,19 @@ public class ItemEditor extends JSONElementEditor {
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
hitTargetConditionClear.setSelected(clear);
|
||||
hitTargetConditionApply.setSelected(!clear && !immunity);
|
||||
hitTargetConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
hitTargetConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
hitTargetConditionTimed.setSelected(!forever);
|
||||
hitTargetConditionTimed.setEnabled(!clear);
|
||||
hitTargetConditionDuration.setEnabled(!clear && !forever);
|
||||
hitTargetConditionForever.setSelected(forever);
|
||||
hitTargetConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
|
||||
public void updateKillSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (killSourceConditionBox != null) {
|
||||
@@ -858,7 +859,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((Item)target).writable;
|
||||
Project proj = ((Item)target).getProject();
|
||||
|
||||
@@ -872,24 +873,24 @@ public class ItemEditor extends JSONElementEditor {
|
||||
killSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
killSourceConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(killSourceConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(killSourceConditionApply);
|
||||
radioEffectGroup.add(killSourceConditionClear);
|
||||
radioEffectGroup.add(killSourceConditionImmunity);
|
||||
|
||||
|
||||
killSourceConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(killSourceConditionTimed, JideBoxLayout.FIX);
|
||||
killSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
killSourceConditionForever = new JRadioButton("Forever");
|
||||
pane.add(killSourceConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(killSourceConditionTimed);
|
||||
radioDurationGroup.add(killSourceConditionForever);
|
||||
|
||||
|
||||
updateKillSourceTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
killSourceConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -908,7 +909,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(killSourceConditionImmunity, new Boolean(killSourceConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
killSourceConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -921,7 +922,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(killSourceConditionForever, new Boolean(killSourceConditionForever.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
@@ -931,19 +932,19 @@ public class ItemEditor extends JSONElementEditor {
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
killSourceConditionClear.setSelected(clear);
|
||||
killSourceConditionApply.setSelected(!clear && !immunity);
|
||||
killSourceConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
killSourceConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
killSourceConditionTimed.setSelected(!forever);
|
||||
killSourceConditionTimed.setEnabled(!clear);
|
||||
killSourceConditionDuration.setEnabled(!clear && !forever);
|
||||
killSourceConditionForever.setSelected(forever);
|
||||
killSourceConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
|
||||
public void updateEquipConditionEditorPane(JPanel pane, Common.ConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (equipConditionBox != null) {
|
||||
@@ -954,26 +955,26 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((Item)target).writable;
|
||||
Project proj = ((Item)target).getProject();
|
||||
|
||||
|
||||
equipConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
|
||||
equipConditionWithMagnitude = new JRadioButton("Apply condition with magnitude.");
|
||||
pane.add(equipConditionWithMagnitude, JideBoxLayout.FIX);
|
||||
equipConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, 1, false, writable, listener);
|
||||
equipConditionImmunity = new JRadioButton("Give immunity to condition.");
|
||||
pane.add(equipConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(equipConditionWithMagnitude);
|
||||
radioEffectGroup.add(equipConditionImmunity);
|
||||
|
||||
|
||||
boolean immunity = condition.magnitude == null || condition.magnitude == ActorCondition.MAGNITUDE_CLEAR;
|
||||
equipConditionImmunity.setSelected(immunity);
|
||||
equipConditionWithMagnitude.setSelected(!immunity);
|
||||
equipConditionMagnitude.setEnabled(!immunity);
|
||||
|
||||
|
||||
equipConditionWithMagnitude.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -986,12 +987,12 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(equipConditionImmunity, new Boolean(equipConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
public void updateHitReceivedSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitReceivedSourceConditionBox != null) {
|
||||
@@ -1002,13 +1003,13 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((Item)target).writable;
|
||||
Project proj = ((Item)target).getProject();
|
||||
|
||||
|
||||
hitReceivedSourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
|
||||
hitReceivedSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
|
||||
|
||||
|
||||
hitReceivedSourceConditionClear = new JRadioButton("Clear active condition");
|
||||
pane.add(hitReceivedSourceConditionClear, JideBoxLayout.FIX);
|
||||
hitReceivedSourceConditionApply = new JRadioButton("Apply condition with magnitude");
|
||||
@@ -1016,24 +1017,24 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitReceivedSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
hitReceivedSourceConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(hitReceivedSourceConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(hitReceivedSourceConditionApply);
|
||||
radioEffectGroup.add(hitReceivedSourceConditionClear);
|
||||
radioEffectGroup.add(hitReceivedSourceConditionImmunity);
|
||||
|
||||
|
||||
hitReceivedSourceConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitReceivedSourceConditionTimed, JideBoxLayout.FIX);
|
||||
hitReceivedSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitReceivedSourceConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitReceivedSourceConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(hitReceivedSourceConditionTimed);
|
||||
radioDurationGroup.add(hitReceivedSourceConditionForever);
|
||||
|
||||
|
||||
updateHitReceivedSourceTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
hitReceivedSourceConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -1052,7 +1053,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitReceivedSourceConditionImmunity, new Boolean(hitReceivedSourceConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
hitReceivedSourceConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -1065,22 +1066,22 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitReceivedSourceConditionForever, new Boolean(hitReceivedSourceConditionForever.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
hitReceivedSourceConditionClear.setSelected(clear);
|
||||
hitReceivedSourceConditionApply.setSelected(!clear && !immunity);
|
||||
hitReceivedSourceConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
hitReceivedSourceConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
hitReceivedSourceConditionTimed.setSelected(!forever);
|
||||
hitReceivedSourceConditionTimed.setEnabled(!clear);
|
||||
hitReceivedSourceConditionDuration.setEnabled(!clear && !forever);
|
||||
@@ -1098,7 +1099,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((Item)target).writable;
|
||||
Project proj = ((Item)target).getProject();
|
||||
|
||||
@@ -1112,24 +1113,24 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitReceivedTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
hitReceivedTargetConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(hitReceivedTargetConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(hitReceivedTargetConditionApply);
|
||||
radioEffectGroup.add(hitReceivedTargetConditionClear);
|
||||
radioEffectGroup.add(hitReceivedTargetConditionImmunity);
|
||||
|
||||
|
||||
hitReceivedTargetConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitReceivedTargetConditionTimed, JideBoxLayout.FIX);
|
||||
hitReceivedTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitReceivedTargetConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitReceivedTargetConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(hitReceivedTargetConditionTimed);
|
||||
radioDurationGroup.add(hitReceivedTargetConditionForever);
|
||||
|
||||
|
||||
updateHitReceivedTargetTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
hitReceivedTargetConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -1148,7 +1149,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitReceivedTargetConditionImmunity, new Boolean(hitReceivedTargetConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
hitReceivedTargetConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -1161,7 +1162,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitReceivedTargetConditionForever, new Boolean(hitReceivedTargetConditionForever.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
@@ -1171,12 +1172,12 @@ public class ItemEditor extends JSONElementEditor {
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
hitReceivedTargetConditionClear.setSelected(clear);
|
||||
hitReceivedTargetConditionApply.setSelected(!clear && !immunity);
|
||||
hitReceivedTargetConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
hitReceivedTargetConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
hitReceivedTargetConditionTimed.setSelected(!forever);
|
||||
hitReceivedTargetConditionTimed.setEnabled(!clear);
|
||||
hitReceivedTargetConditionDuration.setEnabled(!clear && !forever);
|
||||
@@ -1184,131 +1185,41 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitReceivedTargetConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
|
||||
public static class SourceTimedConditionsListModel implements ListModel<Common.TimedConditionEffect> {
|
||||
|
||||
Common.DeathEffect source;
|
||||
|
||||
|
||||
public static class SourceTimedConditionsListModel extends CommonEditor.AtListModel<Common.TimedConditionEffect, Common.DeathEffect> {
|
||||
|
||||
public SourceTimedConditionsListModel(Common.DeathEffect effect) {
|
||||
this.source = effect;;
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if (source.conditions_source == null) return 0;
|
||||
return source.conditions_source.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Common.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_source == null) return null;
|
||||
return source.conditions_source.get(index);
|
||||
}
|
||||
|
||||
public void addItem(Common.TimedConditionEffect item) {
|
||||
if (source.conditions_source == null) {
|
||||
source.conditions_source = new ArrayList<Common.TimedConditionEffect>();
|
||||
}
|
||||
source.conditions_source.add(item);
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
source.conditions_source.remove(item);
|
||||
if (source.conditions_source.isEmpty()) {
|
||||
source.conditions_source = null;
|
||||
}
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index));
|
||||
}
|
||||
protected List<Common.TimedConditionEffect> getInner() {
|
||||
return source.conditions_source;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
List<ListDataListener> listeners = new CopyOnWriteArrayList<ListDataListener>();
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
listeners.remove(l);
|
||||
protected void setInner(List<Common.TimedConditionEffect> value) {
|
||||
source.conditions_source = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TargetTimedConditionsListModel implements ListModel<Common.TimedConditionEffect> {
|
||||
|
||||
Common.HitEffect source;
|
||||
|
||||
|
||||
public static class TargetTimedConditionsListModel extends CommonEditor.AtListModel<Common.TimedConditionEffect, Common.HitEffect> {
|
||||
|
||||
public TargetTimedConditionsListModel(Common.HitEffect effect) {
|
||||
this.source = effect;;
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if (source.conditions_target == null) return 0;
|
||||
return source.conditions_target.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Common.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_target == null) return null;
|
||||
return source.conditions_target.get(index);
|
||||
}
|
||||
|
||||
public void addItem(Common.TimedConditionEffect item) {
|
||||
if (source.conditions_target == null) {
|
||||
source.conditions_target = new ArrayList<Common.TimedConditionEffect>();
|
||||
}
|
||||
source.conditions_target.add(item);
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
source.conditions_target.remove(item);
|
||||
if (source.conditions_target.isEmpty()) {
|
||||
source.conditions_target = null;
|
||||
}
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index));
|
||||
}
|
||||
protected List<Common.TimedConditionEffect> getInner() {
|
||||
return source.conditions_target;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
List<ListDataListener> listeners = new CopyOnWriteArrayList<ListDataListener>();
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
listeners.remove(l);
|
||||
protected void setInner(List<Common.TimedConditionEffect> value) {
|
||||
source.conditions_target = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class TimedConditionsCellRenderer extends DefaultListCellRenderer {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@@ -1318,13 +1229,13 @@ public class ItemEditor extends JSONElementEditor {
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
Common.TimedConditionEffect effect = (Common.TimedConditionEffect) value;
|
||||
|
||||
|
||||
if (effect.condition != null) {
|
||||
|
||||
|
||||
boolean immunity = (effect.magnitude == null || effect.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (effect.duration != null && effect.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (effect.magnitude == null || effect.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (effect.duration == null || effect.duration == ActorCondition.DURATION_NONE);
|
||||
boolean forever = effect.duration != null && effect.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
if (clear) {
|
||||
label.setIcon(new ImageIcon(effect.condition.getIcon()));
|
||||
label.setText(effect.chance+"% chances to clear actor condition "+effect.condition.getDesc());
|
||||
@@ -1342,69 +1253,24 @@ public class ItemEditor extends JSONElementEditor {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ConditionsListModel implements ListModel<Common.ConditionEffect> {
|
||||
|
||||
Item.EquipEffect source;
|
||||
|
||||
|
||||
public static class ConditionsListModel extends CommonEditor.AtListModel<Common.ConditionEffect, Item.EquipEffect> {
|
||||
|
||||
public ConditionsListModel(Item.EquipEffect equipEffect) {
|
||||
this.source = equipEffect;
|
||||
super(equipEffect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if (source.conditions == null) return 0;
|
||||
return source.conditions.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Common.ConditionEffect getElementAt(int index) {
|
||||
if (source.conditions == null) return null;
|
||||
return source.conditions.get(index);
|
||||
}
|
||||
|
||||
public void addItem(Common.ConditionEffect item) {
|
||||
if (source.conditions == null) {
|
||||
source.conditions = new ArrayList<Common.ConditionEffect>();
|
||||
}
|
||||
source.conditions.add(item);
|
||||
int index = source.conditions.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Common.ConditionEffect item) {
|
||||
int index = source.conditions.indexOf(item);
|
||||
source.conditions.remove(item);
|
||||
if (source.conditions.isEmpty()) {
|
||||
source.conditions = null;
|
||||
}
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index));
|
||||
}
|
||||
protected List<Common.ConditionEffect> getInner() {
|
||||
return source.conditions;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
List<ListDataListener> listeners = new CopyOnWriteArrayList<ListDataListener>();
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
listeners.remove(l);
|
||||
protected void setInner(List<Common.ConditionEffect> value) {
|
||||
source.conditions = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class ConditionsCellRenderer extends DefaultListCellRenderer {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@@ -1414,7 +1280,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
Common.ConditionEffect effect = (Common.ConditionEffect) value;
|
||||
|
||||
|
||||
if (effect.condition != null) {
|
||||
if (effect.magnitude == ActorCondition.MAGNITUDE_CLEAR) {
|
||||
label.setIcon(new OverlayIcon(effect.condition.getIcon(), DefaultIcons.getImmunityIcon()));
|
||||
@@ -1430,7 +1296,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isNull(Item.EquipEffect effect) {
|
||||
if (effect.conditions != null) return false;
|
||||
if (effect.critical_multiplier != null) return false;
|
||||
@@ -1449,8 +1315,8 @@ public class ItemEditor extends JSONElementEditor {
|
||||
if (effect.max_hp_boost != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static boolean isNull(Common.HitEffect effect) {
|
||||
if (effect.ap_boost_min != null) return false;
|
||||
if (effect.ap_boost_max != null) return false;
|
||||
@@ -1460,7 +1326,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
if (effect.conditions_target != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static boolean isNull(Common.DeathEffect effect) {
|
||||
if (effect.ap_boost_min != null) return false;
|
||||
@@ -1470,7 +1336,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
if (effect.conditions_source != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isNull(Common.HitReceivedEffect effect) {
|
||||
if (effect.ap_boost_min != null) return false;
|
||||
if (effect.ap_boost_max != null) return false;
|
||||
@@ -1484,8 +1350,8 @@ public class ItemEditor extends JSONElementEditor {
|
||||
if (effect.conditions_target != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public class ItemFieldUpdater implements FieldUpdateListener {
|
||||
|
||||
@Override
|
||||
@@ -1500,7 +1366,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
return;
|
||||
}
|
||||
if (target.id.equals((String) value)) return;
|
||||
|
||||
|
||||
if (idChanging()) {
|
||||
item.id = (String) value;
|
||||
ItemEditor.this.name = item.getDesc();
|
||||
@@ -2057,7 +1923,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
hitReceivedTargetConditionsModel.itemChanged(selectedHitReceivedEffectTargetCondition);
|
||||
updateHitReceived = true;
|
||||
}
|
||||
|
||||
|
||||
if (updateEquip) {
|
||||
if (isNull(equipEffect)) {
|
||||
item.equip_effect = null;
|
||||
@@ -2090,7 +1956,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
baseCostField.setValue(item.computePrice());
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (item.state != GameDataElement.State.modified) {
|
||||
item.state = GameDataElement.State.modified;
|
||||
ItemEditor.this.name = item.getDesc();
|
||||
@@ -2098,9 +1964,9 @@ public class ItemEditor extends JSONElementEditor {
|
||||
ATContentStudio.frame.editorChanged(ItemEditor.this);
|
||||
}
|
||||
updateJsonViewText(item.toJsonString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,12 +40,13 @@ import com.gpl.rpg.atcontentstudio.ui.FieldUpdateListener;
|
||||
import com.gpl.rpg.atcontentstudio.ui.IntegerBasedCheckBox;
|
||||
import com.gpl.rpg.atcontentstudio.ui.OverlayIcon;
|
||||
import com.gpl.rpg.atcontentstudio.ui.gamedataeditors.dialoguetree.DialogueGraphView;
|
||||
import com.gpl.rpg.atcontentstudio.ui.tools.CommonEditor;
|
||||
import com.jidesoft.swing.JideBoxLayout;
|
||||
|
||||
public class NPCEditor extends JSONElementEditor {
|
||||
|
||||
private static final long serialVersionUID = 4001483665523721800L;
|
||||
|
||||
|
||||
private static final String form_view_id = "Form";
|
||||
private static final String json_view_id = "JSON";
|
||||
private static final String dialogue_tree_id = "Dialogue Tree";
|
||||
@@ -55,7 +56,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private Common.TimedConditionEffect selectedHitReceivedEffectSourceCondition;
|
||||
private Common.TimedConditionEffect selectedHitReceivedEffectTargetCondition;
|
||||
private Common.TimedConditionEffect selectedDeathEffectSourceCondition;
|
||||
|
||||
|
||||
private JButton npcIcon;
|
||||
private JTextField idField;
|
||||
private JTextField nameField;
|
||||
@@ -69,7 +70,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private IntegerBasedCheckBox uniqueBox;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox moveTypeBox;
|
||||
|
||||
|
||||
private CollapsiblePanel combatTraitPane;
|
||||
private JSpinner maxHP;
|
||||
private JSpinner maxAP;
|
||||
@@ -89,7 +90,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JSpinner hitEffectHPMax;
|
||||
private JSpinner hitEffectAPMin;
|
||||
private JSpinner hitEffectAPMax;
|
||||
|
||||
|
||||
private SourceTimedConditionsListModel hitSourceConditionsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList hitSourceConditionsList;
|
||||
@@ -102,7 +103,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JRadioButton hitSourceConditionTimed;
|
||||
private JRadioButton hitSourceConditionForever;
|
||||
private JSpinner hitSourceConditionDuration;
|
||||
|
||||
|
||||
private TargetTimedConditionsListModel hitTargetConditionsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList hitTargetConditionsList;
|
||||
@@ -126,7 +127,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JSpinner hitReceivedEffectHPMaxTarget;
|
||||
private JSpinner hitReceivedEffectAPMinTarget;
|
||||
private JSpinner hitReceivedEffectAPMaxTarget;
|
||||
|
||||
|
||||
private SourceTimedConditionsListModel hitReceivedSourceConditionsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList hitReceivedSourceConditionsList;
|
||||
@@ -139,7 +140,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JRadioButton hitReceivedSourceConditionTimed;
|
||||
private JRadioButton hitReceivedSourceConditionForever;
|
||||
private JSpinner hitReceivedSourceConditionDuration;
|
||||
|
||||
|
||||
private TargetTimedConditionsListModel hitReceivedTargetConditionsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList hitReceivedTargetConditionsList;
|
||||
@@ -152,14 +153,14 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JRadioButton hitReceivedTargetConditionTimed;
|
||||
private JRadioButton hitReceivedTargetConditionForever;
|
||||
private JSpinner hitReceivedTargetConditionDuration;
|
||||
|
||||
|
||||
private Common.DeathEffect deathEffect;
|
||||
private CollapsiblePanel deathEffectPane;
|
||||
private JSpinner deathEffectHPMin;
|
||||
private JSpinner deathEffectHPMax;
|
||||
private JSpinner deathEffectAPMin;
|
||||
private JSpinner deathEffectAPMax;
|
||||
|
||||
|
||||
private SourceTimedConditionsListModel deathSourceConditionsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList deathSourceConditionsList;
|
||||
@@ -172,10 +173,10 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JRadioButton deathSourceConditionTimed;
|
||||
private JRadioButton deathSourceConditionForever;
|
||||
private JSpinner deathSourceConditionDuration;
|
||||
|
||||
|
||||
private JPanel dialogueGraphPane;
|
||||
private DialogueGraphView dialogueGraphView;
|
||||
|
||||
|
||||
public NPCEditor(NPC npc) {
|
||||
super(npc, npc.getDesc(), npc.getIcon());
|
||||
addEditorTab(form_view_id, getFormView());
|
||||
@@ -185,32 +186,32 @@ public class NPCEditor extends JSONElementEditor {
|
||||
addEditorTab(dialogue_tree_id, dialogueGraphPane);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public JPanel createDialogueGraphView(final NPC npc) {
|
||||
dialogueGraphPane = new JPanel();
|
||||
dialogueGraphPane.setLayout(new BorderLayout());
|
||||
|
||||
|
||||
dialogueGraphView = new DialogueGraphView(npc.dialogue, npc);
|
||||
dialogueGraphPane.add(dialogueGraphView, BorderLayout.CENTER);
|
||||
|
||||
|
||||
JPanel buttonPane = new JPanel();
|
||||
buttonPane.setLayout(new JideBoxLayout(buttonPane, JideBoxLayout.LINE_AXIS));
|
||||
JButton reloadButton = new JButton("Refresh graph");
|
||||
buttonPane.add(reloadButton, JideBoxLayout.FIX);
|
||||
buttonPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
dialogueGraphPane.add(buttonPane, BorderLayout.NORTH);
|
||||
|
||||
|
||||
|
||||
|
||||
reloadButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
reloadGraphView(npc);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return dialogueGraphPane;
|
||||
}
|
||||
|
||||
|
||||
public void reloadGraphView(NPC npc) {
|
||||
if (npc.dialogue != null) {
|
||||
if (dialogueGraphPane != null) {
|
||||
@@ -231,16 +232,16 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void insertFormViewDataField(JPanel pane) {
|
||||
final NPC npc = (NPC) target;
|
||||
|
||||
|
||||
final FieldUpdateListener listener = new NPCFieldUpdater();
|
||||
|
||||
|
||||
npcIcon = createButtonPane(pane, npc.getProject(), npc, NPC.class, npc.getImage(), Spritesheet.Category.monster, listener);
|
||||
|
||||
|
||||
idField = addTextField(pane, "Internal ID: ", npc.id, npc.writable, listener);
|
||||
nameField = addTranslatableTextField(pane, "Display name: ", npc.name, npc.writable, listener);
|
||||
spawnGroupField = addTextField(pane, "Spawn group ID: ", npc.spawngroup_id, npc.writable, listener);
|
||||
@@ -275,7 +276,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitEffectHPMax = addIntegerField(hitEffectPane, "HP bonus max: ", hitEffect.hp_boost_max, true, npc.writable, listener);
|
||||
hitEffectAPMin = addIntegerField(hitEffectPane, "AP bonus min: ", hitEffect.ap_boost_min, true, npc.writable, listener);
|
||||
hitEffectAPMax = addIntegerField(hitEffectPane, "AP bonus max: ", hitEffect.ap_boost_max, true, npc.writable, listener);
|
||||
|
||||
|
||||
CollapsiblePanel hitSourceConditionsPane = new CollapsiblePanel("Actor Conditions applied to the source: ");
|
||||
hitSourceConditionsPane.setLayout(new JideBoxLayout(hitSourceConditionsPane, JideBoxLayout.PAGE_AXIS));
|
||||
hitSourceConditionsListModel = new SourceTimedConditionsListModel(hitEffect);
|
||||
@@ -316,7 +317,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createHitSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteHitSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -368,7 +369,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createHitTargetCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteHitTargetCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -381,7 +382,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitTargetConditionsPane.collapse();
|
||||
}
|
||||
combatTraitPane.add(hitEffectPane, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
hitReceivedEffectPane = new CollapsiblePanel("Effect on every hit received: ");
|
||||
hitReceivedEffectPane.setLayout(new JideBoxLayout(hitReceivedEffectPane, JideBoxLayout.PAGE_AXIS));
|
||||
if (npc.hit_received_effect == null) {
|
||||
@@ -397,7 +398,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitReceivedEffectHPMaxTarget = addIntegerField(hitReceivedEffectPane, "Attacker HP bonus max: ", hitReceivedEffect.hp_boost_max_target, true, npc.writable, listener);
|
||||
hitReceivedEffectAPMinTarget = addIntegerField(hitReceivedEffectPane, "Attacker AP bonus min: ", hitReceivedEffect.ap_boost_min_target, true, npc.writable, listener);
|
||||
hitReceivedEffectAPMaxTarget = addIntegerField(hitReceivedEffectPane, "Attacker AP bonus max: ", hitReceivedEffect.ap_boost_max_target, true, npc.writable, listener);
|
||||
|
||||
|
||||
CollapsiblePanel hitReceivedSourceConditionsPane = new CollapsiblePanel("Actor Conditions applied to this NPC: ");
|
||||
hitReceivedSourceConditionsPane.setLayout(new JideBoxLayout(hitReceivedSourceConditionsPane, JideBoxLayout.PAGE_AXIS));
|
||||
hitReceivedSourceConditionsListModel = new SourceTimedConditionsListModel(hitReceivedEffect);
|
||||
@@ -438,7 +439,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createHitReceivedSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteHitReceivedSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -490,7 +491,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createHitReceivedTargetCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteHitReceivedTargetCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -515,7 +516,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
deathEffectHPMax = addIntegerField(deathEffectPane, "Killer HP bonus max: ", deathEffect.hp_boost_max, true, npc.writable, listener);
|
||||
deathEffectAPMin = addIntegerField(deathEffectPane, "Killer AP bonus min: ", deathEffect.ap_boost_min, true, npc.writable, listener);
|
||||
deathEffectAPMax = addIntegerField(deathEffectPane, "Killer AP bonus max: ", deathEffect.ap_boost_max, true, npc.writable, listener);
|
||||
|
||||
|
||||
CollapsiblePanel deathSourceConditionsPane = new CollapsiblePanel("Actor Conditions applied to the killer: ");
|
||||
deathSourceConditionsPane.setLayout(new JideBoxLayout(deathSourceConditionsPane, JideBoxLayout.PAGE_AXIS));
|
||||
deathSourceConditionsListModel = new SourceTimedConditionsListModel(deathEffect);
|
||||
@@ -556,7 +557,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
listButtonsPane.add(createDeathSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(deleteDeathSourceCondition, JideBoxLayout.FIX);
|
||||
listButtonsPane.add(new JPanel(), JideBoxLayout.VARY);
|
||||
@@ -569,23 +570,23 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
deathEffectPane.add(deathSourceConditionsPane, JideBoxLayout.FIX);
|
||||
combatTraitPane.add(deathEffectPane, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
|
||||
|
||||
pane.add(combatTraitPane, JideBoxLayout.FIX);
|
||||
}
|
||||
|
||||
|
||||
public void updateHitSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitSourceConditionBox != null) {
|
||||
removeElementListener(hitSourceConditionBox);
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((NPC)target).writable;
|
||||
Project proj = ((NPC)target).getProject();
|
||||
|
||||
|
||||
hitSourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
|
||||
hitSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
|
||||
|
||||
|
||||
hitSourceConditionClear = new JRadioButton("Clear active condition");
|
||||
pane.add(hitSourceConditionClear, JideBoxLayout.FIX);
|
||||
hitSourceConditionApply = new JRadioButton("Apply condition with magnitude");
|
||||
@@ -593,24 +594,24 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
hitSourceConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(hitSourceConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(hitSourceConditionApply);
|
||||
radioEffectGroup.add(hitSourceConditionClear);
|
||||
radioEffectGroup.add(hitSourceConditionImmunity);
|
||||
|
||||
|
||||
hitSourceConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitSourceConditionTimed, JideBoxLayout.FIX);
|
||||
hitSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitSourceConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitSourceConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(hitSourceConditionTimed);
|
||||
radioDurationGroup.add(hitSourceConditionForever);
|
||||
|
||||
|
||||
updateHitSourceTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
hitSourceConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -629,7 +630,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitSourceConditionImmunity, new Boolean(hitSourceConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
hitSourceConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -645,18 +646,18 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
hitSourceConditionClear.setSelected(clear);
|
||||
hitSourceConditionApply.setSelected(!clear && !immunity);
|
||||
hitSourceConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
hitSourceConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
hitSourceConditionTimed.setSelected(!forever);
|
||||
hitSourceConditionTimed.setEnabled(!clear);
|
||||
hitSourceConditionDuration.setEnabled(!clear && !forever);
|
||||
@@ -664,16 +665,16 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitSourceConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void updateHitTargetTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitTargetConditionBox != null) {
|
||||
removeElementListener(hitTargetConditionBox);
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((NPC)target).writable;
|
||||
Project proj = ((NPC)target).getProject();
|
||||
|
||||
|
||||
hitTargetConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
|
||||
hitTargetConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
|
||||
hitTargetConditionClear = new JRadioButton("Clear active condition");
|
||||
@@ -683,24 +684,24 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
hitTargetConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(hitTargetConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(hitTargetConditionApply);
|
||||
radioEffectGroup.add(hitTargetConditionClear);
|
||||
radioEffectGroup.add(hitTargetConditionImmunity);
|
||||
|
||||
|
||||
hitTargetConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitTargetConditionTimed, JideBoxLayout.FIX);
|
||||
hitTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitTargetConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitTargetConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(hitTargetConditionTimed);
|
||||
radioDurationGroup.add(hitTargetConditionForever);
|
||||
|
||||
|
||||
updateHitTargetTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
hitTargetConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -719,7 +720,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitTargetConditionImmunity, new Boolean(hitTargetConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
hitTargetConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -735,38 +736,38 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
hitTargetConditionClear.setSelected(clear);
|
||||
hitTargetConditionApply.setSelected(!clear && !immunity);
|
||||
hitTargetConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
hitTargetConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
hitTargetConditionTimed.setSelected(!forever);
|
||||
hitTargetConditionTimed.setEnabled(!clear);
|
||||
hitTargetConditionDuration.setEnabled(!clear && !forever);
|
||||
hitTargetConditionForever.setSelected(forever);
|
||||
hitTargetConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void updateHitReceivedSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitReceivedSourceConditionBox != null) {
|
||||
removeElementListener(hitReceivedSourceConditionBox);
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((NPC)target).writable;
|
||||
Project proj = ((NPC)target).getProject();
|
||||
|
||||
|
||||
hitReceivedSourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
|
||||
hitReceivedSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
|
||||
|
||||
|
||||
hitReceivedSourceConditionClear = new JRadioButton("Clear active condition");
|
||||
pane.add(hitReceivedSourceConditionClear, JideBoxLayout.FIX);
|
||||
hitReceivedSourceConditionApply = new JRadioButton("Apply condition with magnitude");
|
||||
@@ -774,24 +775,24 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitReceivedSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
hitReceivedSourceConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(hitReceivedSourceConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(hitReceivedSourceConditionApply);
|
||||
radioEffectGroup.add(hitReceivedSourceConditionClear);
|
||||
radioEffectGroup.add(hitReceivedSourceConditionImmunity);
|
||||
|
||||
|
||||
hitReceivedSourceConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitReceivedSourceConditionTimed, JideBoxLayout.FIX);
|
||||
hitReceivedSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitReceivedSourceConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitReceivedSourceConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(hitReceivedSourceConditionTimed);
|
||||
radioDurationGroup.add(hitReceivedSourceConditionForever);
|
||||
|
||||
|
||||
updateHitReceivedSourceTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
hitReceivedSourceConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -810,7 +811,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitReceivedSourceConditionImmunity, new Boolean(hitReceivedSourceConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
hitReceivedSourceConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -826,18 +827,18 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
hitReceivedSourceConditionClear.setSelected(clear);
|
||||
hitReceivedSourceConditionApply.setSelected(!clear && !immunity);
|
||||
hitReceivedSourceConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
hitReceivedSourceConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
hitReceivedSourceConditionTimed.setSelected(!forever);
|
||||
hitReceivedSourceConditionTimed.setEnabled(!clear);
|
||||
hitReceivedSourceConditionDuration.setEnabled(!clear && !forever);
|
||||
@@ -845,16 +846,16 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitReceivedSourceConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void updateHitReceivedTargetTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (hitReceivedTargetConditionBox != null) {
|
||||
removeElementListener(hitReceivedTargetConditionBox);
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((NPC)target).writable;
|
||||
Project proj = ((NPC)target).getProject();
|
||||
|
||||
|
||||
hitReceivedTargetConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
|
||||
hitReceivedTargetConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
|
||||
hitReceivedTargetConditionClear = new JRadioButton("Clear active condition");
|
||||
@@ -864,24 +865,24 @@ public class NPCEditor extends JSONElementEditor {
|
||||
hitReceivedTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
hitReceivedTargetConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(hitReceivedTargetConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(hitReceivedTargetConditionApply);
|
||||
radioEffectGroup.add(hitReceivedTargetConditionClear);
|
||||
radioEffectGroup.add(hitReceivedTargetConditionImmunity);
|
||||
|
||||
|
||||
hitReceivedTargetConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitReceivedTargetConditionTimed, JideBoxLayout.FIX);
|
||||
hitReceivedTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitReceivedTargetConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitReceivedTargetConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(hitReceivedTargetConditionTimed);
|
||||
radioDurationGroup.add(hitReceivedTargetConditionForever);
|
||||
|
||||
|
||||
updateHitReceivedTargetTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
hitReceivedTargetConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -900,7 +901,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
listener.valueChanged(hitReceivedTargetConditionImmunity, new Boolean(hitReceivedTargetConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
hitReceivedTargetConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -916,37 +917,37 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
hitReceivedTargetConditionClear.setSelected(clear);
|
||||
hitReceivedTargetConditionApply.setSelected(!clear && !immunity);
|
||||
hitReceivedTargetConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
hitReceivedTargetConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
hitReceivedTargetConditionTimed.setSelected(!forever);
|
||||
hitReceivedTargetConditionTimed.setEnabled(!clear);
|
||||
hitReceivedTargetConditionDuration.setEnabled(!clear && !forever);
|
||||
hitReceivedTargetConditionForever.setSelected(forever);
|
||||
hitReceivedTargetConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
|
||||
public void updateDeathSourceTimedConditionEditorPane(JPanel pane, Common.TimedConditionEffect condition, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (deathSourceConditionBox != null) {
|
||||
removeElementListener(deathSourceConditionBox);
|
||||
}
|
||||
|
||||
|
||||
boolean writable = ((NPC)target).writable;
|
||||
Project proj = ((NPC)target).getProject();
|
||||
|
||||
|
||||
deathSourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener);
|
||||
deathSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
|
||||
|
||||
|
||||
deathSourceConditionClear = new JRadioButton("Clear active condition");
|
||||
pane.add(deathSourceConditionClear, JideBoxLayout.FIX);
|
||||
deathSourceConditionApply = new JRadioButton("Apply condition with magnitude");
|
||||
@@ -954,24 +955,24 @@ public class NPCEditor extends JSONElementEditor {
|
||||
deathSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener);
|
||||
deathSourceConditionImmunity = new JRadioButton("Give immunity to condition");
|
||||
pane.add(deathSourceConditionImmunity, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioEffectGroup = new ButtonGroup();
|
||||
radioEffectGroup.add(deathSourceConditionApply);
|
||||
radioEffectGroup.add(deathSourceConditionClear);
|
||||
radioEffectGroup.add(deathSourceConditionImmunity);
|
||||
|
||||
|
||||
deathSourceConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(deathSourceConditionTimed, JideBoxLayout.FIX);
|
||||
deathSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
deathSourceConditionForever = new JRadioButton("Forever");
|
||||
pane.add(deathSourceConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
|
||||
ButtonGroup radioDurationGroup = new ButtonGroup();
|
||||
radioDurationGroup.add(deathSourceConditionTimed);
|
||||
radioDurationGroup.add(deathSourceConditionForever);
|
||||
|
||||
|
||||
updateDeathSourceTimedConditionWidgets(condition);
|
||||
|
||||
|
||||
deathSourceConditionClear.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -990,7 +991,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
listener.valueChanged(deathSourceConditionImmunity, new Boolean(deathSourceConditionImmunity.isSelected()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
deathSourceConditionTimed.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -1006,18 +1007,18 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.revalidate();
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
boolean forever = condition.duration != null && condition.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
deathSourceConditionClear.setSelected(clear);
|
||||
deathSourceConditionApply.setSelected(!clear && !immunity);
|
||||
deathSourceConditionMagnitude.setEnabled(!clear && !immunity);
|
||||
deathSourceConditionImmunity.setSelected(immunity);
|
||||
|
||||
|
||||
deathSourceConditionTimed.setSelected(!forever);
|
||||
deathSourceConditionTimed.setEnabled(!clear);
|
||||
deathSourceConditionDuration.setEnabled(!clear && !forever);
|
||||
@@ -1025,130 +1026,40 @@ public class NPCEditor extends JSONElementEditor {
|
||||
deathSourceConditionForever.setEnabled(!clear);
|
||||
}
|
||||
|
||||
public static class TargetTimedConditionsListModel implements ListModel<Common.TimedConditionEffect> {
|
||||
|
||||
Common.HitEffect source;
|
||||
|
||||
public static class TargetTimedConditionsListModel extends CommonEditor.AtListModel<Common.TimedConditionEffect, Common.HitEffect> {
|
||||
|
||||
public TargetTimedConditionsListModel(Common.HitEffect effect) {
|
||||
this.source = effect;
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if (source.conditions_target == null) return 0;
|
||||
return source.conditions_target.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Common.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_target == null) return null;
|
||||
return source.conditions_target.get(index);
|
||||
protected List<Common.TimedConditionEffect> getInner() {
|
||||
return source.conditions_target;
|
||||
}
|
||||
|
||||
public void addItem(Common.TimedConditionEffect item) {
|
||||
if (source.conditions_target == null) {
|
||||
source.conditions_target = new ArrayList<Common.TimedConditionEffect>();
|
||||
}
|
||||
source.conditions_target.add(item);
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_target.indexOf(item);
|
||||
source.conditions_target.remove(item);
|
||||
if (source.conditions_target.isEmpty()) {
|
||||
source.conditions_target = null;
|
||||
}
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
List<ListDataListener> listeners = new CopyOnWriteArrayList<ListDataListener>();
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
listeners.remove(l);
|
||||
protected void setInner(List<Common.TimedConditionEffect> value) {
|
||||
source.conditions_target = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SourceTimedConditionsListModel implements ListModel<Common.TimedConditionEffect> {
|
||||
|
||||
Common.DeathEffect source;
|
||||
|
||||
|
||||
public static class SourceTimedConditionsListModel extends CommonEditor.AtListModel<Common.TimedConditionEffect, Common.DeathEffect> {
|
||||
|
||||
public SourceTimedConditionsListModel(Common.DeathEffect effect) {
|
||||
this.source = effect;
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
if (source.conditions_source == null) return 0;
|
||||
return source.conditions_source.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Common.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_source == null) return null;
|
||||
return source.conditions_source.get(index);
|
||||
}
|
||||
|
||||
public void addItem(Common.TimedConditionEffect item) {
|
||||
if (source.conditions_source == null) {
|
||||
source.conditions_source = new ArrayList<Common.TimedConditionEffect>();
|
||||
}
|
||||
source.conditions_source.add(item);
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(Common.TimedConditionEffect item) {
|
||||
int index = source.conditions_source.indexOf(item);
|
||||
source.conditions_source.remove(item);
|
||||
if (source.conditions_source.isEmpty()) {
|
||||
source.conditions_source = null;
|
||||
}
|
||||
for (ListDataListener l : listeners) {
|
||||
l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index));
|
||||
}
|
||||
protected List<Common.TimedConditionEffect> getInner() {
|
||||
return source.conditions_source;
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
List<ListDataListener> listeners = new CopyOnWriteArrayList<ListDataListener>();
|
||||
|
||||
@Override
|
||||
public void addListDataListener(ListDataListener l) {
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListDataListener(ListDataListener l) {
|
||||
listeners.remove(l);
|
||||
protected void setInner(List<Common.TimedConditionEffect> value) {
|
||||
source.conditions_source = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class TimedConditionsCellRenderer extends DefaultListCellRenderer {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@@ -1158,13 +1069,13 @@ public class NPCEditor extends JSONElementEditor {
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
Common.TimedConditionEffect effect = (Common.TimedConditionEffect) value;
|
||||
|
||||
|
||||
if (effect.condition != null) {
|
||||
|
||||
boolean immunity = (effect.magnitude == null || effect.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (effect.duration != null && effect.duration > ActorCondition.DURATION_NONE);
|
||||
boolean clear = (effect.magnitude == null || effect.magnitude == ActorCondition.MAGNITUDE_CLEAR) && (effect.duration == null || effect.duration == ActorCondition.DURATION_NONE);
|
||||
boolean forever = effect.duration != null && effect.duration == ActorCondition.DURATION_FOREVER;
|
||||
|
||||
|
||||
if (clear) {
|
||||
label.setIcon(new ImageIcon(effect.condition.getIcon()));
|
||||
label.setText(effect.chance+"% chances to clear actor condition "+effect.condition.getDesc());
|
||||
@@ -1182,7 +1093,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isNull(Common.HitEffect effect) {
|
||||
if (effect.ap_boost_min != null) return false;
|
||||
if (effect.ap_boost_max != null) return false;
|
||||
@@ -1192,7 +1103,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
if (effect.conditions_target != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isNull(Common.HitReceivedEffect effect) {
|
||||
if (effect.ap_boost_min != null) return false;
|
||||
if (effect.ap_boost_max != null) return false;
|
||||
@@ -1206,7 +1117,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
if (effect.conditions_target != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public static boolean isNull(Common.DeathEffect effect) {
|
||||
if (effect.ap_boost_min != null) return false;
|
||||
if (effect.ap_boost_max != null) return false;
|
||||
@@ -1215,7 +1126,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
if (effect.conditions_source != null) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public class NPCFieldUpdater implements FieldUpdateListener {
|
||||
|
||||
@Override
|
||||
@@ -1230,7 +1141,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
return;
|
||||
}
|
||||
if (target.id.equals((String) value)) return;
|
||||
|
||||
|
||||
if (idChanging()) {
|
||||
npc.id = (String) value;
|
||||
NPCEditor.this.name = npc.getDesc();
|
||||
@@ -1689,9 +1600,9 @@ public class NPCEditor extends JSONElementEditor {
|
||||
npc.death_effect = deathEffect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
experienceField.setValue(npc.getMonsterExperience());
|
||||
|
||||
|
||||
if (npc.state != GameDataElement.State.modified) {
|
||||
npc.state = GameDataElement.State.modified;
|
||||
NPCEditor.this.name = npc.getDesc();
|
||||
@@ -1699,9 +1610,9 @@ public class NPCEditor extends JSONElementEditor {
|
||||
ATContentStudio.frame.editorChanged(NPCEditor.this);
|
||||
}
|
||||
updateJsonViewText(npc.toJsonString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user