From 36da6b6c7f040d630cb55a207cb631d1cc98a95f Mon Sep 17 00:00:00 2001 From: Alessandro Coli Date: Sat, 26 Sep 2020 14:24:55 +0200 Subject: [PATCH] New options introduced to see the popup only for nonbasic lands. Trigger of the popup moved earlier so as the sound will play on its closure (when the lands enters play) and not on its opening. --- forge-game/src/main/java/forge/game/zone/Zone.java | 6 ++++-- .../forge/screens/home/settings/CSubmenuPreferences.java | 3 ++- .../src/main/java/forge/screens/match/CMatchUI.java | 5 ++++- .../src/main/java/forge/properties/ForgeConstants.java | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/forge-game/src/main/java/forge/game/zone/Zone.java b/forge-game/src/main/java/forge/game/zone/Zone.java index 6f5088a34c6..5b3304b081f 100644 --- a/forge-game/src/main/java/forge/game/zone/Zone.java +++ b/forge-game/src/main/java/forge/game/zone/Zone.java @@ -125,8 +125,7 @@ public class Zone implements java.io.Serializable, Iterable { } } onChanged(); - game.fireEvent(new GameEventZone(zoneType, getPlayer(), EventValueChangeType.Added, c)); - + if(zoneType == ZoneType.Battlefield && c.isLand()) { PlayerCollection playerCollection = game.getPlayers(); int numPlayers = playerCollection.size(); @@ -138,6 +137,9 @@ public class Zone implements java.io.Serializable, Iterable { } } } + + game.fireEvent(new GameEventZone(zoneType, getPlayer(), EventValueChangeType.Added, c)); + } public final boolean contains(final Card c) { 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 69dbdb79ae7..09652cfddfd 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 @@ -451,7 +451,8 @@ public enum CSubmenuPreferences implements ICDoc { private void initializeLandPlayedComboBox() { final String[] elems = {ForgeConstants.LAND_PLAYED_NOTIFICATION_NEVER, ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS, - ForgeConstants.LAND_PLAYED_NOTIFICATION_AI}; + ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS_FOR_NONBASIC_LANDS, ForgeConstants.LAND_PLAYED_NOTIFICATION_AI, + ForgeConstants.LAND_PLAYED_NOTIFICATION_AI_FOR_NONBASIC_LANDS}; final FPref userSetting = FPref.UI_LAND_PLAYED_NOTIFICATION_POLICY; final FComboBoxPanel panel = this.view.getCbpLandPlayedComboBoxPanel(); final FComboBox comboBox = createComboBox(elems, userSetting); 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 518b93ce7ed..c0133940a03 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 @@ -1454,7 +1454,10 @@ public final class CMatchUI 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))) { + if(ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS.equals(landPlayedNotificationPolicy) + || (ForgeConstants.LAND_PLAYED_NOTIFICATION_AI.equals(landPlayedNotificationPolicy) && (isAi)) + || (ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS_FOR_NONBASIC_LANDS.equals(landPlayedNotificationPolicy) && !land.isBasicLand()) + || (ForgeConstants.LAND_PLAYED_NOTIFICATION_AI_FOR_NONBASIC_LANDS.equals(landPlayedNotificationPolicy) && !land.isBasicLand()) && (isAi)) { String title = "Forge"; List options = ImmutableList.of(Localizer.getInstance().getMessage("lblOK")); diff --git a/forge-gui/src/main/java/forge/properties/ForgeConstants.java b/forge-gui/src/main/java/forge/properties/ForgeConstants.java index 809d4e823d1..00c2bb02ecd 100644 --- a/forge-gui/src/main/java/forge/properties/ForgeConstants.java +++ b/forge-gui/src/main/java/forge/properties/ForgeConstants.java @@ -325,7 +325,9 @@ public final class ForgeConstants { // 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_ALWAYS_FOR_NONBASIC_LANDS = "Always, but only for nonbasic lands"; public static final String LAND_PLAYED_NOTIFICATION_AI = "Lands entering a battlefield because of an action of a AI player"; + public static final String LAND_PLAYED_NOTIFICATION_AI_FOR_NONBASIC_LANDS = "Nonbasic 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");