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,8 +7194,7 @@ public class Card extends GameEntity implements Comparable<Card> {
if (!this.isInZone(realZone)) {
return false;
}
} else {
if (property.equals("ChosenType")) {
} else if (property.equals("ChosenType")) {
if (!this.isType(source.getChosenType())) {
return false;
}
@@ -7204,7 +7203,6 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
}
}
return true;
} // hasProperty

View File

@@ -23,9 +23,11 @@ import java.util.Map.Entry;
import org.apache.commons.lang.math.IntRange;
import forge.Singletons;
import forge.card.CardCoreType;
import forge.item.CardDb;
import forge.item.CardPrinted;
import forge.properties.ForgePreferences.FPref;
import forge.util.Aggregates;
/**
@@ -109,6 +111,11 @@ public enum DeckFormat {
@SuppressWarnings("incomplete-switch")
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 min = getMainRange().getMinimumInteger();

View File

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