- Implemented a toggleable option to auto-yield either per ability or per card ("Auto-Yield Mode" under Gameplay).

- Restored the historical Forge default of auto-yielding per ability.
This commit is contained in:
Agetian
2017-02-01 17:32:02 +00:00
parent 10736e1e24
commit 10f76eae82
7 changed files with 44 additions and 6 deletions

View File

@@ -117,7 +117,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbManaLostPrompt(), FPref.UI_MANA_LOST_PROMPT));
lstControls.add(Pair.of(view.getCbEscapeEndsTurn(), FPref.UI_ALLOW_ESC_TO_END_TURN));
lstControls.add(Pair.of(view.getCbDetailedPaymentDesc(), FPref.UI_DETAILED_SPELLDESC_IN_PROMPT));
lstControls.add(Pair.of(view.getcbPreselectPrevAbOrder(), FPref.UI_PRESELECT_PREVIOUS_ABILITY_ORDER));
lstControls.add(Pair.of(view.getCbPreselectPrevAbOrder(), FPref.UI_PRESELECT_PREVIOUS_ABILITY_ORDER));
lstControls.add(Pair.of(view.getCbFilterLandsByColorId(), FPref.UI_FILTER_LANDS_BY_COLOR_IDENTITY));
@@ -181,6 +181,7 @@ public enum CSubmenuPreferences implements ICDoc {
initializeCloseActionComboBox();
initializeAiProfilesComboBox();
initializeColorIdentityCombobox();
initializeAutoYieldModeComboBox();
initializePlayerNameButton();
}
@@ -318,6 +319,14 @@ public enum CSubmenuPreferences implements ICDoc {
panel.setComboBox(comboBox, selectedItem);
}
private void initializeAutoYieldModeComboBox() {
final String[] elems = {ForgeConstants.AUTO_YIELD_PER_ABILITY, ForgeConstants.AUTO_YIELD_PER_CARD};
final FPref userSetting = FPref.UI_AUTO_YIELD_MODE;
final FComboBoxPanel<String> panel = this.view.getAutoYieldModeComboBoxPanel();
final FComboBox<String> comboBox = createComboBox(elems, userSetting);
final String selectedItem = this.prefs.getPref(userSetting);
panel.setComboBox(comboBox, selectedItem);
}
private <E> FComboBox<E> createComboBox(final E[] items, final ForgePreferences.FPref setting) {
final FComboBox<E> comboBox = new FComboBox<>(items);
addComboBoxListener(comboBox, setting);

View File

@@ -97,6 +97,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final FComboBoxPanel<CloseAction> cbpCloseAction = new FComboBoxPanel<>("Close Action:");
private final FComboBoxPanel<String> cbpAiProfiles = new FComboBoxPanel<>("AI Personality:");
private final FComboBoxPanel<String> cbpDisplayCurrentCardColors = new FComboBoxPanel<>("Show Detailed Card Color:");
private final FComboBoxPanel<String> cbpAutoYieldMode = new FComboBoxPanel<>("Auto-Yield Mode:");
/**
* Constructor.
@@ -175,6 +176,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbPreselectPrevAbOrder, regularConstraints);
pnlPrefs.add(new NoteLabel("When enabled, preselects the last defined simultaneous ability order in the ordering dialog."), regularConstraints);
pnlPrefs.add(cbpAutoYieldMode, regularConstraints);
pnlPrefs.add(new NoteLabel("Defines the granularity level of auto-yields (yield to each unique ability or to each unique card)."), regularConstraints);
// Deck building options
pnlPrefs.add(new SectionLabel("Random Deck Generation"), sectionConstraints);
@@ -552,6 +556,10 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbpCloseAction;
}
public FComboBoxPanel<String> getAutoYieldModeComboBoxPanel() {
return cbpAutoYieldMode;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbEnforceDeckLegality() {
return cbEnforceDeckLegality;
@@ -627,7 +635,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbDetailedPaymentDesc;
}
public final JCheckBox getcbPreselectPrevAbOrder() {
public final JCheckBox getCbPreselectPrevAbOrder() {
return cbPreselectPrevAbOrder;
}

View File

@@ -126,6 +126,11 @@ public class SettingsPage extends TabPage<SettingsScreen> {
"Preselect Last Order of Abilities",
"When enabled, preselects the last defined simultaneous ability order in the ordering dialog."),
1);
lstSettings.addItem(new CustomSelectSetting(FPref.UI_AUTO_YIELD_MODE,
"Auto-Yield Mode",
"Defines the granularity level of auto-yields (yield to each unique ability or to each unique card).",
new String[]{ForgeConstants.AUTO_YIELD_PER_ABILITY, ForgeConstants.AUTO_YIELD_PER_CARD}),
1);
//Random Deck Generation
lstSettings.addItem(new BooleanSetting(FPref.DECKGEN_NOSMALL,

View File

@@ -14,6 +14,9 @@ This release features all Aether Revolt cards that you can play with in all game
- Commander 2016 -
This release features most Commander 2016 cards scripted and ready to play. The few remaining cards that are not currently supported may be scripted in the upcoming versions of Forge.
- Auto-Yielding Granularity -
It is now possible to specify the granularity level for auto-yields: it is possible to choose between yielding to each unique ability or to each unique card. The difference is that, for example, when yielding per ability if you auto-yield to Hellrider's triggered ability once, all triggers from other Hellrider cards will be automatically auto-yielded to as well. When yielding per card, you will need to auto-yield to each Hellrider separately. The historical Forge default of auto-yielding per ability has been restored, and the option can now be toggled in Forge Preferences (check out "Auto-Yield Mode" under Gameplay) in both Desktop and Mobile Forge.
- User interface updates and changes -
Some notable modifications were made to the Forge UI for desktop computers. First of all, many pop-up prompts have been replaced with prompt window queries - for example, Scry 1 now shows the request to put the card on the top or bottom of the library in the prompt window instead of a pop-up dialog window, and allows to view the card in question by moving the mouse over the prompt window, which is more convenient. Second of all, in both desktop and mobile Forge, there is now an option in Forge Preferences called "Preselect Last Order of Abilities" that preselects the last known order of simultaneous abilities, thus making it possible to just use "Space" once to confirm the previous order instead of having to press Space for each ability or clicking the ">>" button to add the previous order once more. This option is currently disabled by default to avoid being confusing to users who are used to doing it the way it used to be before. Also, there is now an option to view detailed spell ability descriptions in the prompt window during mana payment and targeting, which is enabled by default but can be enabled/disabled in Forge preferences ("Spell Description in Payment Prompt" under the "Gameplay" preference group).

View File

@@ -27,6 +27,9 @@ import forge.game.player.PlayerView;
import forge.interfaces.IGameController;
import forge.interfaces.IGuiGame;
import forge.interfaces.IMayViewCards;
import forge.model.FModel;
import forge.properties.ForgeConstants;
import forge.properties.ForgePreferences;
import forge.trackable.TrackableTypes;
public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
@@ -355,15 +358,21 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
}
@Override
public final boolean shouldAutoYield(final String key) {
return !getDisableAutoYields() && autoYields.contains(key);
String abilityKey = key.indexOf("): ") != -1 ? key.substring(key.indexOf("): ") + 3) : key;
boolean yieldPerAbility = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_AUTO_YIELD_MODE).equals(ForgeConstants.AUTO_YIELD_PER_ABILITY);
return !getDisableAutoYields() && autoYields.contains(yieldPerAbility ? abilityKey : key);
}
@Override
public final void setShouldAutoYield(final String key, final boolean autoYield) {
String abilityKey = key.indexOf("): ") != -1 ? key.substring(key.indexOf("): ") + 3) : key;
boolean yieldPerAbility = FModel.getPreferences().getPref(ForgePreferences.FPref.UI_AUTO_YIELD_MODE).equals(ForgeConstants.AUTO_YIELD_PER_ABILITY);
if (autoYield) {
autoYields.add(key);
autoYields.add(yieldPerAbility ? abilityKey : key);
}
else {
autoYields.remove(key);
autoYields.remove(yieldPerAbility ? abilityKey : key);
}
}

View File

@@ -194,4 +194,7 @@ public final class ForgeConstants {
public static final String DISP_CURRENT_COLORS_MULTI_OR_CHANGED = "Multi+Changed";
public static final String DISP_CURRENT_COLORS_NEVER = "Never";
// Constants for Auto-Yield Mode
public static final String AUTO_YIELD_PER_CARD = "Per Card";
public static final String AUTO_YIELD_PER_ABILITY = "Per Ability";
}

View File

@@ -82,10 +82,11 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_MANA_LOST_PROMPT ("false"), // Prompt on losing mana when passing priority
UI_PAUSE_WHILE_MINIMIZED("false"),
UI_TOKENS_IN_SEPARATE_ROW("false"), // Display tokens in their own battlefield row.
UI_DISPLAY_CURRENT_COLORS("Never"),
UI_DISPLAY_CURRENT_COLORS(ForgeConstants.DISP_CURRENT_COLORS_NEVER),
UI_FILTER_LANDS_BY_COLOR_IDENTITY("true"),
UI_ALLOW_ESC_TO_END_TURN ("false"),
UI_PRESELECT_PREVIOUS_ABILITY_ORDER ("false"),
UI_AUTO_YIELD_MODE (ForgeConstants.AUTO_YIELD_PER_ABILITY),
UI_FOR_TOUCHSCREN("false"),