diff --git a/src/com/gpl/rpg/atcontentstudio/model/maps/KeyArea.java b/src/com/gpl/rpg/atcontentstudio/model/maps/KeyArea.java index 53a60aa..f1b9871 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/maps/KeyArea.java +++ b/src/com/gpl/rpg/atcontentstudio/model/maps/KeyArea.java @@ -19,20 +19,20 @@ public class KeyArea extends MapObject { String requireType = obj.getProperties().getProperty("requireType"); String requireId = obj.getProperties().getProperty("requireId"); String requireValue = obj.getProperties().getProperty("requireValue"); + oldSchoolRequirement = false; if (requireId == null) { String[] fields = obj.getName().split(":"); if (fields.length == 2) { requireType = Requirement.RequirementType.questProgress.toString(); requireValue = fields[1]; requireId = fields[0]; + oldSchoolRequirement = true; } else if (fields.length == 3) { requireValue = fields[2]; requireType = fields[0]; requireId = fields[1]; + oldSchoolRequirement = true; } - oldSchoolRequirement = true; - } else { - oldSchoolRequirement = false; } requirement = new Requirement(); if (requireType != null) requirement.type = Requirement.RequirementType.valueOf(requireType); diff --git a/src/com/gpl/rpg/atcontentstudio/ui/Editor.java b/src/com/gpl/rpg/atcontentstudio/ui/Editor.java index 8d885d5..703e701 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/Editor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/Editor.java @@ -316,11 +316,15 @@ public abstract class Editor extends JPanel implements ProjectElementListener { // } public static JSpinner addIntegerField(JPanel pane, String label, Integer initialValue, boolean allowNegatives, boolean editable, final FieldUpdateListener listener) { + return addIntegerField(pane, label, initialValue, 0, allowNegatives, editable, listener); + } + + public static JSpinner addIntegerField(JPanel pane, String label, Integer initialValue, Integer defaultValue, boolean allowNegatives, boolean editable, final FieldUpdateListener listener) { JPanel tfPane = new JPanel(); tfPane.setLayout(new JideBoxLayout(tfPane, JideBoxLayout.LINE_AXIS, 6)); JLabel tfLabel = new JLabel(label); tfPane.add(tfLabel, JideBoxLayout.FIX); - final JSpinner spinner = new JSpinner(new SpinnerNumberModel(initialValue != null ? initialValue.intValue() : 0, allowNegatives ? Integer.MIN_VALUE : 0, Integer.MAX_VALUE, 1)); + final JSpinner spinner = new JSpinner(new SpinnerNumberModel(initialValue != null ? initialValue.intValue() : defaultValue.intValue(), allowNegatives ? Integer.MIN_VALUE : 0, Integer.MAX_VALUE, 1)); ((JSpinner.DefaultEditor)spinner.getEditor()).getTextField().setHorizontalAlignment(JTextField.LEFT); spinner.setEnabled(editable); ((DefaultFormatter)((NumberEditor)spinner.getEditor()).getTextField().getFormatter()).setCommitsOnValidEdit(true); diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ItemEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ItemEditor.java index 2b993c2..f959c89 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ItemEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ItemEditor.java @@ -487,7 +487,7 @@ public class ItemEditor extends JSONElementEditor { hitSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener); hitSourceConditionApply = new JRadioButton("Apply new condition"); pane.add(hitSourceConditionApply, JideBoxLayout.FIX); - hitSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, false, writable, listener); + hitSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener); hitSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener); hitSourceConditionClear = new JRadioButton("Clear active condition"); pane.add(hitSourceConditionClear, JideBoxLayout.FIX); @@ -543,7 +543,7 @@ public class ItemEditor extends JSONElementEditor { hitTargetConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener); hitTargetConditionApply = new JRadioButton("Apply new condition"); pane.add(hitTargetConditionApply, JideBoxLayout.FIX); - hitTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, false, writable, listener); + hitTargetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener); hitTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener); hitTargetConditionClear = new JRadioButton("Clear active condition"); pane.add(hitTargetConditionClear, JideBoxLayout.FIX); @@ -599,7 +599,7 @@ public class ItemEditor extends JSONElementEditor { killSourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener); killSourceConditionApply = new JRadioButton("Apply new condition"); pane.add(killSourceConditionApply, JideBoxLayout.FIX); - killSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, false, writable, listener); + killSourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude == null ? null : condition.magnitude >= 0 ? condition.magnitude : 0, 1, false, writable, listener); killSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener); killSourceConditionClear = new JRadioButton("Clear active condition"); pane.add(killSourceConditionClear, JideBoxLayout.FIX); @@ -651,7 +651,7 @@ public class ItemEditor extends JSONElementEditor { Project proj = ((Item)target).getProject(); equipConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener); - equipConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, false, writable, listener); + equipConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, 1, false, writable, listener); pane.revalidate(); pane.repaint(); diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/NPCEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/NPCEditor.java index fe071ff..9daace3 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/NPCEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/NPCEditor.java @@ -181,12 +181,12 @@ public class NPCEditor extends JSONElementEditor { moveTypeBox = addEnumValueBox(pane, "Movement type: ", NPC.MovementType.values(), npc.movement_type, npc.writable, listener); combatTraitPane = new CollapsiblePanel("Combat traits: "); combatTraitPane.setLayout(new JideBoxLayout(combatTraitPane, JideBoxLayout.PAGE_AXIS, 6)); - maxHP = addIntegerField(combatTraitPane, "Max HP: ", npc.max_hp, false, npc.writable, listener); - maxAP = addIntegerField(combatTraitPane, "Max AP: ", npc.max_ap, false, npc.writable, listener); - moveCost = addIntegerField(combatTraitPane, "Move cost: ", npc.move_cost, false, npc.writable, listener); + maxHP = addIntegerField(combatTraitPane, "Max HP: ", npc.max_hp, 1, false, npc.writable, listener); + maxAP = addIntegerField(combatTraitPane, "Max AP: ", npc.max_ap, 10, false, npc.writable, listener); + moveCost = addIntegerField(combatTraitPane, "Move cost: ", npc.move_cost, 10, false, npc.writable, listener); atkDmgMin = addIntegerField(combatTraitPane, "Attack Damage min: ", npc.attack_damage_min, false, npc.writable, listener); atkDmgMax = addIntegerField(combatTraitPane, "Attack Damage max: ", npc.attack_damage_max, false, npc.writable, listener); - atkCost = addIntegerField(combatTraitPane, "Attack cost: ", npc.attack_cost, false, npc.writable, listener); + atkCost = addIntegerField(combatTraitPane, "Attack cost: ", npc.attack_cost, 10, false, npc.writable, listener); atkChance = addIntegerField(combatTraitPane, "Attack chance: ", npc.attack_chance, false, npc.writable, listener); critSkill = addIntegerField(combatTraitPane, "Critical skill: ", npc.critical_skill, false, npc.writable, listener); critMult = addDoubleField(combatTraitPane, "Critical multiplier: ", npc.critical_multiplier, npc.writable, listener); @@ -323,7 +323,7 @@ public class NPCEditor extends JSONElementEditor { Project proj = ((NPC)target).getProject(); sourceConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener); - sourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, false, writable, listener); + sourceConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, 1, false, writable, listener); sourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener); sourceConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener); @@ -341,7 +341,7 @@ public class NPCEditor extends JSONElementEditor { Project proj = ((NPC)target).getProject(); targetConditionBox = addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable, listener); - targetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, false, writable, listener); + targetConditionMagnitude = addIntegerField(pane, "Magnitude: ", condition.magnitude, 1, false, writable, listener); targetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener); targetConditionChance = addDoubleField(pane, "Chance: ", condition.chance, writable, listener);