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.
This commit is contained in:
Alessandro Coli
2020-09-26 14:24:55 +02:00
parent 8d24a2a6ff
commit 36da6b6c7f
4 changed files with 12 additions and 4 deletions

View File

@@ -125,7 +125,6 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
} }
} }
onChanged(); onChanged();
game.fireEvent(new GameEventZone(zoneType, getPlayer(), EventValueChangeType.Added, c));
if(zoneType == ZoneType.Battlefield && c.isLand()) { if(zoneType == ZoneType.Battlefield && c.isLand()) {
PlayerCollection playerCollection = game.getPlayers(); PlayerCollection playerCollection = game.getPlayers();
@@ -138,6 +137,9 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
} }
} }
} }
game.fireEvent(new GameEventZone(zoneType, getPlayer(), EventValueChangeType.Added, c));
} }
public final boolean contains(final Card c) { public final boolean contains(final Card c) {

View File

@@ -451,7 +451,8 @@ public enum CSubmenuPreferences implements ICDoc {
private void initializeLandPlayedComboBox() { private void initializeLandPlayedComboBox() {
final String[] elems = {ForgeConstants.LAND_PLAYED_NOTIFICATION_NEVER, ForgeConstants.LAND_PLAYED_NOTIFICATION_ALWAYS, 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 FPref userSetting = FPref.UI_LAND_PLAYED_NOTIFICATION_POLICY;
final FComboBoxPanel<String> panel = this.view.getCbpLandPlayedComboBoxPanel(); final FComboBoxPanel<String> panel = this.view.getCbpLandPlayedComboBoxPanel();
final FComboBox<String> comboBox = createComboBox(elems, userSetting); final FComboBox<String> comboBox = createComboBox(elems, userSetting);

View File

@@ -1454,7 +1454,10 @@ public final class CMatchUI
String landPlayedNotificationPolicy = FModel.getPreferences().getPref(FPref.UI_LAND_PLAYED_NOTIFICATION_POLICY); String landPlayedNotificationPolicy = FModel.getPreferences().getPref(FPref.UI_LAND_PLAYED_NOTIFICATION_POLICY);
Player cardController = land.getController(); Player cardController = land.getController();
boolean isAi = cardController.isAI(); 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"; String title = "Forge";
List<String> options = ImmutableList.of(Localizer.getInstance().getMessage("lblOK")); List<String> options = ImmutableList.of(Localizer.getInstance().getMessage("lblOK"));

View File

@@ -325,7 +325,9 @@ public final class ForgeConstants {
// Constants for LAnd played notification policy // Constants for LAnd played notification policy
public static final String LAND_PLAYED_NOTIFICATION_NEVER = "Never"; 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 = "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 = "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 // Set boolean constant for landscape mode for gdx port
public static final boolean isGdxPortLandscape = FileUtil.doesFileExist(ASSETS_DIR + "switch_orientation.ini"); public static final boolean isGdxPortLandscape = FileUtil.doesFileExist(ASSETS_DIR + "switch_orientation.ini");