From 2f04a0d979b17669dbbaf386c6f1978f5a44b693 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Mon, 27 May 2019 16:18:20 +0400 Subject: [PATCH] Fixed bloated error messages on commander deck check; --- .../src/mage/deck/Commander.java | 6 ++++++ .../src/mage/deck/FreeformCommander.java | 11 +++++------ .../src/mage/deck/PennyDreadfulCommander.java | 6 ++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java index d944f8068f..720de03ebf 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Commander.java @@ -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()) { if (!cardHasValidColor(colorIdentity, card)) { invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')'); diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/FreeformCommander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/FreeformCommander.java index 5e2ce9b0d2..4a066bf665 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/FreeformCommander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/FreeformCommander.java @@ -67,8 +67,6 @@ public class FreeformCommander extends Constructed { } } - generateFreeformHash(); - if (deck.getSideboard().size() < 1 || deck.getSideboard().size() > 2) { invalid.put("Commander", "Sideboard must contain only the commander(s)"); 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()) { if (!cardHasValidColor(colorIdentity, card)) { invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')'); @@ -142,8 +145,4 @@ public class FreeformCommander extends Constructed { || cardColor.isRed() && !commander.isRed() || cardColor.isWhite() && !commander.isWhite()); } - - public void generateFreeformHash() { - return; - } } diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/PennyDreadfulCommander.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/PennyDreadfulCommander.java index 6479df83be..2e8acf10d8 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/PennyDreadfulCommander.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/PennyDreadfulCommander.java @@ -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()) { if (!cardHasValidColor(colorIdentity, card)) { invalid.put(card.getName(), "Invalid color (" + colorIdentity.toString() + ')');