mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Added a user preference that allows a user to choose whether a clone or copied card should use its native artwork or the artwork of the card being cloned. By default the cloned card's image will be used.
This commit is contained in:
@@ -19,6 +19,7 @@ import forge.card.spellability.Target;
|
||||
import forge.card.trigger.Trigger;
|
||||
import forge.card.trigger.TriggerHandler;
|
||||
import forge.gui.GuiDialog;
|
||||
import forge.properties.ForgePreferences.FPref;
|
||||
|
||||
public class CloneEffect extends SpellAbilityEffect {
|
||||
// TODO update this method
|
||||
@@ -87,10 +88,13 @@ public class CloneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
// determine the image to be used for the clone
|
||||
String imageFileName = host.getImageKey();
|
||||
List<Card> cloneImgSources = AbilityUtils.getDefinedCards(host, sa.getParam("ImageSource"), sa);
|
||||
if (!cloneImgSources.isEmpty()) {
|
||||
imageFileName = cloneImgSources.get(0).getImageKey();
|
||||
String imageFileName = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_CLONE_MODE_SOURCE)
|
||||
? tgtCard.getImageKey() : cardToCopy.getImageKey();
|
||||
if (sa.hasParam("ImageSource")) { // Allow the image to be stipulated by using a defined card source
|
||||
List<Card> cloneImgSources = AbilityUtils.getDefinedCards(host, sa.getParam("ImageSource"), sa);
|
||||
if (!cloneImgSources.isEmpty()) {
|
||||
imageFileName = cloneImgSources.get(0).getImageKey();
|
||||
}
|
||||
}
|
||||
|
||||
boolean keepName = sa.hasParam("KeepName");
|
||||
|
||||
@@ -99,6 +99,15 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
}
|
||||
});
|
||||
|
||||
view.getCbCloneImgSource().addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(final ItemEvent arg0) {
|
||||
final boolean toggle = view.getCbCloneImgSource().isSelected();
|
||||
prefs.setPref(FPref.UI_CLONE_MODE_SOURCE, String.valueOf(toggle));
|
||||
prefs.save();
|
||||
}
|
||||
});
|
||||
|
||||
view.getCbRemoveSmall().addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(final ItemEvent arg0) {
|
||||
@@ -207,13 +216,14 @@ public enum CSubmenuPreferences implements ICDoc {
|
||||
view.getCbStackLand().setSelected(prefs.getPrefBoolean(FPref.UI_SMOOTH_LAND));
|
||||
view.getCbDevMode().setSelected(prefs.getPrefBoolean(FPref.DEV_MODE_ENABLED));
|
||||
view.getCbEnforceDeckLegality().setSelected(prefs.getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY));
|
||||
view.getCbCloneImgSource().setSelected(prefs.getPrefBoolean(FPref.UI_CLONE_MODE_SOURCE));
|
||||
view.getCbRandomFoil().setSelected(prefs.getPrefBoolean(FPref.UI_RANDOM_FOIL));
|
||||
view.getCbRandomizeArt().setSelected(prefs.getPrefBoolean(FPref.UI_RANDOM_CARD_ART));
|
||||
view.getCbScaleLarger().setSelected(prefs.getPrefBoolean(FPref.UI_SCALE_LARGER));
|
||||
view.getCbTextMana().setSelected(prefs.getPrefBoolean(FPref.UI_CARD_OVERLAY));
|
||||
view.getCbEnableSounds().setSelected(prefs.getPrefBoolean(FPref.UI_ENABLE_SOUNDS));
|
||||
view.reloadShortcuts();
|
||||
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override public void run() { view.getCbRemoveSmall().requestFocusInWindow(); }
|
||||
});
|
||||
|
||||
@@ -74,7 +74,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
|
||||
private final FLabel lblTitleAIProfile = new FLabel.Builder()
|
||||
.text("Choose AI Personality").fontStyle(Font.BOLD).fontSize(14).build();
|
||||
|
||||
|
||||
private final JList lstChooseAIProfile = new FList();
|
||||
private final FLabel lblChooseAIProfile = new FLabel.Builder().fontSize(12).fontStyle(Font.ITALIC)
|
||||
.text("AI Opponent Personality.")
|
||||
@@ -90,6 +90,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final JCheckBox cbManaBurn = new OptionsCheckBox("Mana Burn");
|
||||
private final JCheckBox cbDevMode = new OptionsCheckBox("Developer Mode");
|
||||
private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox("Deck Conformance");
|
||||
private final JCheckBox cbCloneImgSource = new OptionsCheckBox("Clones use original card art");
|
||||
private final JCheckBox cbTextMana = new OptionsCheckBox("Text / Mana Overlay");
|
||||
private final JCheckBox cbScaleLarger = new OptionsCheckBox("Scale Image Larger");
|
||||
private final JCheckBox cbRandomFoil = new OptionsCheckBox("Random Foil");
|
||||
@@ -97,8 +98,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
private final JCheckBox cbEnableSounds = new OptionsCheckBox("Enable Sounds");
|
||||
|
||||
private final Map<FPref, KeyboardShortcutField> shortcutFields = new HashMap<FPref, KeyboardShortcutField>();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
@@ -143,6 +143,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
pnlPrefs.add(cbEnforceDeckLegality, regularConstraints);
|
||||
pnlPrefs.add(new NoteLabel("Enforces deck legality relevant to each environment (minimum deck sizes, max card count etc)"), regularConstraints);
|
||||
|
||||
pnlPrefs.add(cbCloneImgSource, regularConstraints);
|
||||
pnlPrefs.add(new NoteLabel("When enabled clones will use their original art instead of the cloned card's art"), regularConstraints);
|
||||
|
||||
// AI Personality Profile Options
|
||||
pnlPrefs.add(new SectionLabel("AI Options"), sectionConstraints);
|
||||
|
||||
@@ -201,7 +204,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
e.getValue().reload(e.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.view.home.IViewSubmenu#populate()
|
||||
*/
|
||||
@@ -320,7 +323,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
public void reload(FPref prefKey) {
|
||||
this.setCodeString(Singletons.getModel().getPreferences().getPref(prefKey));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the code string.
|
||||
*
|
||||
@@ -451,6 +454,11 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
|
||||
return cbEnforceDeckLegality;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbCloneImgSource() {
|
||||
return cbCloneImgSource;
|
||||
}
|
||||
|
||||
/** @return {@link javax.swing.JCheckBox} */
|
||||
public JCheckBox getCbEnableSounds() {
|
||||
return cbEnableSounds;
|
||||
|
||||
@@ -51,7 +51,8 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
|
||||
UI_TARGETING_OVERLAY ("false"),
|
||||
UI_ENABLE_SOUNDS ("true"),
|
||||
UI_RANDOM_CARD_ART ("false"),
|
||||
UI_CURRENT_AI_PROFILE (AiProfileUtil.AI_PROFILE_RANDOM_MATCH), /** */
|
||||
UI_CURRENT_AI_PROFILE (AiProfileUtil.AI_PROFILE_RANDOM_MATCH),
|
||||
UI_CLONE_MODE_SOURCE ("false"), /** */
|
||||
|
||||
SUBMENU_CURRENTMENU (EMenuItem.CONSTRUCTED.toString()),
|
||||
SUBMENU_SANCTIONED ("false"),
|
||||
|
||||
Reference in New Issue
Block a user