Merge branch 'performancemode' into 'master'

Bandaid temporary performance preference to disable additional static abilities…

See merge request core-developers/forge!558
This commit is contained in:
Michael Kamensky
2018-05-16 04:43:30 +00:00
6 changed files with 26 additions and 2 deletions

View File

@@ -44,6 +44,12 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
/** Constant <code>serialVersionUID=-7930920571482203460L</code>. */
private static final long serialVersionUID = -7930920571482203460L;
private static boolean performanceMode = false;
public static void setPerformanceMode(boolean performanceMode){
Spell.performanceMode=performanceMode;
}
private boolean castFaceDown = false;
/**
@@ -116,14 +122,14 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
lkicheck = true;
}
if (lkicheck) {
if (!Spell.performanceMode && lkicheck) {
game.getAction().checkStaticAbilities(false, Sets.newHashSet(card), new CardCollection(card));
}
flash = card.withFlash(activator);
// reset static abilities
if (lkicheck) {
if (!Spell.performanceMode && lkicheck) {
game.getAction().checkStaticAbilities(false);
}

View File

@@ -100,6 +100,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbSmallDeckViewer(), FPref.UI_SMALL_DECK_VIEWER));
lstControls.add(Pair.of(view.getCbRandomArtInPools(), FPref.UI_RANDOM_ART_IN_POOLS));
lstControls.add(Pair.of(view.getCbEnforceDeckLegality(), FPref.ENFORCE_DECK_LEGALITY));
lstControls.add(Pair.of(view.getCbPerformanceMode(), FPref.PERFORMANCE_MODE));
lstControls.add(Pair.of(view.getCbCloneImgSource(), FPref.UI_CLONE_MODE_SOURCE));
lstControls.add(Pair.of(view.getCbRemoveSmall(), FPref.DECKGEN_NOSMALL));
lstControls.add(Pair.of(view.getCbCardBased(), FPref.DECKGEN_CARDBASED));

View File

@@ -68,6 +68,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbLoadHistoricFormats = new OptionsCheckBox("Load Historic Formats");
private final JCheckBox cbWorkshopSyntax = new OptionsCheckBox("Workshop Syntax Checker");
private final JCheckBox cbEnforceDeckLegality = new OptionsCheckBox("Deck Conformance");
private final JCheckBox cbPerformanceMode = new OptionsCheckBox("Performance Mode");
private final JCheckBox cbImageFetcher = new OptionsCheckBox("Automatically Download Missing Card Art");
private final JCheckBox cbCloneImgSource = new OptionsCheckBox("Clones Use Original Card Art");
private final JCheckBox cbScaleLarger = new OptionsCheckBox("Scale Image Larger");
@@ -171,6 +172,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbEnforceDeckLegality, titleConstraints);
pnlPrefs.add(new NoteLabel("Enforces deck legality relevant to each environment (minimum deck sizes, max card count etc)."), descriptionConstraints);
pnlPrefs.add(cbPerformanceMode, titleConstraints);
pnlPrefs.add(new NoteLabel("Disables additional static abilities checks to speed up the game engine. (Warning: breaks some 'as if had flash' scenarios when casting cards owned by opponents)."), descriptionConstraints);
pnlPrefs.add(cbCloneImgSource, titleConstraints);
pnlPrefs.add(new NoteLabel("When enabled clones will use their original art instead of the cloned card's art."), descriptionConstraints);
@@ -632,6 +636,11 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbEnforceDeckLegality;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbPerformanceMode() {
return cbPerformanceMode;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbCloneImgSource() {
return cbCloneImgSource;

View File

@@ -113,6 +113,10 @@ public class SettingsPage extends TabPage<SettingsScreen> {
"Deck Conformance",
"Enforces deck legality relevant to each environment (minimum deck sizes, max card count etc)."),
1);
lstSettings.addItem(new BooleanSetting(FPref.PERFORMANCE_MODE,
"Performance Mode",
"Disables additional static abilities checks to speed up the game engine. (Warning: breaks some 'as if had flash' scenarios when casting cards owned by opponents)."),
1);
lstSettings.addItem(new BooleanSetting(FPref.UI_CLONE_MODE_SOURCE,
"Clones Use Original Card Art",
"When enabled clones will use their original art instead of the cloned card's art."),

View File

@@ -32,6 +32,7 @@ import forge.deck.io.DeckPreferences;
import forge.game.GameFormat;
import forge.game.GameType;
import forge.game.card.CardUtil;
import forge.game.spellability.Spell;
import forge.gauntlet.GauntletData;
import forge.interfaces.IProgressBar;
import forge.itemmanager.ItemManagerConfig;
@@ -184,6 +185,8 @@ public final class FModel {
standardWorlds.putAll(customWorlds);
worlds = new StorageBase<>("Quest worlds", null, standardWorlds);
Spell.setPerformanceMode(preferences.getPrefBoolean(FPref.PERFORMANCE_MODE));
loadDynamicGamedata();
if (progressBar != null) {

View File

@@ -153,6 +153,7 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
SUBMENU_UTILITIES ("false"),
ENFORCE_DECK_LEGALITY ("true"),
PERFORMANCE_MODE ("false"),
DEV_MODE_ENABLED ("false"),
DEV_WORKSHOP_SYNTAX ("false"),