mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-26 23:57:25 +01:00
Bug fixes and added icon overlay for immunity management.
This commit is contained in:
BIN
src/com/gpl/rpg/atcontentstudio/img/ui_icon_immunity.png
Normal file
BIN
src/com/gpl/rpg/atcontentstudio/img/ui_icon_immunity.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -139,6 +139,10 @@ public class DefaultIcons {
|
||||
private static String SKILL_RES = "/com/gpl/rpg/atcontentstudio/img/ui_icon_skill.png";
|
||||
public static Image getSkillImage() { return getImage(SKILL_RES); }
|
||||
public static Image getSkillIcon() { return getIcon(SKILL_RES); }
|
||||
|
||||
private static String IMMUNITY_RES = "/com/gpl/rpg/atcontentstudio/img/ui_icon_immunity.png";
|
||||
public static Image getImmunityImage() { return getImage(IMMUNITY_RES); }
|
||||
public static Image getImmunityIcon() { return getIcon(IMMUNITY_RES); }
|
||||
|
||||
private static String ITEM_CATEGORY_RES = "/com/gpl/rpg/atcontentstudio/img/equip_weapon.png";
|
||||
public static Image getItemCategoryImage() { return getImage(ITEM_CATEGORY_RES); }
|
||||
|
||||
35
src/com/gpl/rpg/atcontentstudio/ui/OverlayIcon.java
Normal file
35
src/com/gpl/rpg/atcontentstudio/ui/OverlayIcon.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package com.gpl.rpg.atcontentstudio.ui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
public class OverlayIcon implements Icon {
|
||||
|
||||
private Image background;
|
||||
private Image overlay;
|
||||
|
||||
public OverlayIcon(Image background, Image overlay) {
|
||||
this.background = background;
|
||||
this.overlay = overlay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
g.drawImage(background, x, y, null);
|
||||
g.drawImage(overlay, x, y, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return Math.max(background.getWidth(null), overlay.getWidth(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return Math.max(background.getHeight(null), overlay.getHeight(null));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,6 +52,7 @@ import com.gpl.rpg.atcontentstudio.ui.BooleanBasedCheckBox;
|
||||
import com.gpl.rpg.atcontentstudio.ui.CollapsiblePanel;
|
||||
import com.gpl.rpg.atcontentstudio.ui.DefaultIcons;
|
||||
import com.gpl.rpg.atcontentstudio.ui.FieldUpdateListener;
|
||||
import com.gpl.rpg.atcontentstudio.ui.OverlayIcon;
|
||||
import com.gpl.rpg.atcontentstudio.ui.gamedataeditors.dialoguetree.DialogueGraphView;
|
||||
import com.jidesoft.swing.JideBoxLayout;
|
||||
|
||||
@@ -400,7 +401,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
rewardObj = addActorConditionBox(pane, ((Dialogue)target).getProject(), "Actor Condition: ", (ActorCondition) reward.reward_obj, writable, listener);
|
||||
rewardConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(rewardConditionTimed, JideBoxLayout.FIX);
|
||||
rewardValue = addIntegerField(pane, "Duration: ", reward.reward_value, false, writable, listener);
|
||||
rewardValue = addIntegerField(pane, "Duration: ", reward.reward_value, 1, false, writable, listener);
|
||||
rewardConditionForever = new JRadioButton("Forever");
|
||||
pane.add(rewardConditionForever, JideBoxLayout.FIX);
|
||||
if (!immunity) {
|
||||
@@ -878,7 +879,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
case actorConditionImmunity:
|
||||
boolean rewardForever = reward.reward_value == null || reward.reward_value.intValue() == ActorCondition.DURATION_FOREVER;
|
||||
label.setText("Give immunity to actor condition "+rewardObjDesc+(rewardForever ? " forever" : " for "+reward.reward_value+" turns"));
|
||||
if (reward.reward_obj != null) label.setIcon(new ImageIcon(reward.reward_obj.getIcon()));
|
||||
if (reward.reward_obj != null) label.setIcon(new OverlayIcon(reward.reward_obj.getIcon(), DefaultIcons.getImmunityIcon()));
|
||||
break;
|
||||
case alignmentChange:
|
||||
label.setText("Change alignment for faction "+rewardObjDesc+" : "+reward.reward_value);
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.gpl.rpg.atcontentstudio.ui.CollapsiblePanel;
|
||||
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.jidesoft.swing.JideBoxLayout;
|
||||
|
||||
public class ItemEditor extends JSONElementEditor {
|
||||
@@ -512,7 +513,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
|
||||
hitSourceConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitSourceConditionTimed, JideBoxLayout.FIX);
|
||||
hitSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
|
||||
hitSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitSourceConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitSourceConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
@@ -608,7 +609,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
|
||||
hitTargetConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(hitTargetConditionTimed, JideBoxLayout.FIX);
|
||||
hitTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
|
||||
hitTargetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
hitTargetConditionForever = new JRadioButton("Forever");
|
||||
pane.add(hitTargetConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
@@ -704,7 +705,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
|
||||
killSourceConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(killSourceConditionTimed, JideBoxLayout.FIX);
|
||||
killSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
|
||||
killSourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
killSourceConditionForever = new JRadioButton("Forever");
|
||||
pane.add(killSourceConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
@@ -951,17 +952,19 @@ public class ItemEditor extends JSONElementEditor {
|
||||
Item.TimedConditionEffect effect = (Item.TimedConditionEffect) value;
|
||||
|
||||
if (effect.condition != null) {
|
||||
label.setIcon(new ImageIcon(effect.condition.getIcon()));
|
||||
|
||||
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());
|
||||
} else if (immunity) {
|
||||
label.setIcon(new OverlayIcon(effect.condition.getIcon(), DefaultIcons.getImmunityIcon()));
|
||||
label.setText(effect.chance+"% chances to give immunity to "+effect.condition.getDesc()+(forever ? " forever" : " for "+effect.duration+" rounds"));
|
||||
} else {
|
||||
label.setIcon(new ImageIcon(effect.condition.getIcon()));
|
||||
label.setText(effect.chance+"% chances to give actor condition "+effect.condition.getDesc()+" x"+effect.magnitude+(forever ? " forever" : " for "+effect.duration+" rounds"));
|
||||
}
|
||||
} else {
|
||||
@@ -1045,10 +1048,11 @@ public class ItemEditor extends JSONElementEditor {
|
||||
Item.ConditionEffect effect = (Item.ConditionEffect) value;
|
||||
|
||||
if (effect.condition != null) {
|
||||
label.setIcon(new ImageIcon(effect.condition.getIcon()));
|
||||
if (effect.magnitude == ActorCondition.MAGNITUDE_CLEAR) {
|
||||
label.setIcon(new OverlayIcon(effect.condition.getIcon(), DefaultIcons.getImmunityIcon()));
|
||||
label.setText("Immune to actor condition "+effect.condition.getDesc());
|
||||
} else {
|
||||
label.setIcon(new ImageIcon(effect.condition.getIcon()));
|
||||
label.setText("Give actor condition "+effect.condition.getDesc()+" x"+effect.magnitude);
|
||||
}
|
||||
} else {
|
||||
@@ -1269,9 +1273,11 @@ public class ItemEditor extends JSONElementEditor {
|
||||
} else if (source == equipConditionImmunity && (Boolean) value) {
|
||||
selectedEquipEffectCondition.magnitude = ActorCondition.MAGNITUDE_CLEAR;
|
||||
equipConditionMagnitude.setEnabled(false);
|
||||
equipConditionsModel.itemChanged(selectedEquipEffectCondition);
|
||||
} else if (source == equipConditionWithMagnitude && (Boolean) value) {
|
||||
selectedEquipEffectCondition.magnitude = (Integer) equipConditionMagnitude.getValue();
|
||||
equipConditionMagnitude.setEnabled(true);
|
||||
equipConditionsModel.itemChanged(selectedEquipEffectCondition);
|
||||
} else if (source == hitHPMin) {
|
||||
hitEffect.hp_boost_min = (Integer) value;
|
||||
updatePrice = true;
|
||||
@@ -1397,7 +1403,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
updateHit = true;
|
||||
} else if (source == hitTargetConditionTimed && (Boolean) value) {
|
||||
selectedHitEffectTargetCondition.duration = (Integer) hitTargetConditionDuration.getValue();
|
||||
if (selectedHitEffectTargetCondition.duration == null) {
|
||||
if (selectedHitEffectTargetCondition.duration == null || selectedHitEffectTargetCondition.duration == ActorCondition.DURATION_NONE) {
|
||||
selectedHitEffectTargetCondition.duration = 1;
|
||||
}
|
||||
updateHitTargetTimedConditionWidgets(selectedHitEffectTargetCondition);
|
||||
@@ -1477,7 +1483,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
updateKill = true;
|
||||
} else if (source == killSourceConditionTimed && (Boolean) value) {
|
||||
selectedKillEffectCondition.duration = (Integer) killSourceConditionDuration.getValue();
|
||||
if (selectedKillEffectCondition.duration == null) {
|
||||
if (selectedKillEffectCondition.duration == null || selectedKillEffectCondition.duration == ActorCondition.DURATION_NONE) {
|
||||
selectedKillEffectCondition.duration = 1;
|
||||
}
|
||||
updateKillSourceTimedConditionWidgets(selectedKillEffectCondition);
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.gpl.rpg.atcontentstudio.ui.CollapsiblePanel;
|
||||
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.gamedataeditors.dialoguetree.DialogueGraphView;
|
||||
import com.jidesoft.swing.JideBoxLayout;
|
||||
|
||||
@@ -352,7 +353,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
|
||||
sourceConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(sourceConditionTimed, JideBoxLayout.FIX);
|
||||
sourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
|
||||
sourceConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
sourceConditionForever = new JRadioButton("Forever");
|
||||
pane.add(sourceConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
@@ -442,7 +443,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
|
||||
targetConditionTimed = new JRadioButton("For a number of rounds");
|
||||
pane.add(targetConditionTimed, JideBoxLayout.FIX);
|
||||
targetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, false, writable, listener);
|
||||
targetConditionDuration = addIntegerField(pane, "Duration: ", condition.duration, 1, false, writable, listener);
|
||||
targetConditionForever = new JRadioButton("Forever");
|
||||
pane.add(targetConditionForever, JideBoxLayout.FIX);
|
||||
|
||||
@@ -640,17 +641,19 @@ public class NPCEditor extends JSONElementEditor {
|
||||
NPC.TimedConditionEffect effect = (NPC.TimedConditionEffect) value;
|
||||
|
||||
if (effect.condition != null) {
|
||||
label.setIcon(new ImageIcon(effect.condition.getIcon()));
|
||||
|
||||
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());
|
||||
} else if (immunity) {
|
||||
label.setIcon(new OverlayIcon(effect.condition.getIcon(), DefaultIcons.getImmunityIcon()));
|
||||
label.setText(effect.chance+"% chances to give immunity to "+effect.condition.getDesc()+(forever ? " forever" : " for "+effect.duration+" rounds"));
|
||||
} else {
|
||||
label.setIcon(new ImageIcon(effect.condition.getIcon()));
|
||||
label.setText(effect.chance+"% chances to give actor condition "+effect.condition.getDesc()+" x"+effect.magnitude+(forever ? " forever" : " for "+effect.duration+" rounds"));
|
||||
}
|
||||
} else {
|
||||
@@ -795,7 +798,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
} else if (source == sourceConditionApply && (Boolean) value) {
|
||||
selectedHitEffectSourceCondition.magnitude = (Integer) sourceConditionMagnitude.getValue();
|
||||
selectedHitEffectSourceCondition.duration = sourceConditionForever.isSelected() ? ActorCondition.DURATION_FOREVER : (Integer) sourceConditionDuration.getValue();
|
||||
if (selectedHitEffectSourceCondition.duration == null) {
|
||||
if (selectedHitEffectSourceCondition.duration == null || selectedHitEffectSourceCondition.duration == ActorCondition.DURATION_NONE) {
|
||||
selectedHitEffectSourceCondition.duration = 1;
|
||||
}
|
||||
updateSourceTimedConditionWidgets(selectedHitEffectSourceCondition);
|
||||
@@ -857,7 +860,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
} else if (source == targetConditionApply && (Boolean) value) {
|
||||
selectedHitEffectTargetCondition.magnitude = (Integer) targetConditionMagnitude.getValue();
|
||||
selectedHitEffectTargetCondition.duration = targetConditionForever.isSelected() ? ActorCondition.DURATION_FOREVER : (Integer) targetConditionDuration.getValue();
|
||||
if (selectedHitEffectTargetCondition.duration == null) {
|
||||
if (selectedHitEffectTargetCondition.duration == null || selectedHitEffectTargetCondition.duration == ActorCondition.DURATION_NONE) {
|
||||
selectedHitEffectTargetCondition.duration = 1;
|
||||
}
|
||||
updateSourceTimedConditionWidgets(selectedHitEffectTargetCondition);
|
||||
|
||||
Reference in New Issue
Block a user