Deck format checkbox also disables checks for limited and quest modes

This commit is contained in:
Maxmtg
2013-01-20 19:43:32 +00:00
parent f3e384e890
commit 1c70a038ef
3 changed files with 17 additions and 14 deletions

View File

@@ -7194,15 +7194,13 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!this.isInZone(realZone)) { if (!this.isInZone(realZone)) {
return false; return false;
} }
} else if (property.equals("ChosenType")) {
if (!this.isType(source.getChosenType())) {
return false;
}
} else { } else {
if (property.equals("ChosenType")) { if (!this.isType(property)) {
if (!this.isType(source.getChosenType())) { return false;
return false;
}
} else {
if (!this.isType(property)) {
return false;
}
} }
} }
return true; return true;

View File

@@ -23,9 +23,11 @@ import java.util.Map.Entry;
import org.apache.commons.lang.math.IntRange; import org.apache.commons.lang.math.IntRange;
import forge.Singletons;
import forge.card.CardCoreType; import forge.card.CardCoreType;
import forge.item.CardDb; import forge.item.CardDb;
import forge.item.CardPrinted; import forge.item.CardPrinted;
import forge.properties.ForgePreferences.FPref;
import forge.util.Aggregates; import forge.util.Aggregates;
/** /**
@@ -109,6 +111,11 @@ public enum DeckFormat {
@SuppressWarnings("incomplete-switch") @SuppressWarnings("incomplete-switch")
public String getDeckConformanceProblem(Deck deck) { public String getDeckConformanceProblem(Deck deck) {
// That's really a bad dependence
if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) {
return null;
}
int deckSize = deck.getMain().countAll(); int deckSize = deck.getMain().countAll();
int min = getMainRange().getMinimumInteger(); int min = getMainRange().getMinimumInteger();

View File

@@ -98,12 +98,10 @@ public enum CSubmenuConstructed implements ICDoc {
private void startGame(final GameType gameType) { private void startGame(final GameType gameType) {
Deck humanDeck = VSubmenuConstructed.SINGLETON_INSTANCE.getDcHuman().getDeck(); Deck humanDeck = VSubmenuConstructed.SINGLETON_INSTANCE.getDcHuman().getDeck();
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.ENFORCE_DECK_LEGALITY)) { String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(humanDeck);
String errorMessage = gameType.getDecksFormat().getDeckConformanceProblem(humanDeck); if (null != errorMessage) {
if (null != errorMessage) { JOptionPane.showMessageDialog(null, "Your deck " + errorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null, "Your deck " + errorMessage, "Invalid deck", JOptionPane.ERROR_MESSAGE); return;
return;
}
} }
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {