- 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

@@ -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"),