Fixed bloated error messages on commander deck check;

This commit is contained in:
Oleg Agafonov 2019-05-27 16:18:20 +04:00
parent 07cf5201ba
commit 2f04a0d979
3 changed files with 17 additions and 6 deletions

View file

@ -166,6 +166,12 @@ public class Commander extends Constructed {
} }
} }
} }
// no needs in cards check on wrong commanders
if (!valid) {
return false;
}
for (Card card : deck.getCards()) { for (Card card : deck.getCards()) {
if (!cardHasValidColor(colorIdentity, card)) { if (!cardHasValidColor(colorIdentity, card)) {
invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')'); invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')');

View file

@ -67,8 +67,6 @@ public class FreeformCommander extends Constructed {
} }
} }
generateFreeformHash();
if (deck.getSideboard().size() < 1 || deck.getSideboard().size() > 2) { if (deck.getSideboard().size() < 1 || deck.getSideboard().size() > 2) {
invalid.put("Commander", "Sideboard must contain only the commander(s)"); invalid.put("Commander", "Sideboard must contain only the commander(s)");
valid = false; valid = false;
@ -116,6 +114,11 @@ public class FreeformCommander extends Constructed {
} }
} }
// no needs in cards check on wrong commanders
if (!valid) {
return false;
}
for (Card card : deck.getCards()) { for (Card card : deck.getCards()) {
if (!cardHasValidColor(colorIdentity, card)) { if (!cardHasValidColor(colorIdentity, card)) {
invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')'); invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')');
@ -142,8 +145,4 @@ public class FreeformCommander extends Constructed {
|| cardColor.isRed() && !commander.isRed() || cardColor.isRed() && !commander.isRed()
|| cardColor.isWhite() && !commander.isWhite()); || cardColor.isWhite() && !commander.isWhite());
} }
public void generateFreeformHash() {
return;
}
} }

View file

@ -124,6 +124,12 @@ public class PennyDreadfulCommander extends Constructed {
} }
} }
} }
// no needs in cards check on wrong commanders
if (!valid) {
return false;
}
for (Card card : deck.getCards()) { for (Card card : deck.getCards()) {
if (!cardHasValidColor(colorIdentity, card)) { if (!cardHasValidColor(colorIdentity, card)) {
invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')'); invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')');