diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java index 7ecf07dc642..69dbdb79ae7 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuPreferences.java @@ -246,6 +246,7 @@ public enum CSubmenuPreferences implements ICDoc { initializeMulliganRuleComboBox(); initializeAiProfilesComboBox(); initializeStackAdditionsComboBox(); + initializeLandPlayedComboBox(); initializeColorIdentityCombobox(); initializeAutoYieldModeComboBox(); initializeCounterDisplayTypeComboBox(); @@ -447,7 +448,17 @@ public enum CSubmenuPreferences implements ICDoc { final String selectedItem = this.prefs.getPref(userSetting); panel.setComboBox(comboBox, selectedItem); } - + + private void initializeLandPlayedComboBox() { + final String[] elems = {ForgeConstants.LAND_PLAYED_NOTIFICATION_NEVER, ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS, + ForgeConstants.LAND_PLAYED_NOTIFICATION_AI}; + final FPref userSetting = FPref.UI_LAND_PLAYED_NOTIFICATION_POLICY; + final FComboBoxPanel panel = this.view.getCbpLandPlayedComboBoxPanel(); + final FComboBox comboBox = createComboBox(elems, userSetting); + final String selectedItem = this.prefs.getPref(userSetting); + panel.setComboBox(comboBox, selectedItem); + } + private void initializeColorIdentityCombobox() { final String[] elems = {ForgeConstants.DISP_CURRENT_COLORS_NEVER, ForgeConstants.DISP_CURRENT_COLORS_CHANGED, ForgeConstants.DISP_CURRENT_COLORS_MULTICOLOR, ForgeConstants.DISP_CURRENT_COLORS_MULTI_OR_CHANGED, diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java index 103a046b3fd..352d1a69a60 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuPreferences.java @@ -120,6 +120,7 @@ public enum VSubmenuPreferences implements IVSubmenu { private final FComboBoxPanel cbpMulliganRule = new FComboBoxPanel<>(localizer.getMessage("cbpMulliganRule")+":"); private final FComboBoxPanel cbpAiProfiles = new FComboBoxPanel<>(localizer.getMessage("cbpAiProfiles")+":"); private final FComboBoxPanel cbpStackAdditions = new FComboBoxPanel<>(localizer.getMessage("cbpStackAdditions")+":"); + private final FComboBoxPanel cbpLandPlayed = new FComboBoxPanel<>(localizer.getMessage("cbpLandPlayed")+":"); private final FComboBoxPanel cbpDisplayCurrentCardColors = new FComboBoxPanel<>(localizer.getMessage("cbpDisplayCurrentCardColors")+":"); private final FComboBoxPanel cbpAutoYieldMode = new FComboBoxPanel<>(localizer.getMessage("cbpAutoYieldMode")+":"); private final FComboBoxPanel cbpCounterDisplayType = new FComboBoxPanel<>(localizer.getMessage("cbpCounterDisplayType")+":"); @@ -205,6 +206,9 @@ public enum VSubmenuPreferences implements IVSubmenu { pnlPrefs.add(cbpStackAdditions, comboBoxConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpStackAdditions")), descriptionConstraints); + + pnlPrefs.add(cbpLandPlayed, comboBoxConstraints); + pnlPrefs.add(new NoteLabel(localizer.getMessage("nlpLandPlayed")), descriptionConstraints); pnlPrefs.add(cbEnforceDeckLegality, titleConstraints); pnlPrefs.add(new NoteLabel(localizer.getMessage("nlEnforceDeckLegality")), descriptionConstraints); @@ -684,6 +688,10 @@ public enum VSubmenuPreferences implements IVSubmenu { public FComboBoxPanel getCbpStackAdditionsComboBoxPanel() { return cbpStackAdditions; } + + public FComboBoxPanel getCbpLandPlayedComboBoxPanel() { + return cbpLandPlayed; + } public FComboBoxPanel getGameLogVerbosityComboBoxPanel() { return cbpGameLogEntryType; diff --git a/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java b/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java index 997d940fd73..518b93ce7ed 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java +++ b/forge-gui-desktop/src/main/java/forge/screens/match/CMatchUI.java @@ -1450,38 +1450,42 @@ public final class CMatchUI } private void createLandPopupPanel(Card land, Zone zone) { - String title = "Forge"; - List options = ImmutableList.of(Localizer.getInstance().getMessage("lblOK")); - MigLayout migLayout = new MigLayout("insets 15, left, gap 30, fill"); - JPanel mainPanel = new JPanel(migLayout); - final Dimension parentSize = JOptionPane.getRootFrame().getSize(); - Dimension maxSize = new Dimension(1400, parentSize.height - 100); - mainPanel.setMaximumSize(maxSize); - mainPanel.setOpaque(false); - - int rotation = getRotation(land.getView()); + String landPlayedNotificationPolicy = FModel.getPreferences().getPref(FPref.UI_LAND_PLAYED_NOTIFICATION_POLICY); + Player cardController = land.getController(); + boolean isAi = cardController.isAI(); + if(ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS.equals(landPlayedNotificationPolicy) || (ForgeConstants.LAND_PLAYED_NOTIFICATION_AI.equals(landPlayedNotificationPolicy) && (isAi))) { + String title = "Forge"; + List options = ImmutableList.of(Localizer.getInstance().getMessage("lblOK")); + + MigLayout migLayout = new MigLayout("insets 15, left, gap 30, fill"); + JPanel mainPanel = new JPanel(migLayout); + final Dimension parentSize = JOptionPane.getRootFrame().getSize(); + Dimension maxSize = new Dimension(1400, parentSize.height - 100); + mainPanel.setMaximumSize(maxSize); + mainPanel.setOpaque(false); + + int rotation = getRotation(land.getView()); - FImagePanel imagePanel = new FImagePanel(); - BufferedImage bufferedImage = FImageUtil.getImage(land.getCurrentState().getView()); - imagePanel.setImage(bufferedImage, rotation, AutoSizeImageMode.SOURCE); - int imageWidth = 433; - int imageHeight = 600; - Dimension imagePanelDimension = new Dimension(imageWidth,imageHeight); - imagePanel.setMinimumSize(imagePanelDimension); - - mainPanel.add(imagePanel, "cell 0 0, spany 3"); - - Player cardController = land.getController(); - String msg = cardController.toString() + " puts " + land.toString() + " into play into " + zone.toString() + "."; - - final FTextArea prompt1 = new FTextArea(msg); - prompt1.setFont(FSkin.getFont(21)); - prompt1.setAutoSize(true); - prompt1.setMinimumSize(new Dimension(475,200)); - mainPanel.add(prompt1, "cell 1 0, aligny top"); - - - FOptionPane.showOptionDialog(null, title, null, mainPanel, options); + FImagePanel imagePanel = new FImagePanel(); + BufferedImage bufferedImage = FImageUtil.getImage(land.getCurrentState().getView()); + imagePanel.setImage(bufferedImage, rotation, AutoSizeImageMode.SOURCE); + int imageWidth = 433; + int imageHeight = 600; + Dimension imagePanelDimension = new Dimension(imageWidth,imageHeight); + imagePanel.setMinimumSize(imagePanelDimension); + + mainPanel.add(imagePanel, "cell 0 0, spany 3"); + + String msg = cardController.toString() + " puts " + land.toString() + " into play into " + zone.toString() + "."; + + final FTextArea prompt1 = new FTextArea(msg); + prompt1.setFont(FSkin.getFont(21)); + prompt1.setAutoSize(true); + prompt1.setMinimumSize(new Dimension(475,200)); + mainPanel.add(prompt1, "cell 1 0, aligny top"); + + FOptionPane.showOptionDialog(null, title, null, mainPanel, options); + } } } diff --git a/forge-gui/res/languages/en-US.properties b/forge-gui/res/languages/en-US.properties index 7c1cc2d7adc..ea286757045 100644 --- a/forge-gui/res/languages/en-US.properties +++ b/forge-gui/res/languages/en-US.properties @@ -2583,4 +2583,6 @@ lblEnterMessageToSend=Enter message to send #OnlineLobbyScreen.java lblDetectedInvalidHostAddress=Invalid host address ({0}) was detected. #Player.java -lblChooseACompanion=Choose a companion \ No newline at end of file +lblChooseACompanion=Choose a companion +cbpLandPlayed=Land entering battlefield notifications +nlpLandPlayed=Choose when you want to get visual notifications for a land entering the battlefield: Never, always, or only for the lands entering a battlefield because of an action of a AI player diff --git a/forge-gui/src/main/java/forge/properties/ForgeConstants.java b/forge-gui/src/main/java/forge/properties/ForgeConstants.java index eedfa484152..809d4e823d1 100644 --- a/forge-gui/src/main/java/forge/properties/ForgeConstants.java +++ b/forge-gui/src/main/java/forge/properties/ForgeConstants.java @@ -321,6 +321,11 @@ public final class ForgeConstants { public static final String STACK_EFFECT_NOTIFICATION_NEVER = "Never"; public static final String STACK_EFFECT_NOTIFICATION_ALWAYS = "Always"; public static final String STACK_EFFECT_NOTIFICATION_AI_AND_TRIGGERED = "AI cast/activated, or triggered by any player"; + + // Constants for LAnd played notification policy + public static final String LAND_PLAYED_NOTIFICATION_NEVER = "Never"; + public static final String LAND_PLAYED_NOTIFICATION_ALWAYS = "Always"; + public static final String LAND_PLAYED_NOTIFICATION_AI = "Lands entering a battlefield because of an action of a AI player"; // Set boolean constant for landscape mode for gdx port public static final boolean isGdxPortLandscape = FileUtil.doesFileExist(ASSETS_DIR + "switch_orientation.ini"); diff --git a/forge-gui/src/main/java/forge/properties/ForgePreferences.java b/forge-gui/src/main/java/forge/properties/ForgePreferences.java index fa49f465f71..679b2922e96 100644 --- a/forge-gui/src/main/java/forge/properties/ForgePreferences.java +++ b/forge-gui/src/main/java/forge/properties/ForgePreferences.java @@ -121,6 +121,7 @@ public class ForgePreferences extends PreferencesStore { UI_CLOSE_ACTION ("NONE"), UI_MANA_LOST_PROMPT ("false"), // Prompt on losing mana when passing priority UI_STACK_EFFECT_NOTIFICATION_POLICY ("Never"), + UI_LAND_PLAYED_NOTIFICATION_POLICY ("Never"), UI_PAUSE_WHILE_MINIMIZED("false"), UI_TOKENS_IN_SEPARATE_ROW("false"), // Display tokens in their own battlefield row. UI_DISPLAY_CURRENT_COLORS(ForgeConstants.DISP_CURRENT_COLORS_NEVER),