From b65c1180e44b5ca88ba43c8b88a8b0d170681036 Mon Sep 17 00:00:00 2001 From: spjspj Date: Thu, 16 Feb 2017 08:06:23 +1100 Subject: [PATCH] Limit deck to 1000 cards --- Mage/src/main/java/mage/cards/decks/Deck.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Mage/src/main/java/mage/cards/decks/Deck.java b/Mage/src/main/java/mage/cards/decks/Deck.java index 7af38ed879..049ec0b7a1 100644 --- a/Mage/src/main/java/mage/cards/decks/Deck.java +++ b/Mage/src/main/java/mage/cards/decks/Deck.java @@ -86,11 +86,15 @@ public class Deck implements Serializable { deck.cardsLayout = deckCardLists.getCardLayout(); deck.sideboardLayout = deckCardLists.getSideboardLayout(); List deckCardNames = new ArrayList<>(); + int totalCards = 0; for (DeckCardInfo deckCardInfo : deckCardLists.getCards()) { Card card = createCard(deckCardInfo, mockCards); if (card != null) { - deck.cards.add(card); - deckCardNames.add(card.getName()); + if (totalCards < 1000) { + deck.cards.add(card); + deckCardNames.add(card.getName()); + totalCards++; + } } else if (!ignoreErrors) { throw createCardNotFoundGameException(deckCardInfo, deckCardLists.getName()); } @@ -99,8 +103,11 @@ public class Deck implements Serializable { for (DeckCardInfo deckCardInfo : deckCardLists.getSideboard()) { Card card = createCard(deckCardInfo, mockCards); if (card != null) { - deck.sideboard.add(card); - sbCardNames.add(card.getName()); + if (totalCards < 1000) { + deck.sideboard.add(card); + sbCardNames.add(card.getName()); + totalCards++; + } } else if (!ignoreErrors) { throw createCardNotFoundGameException(deckCardInfo, deckCardLists.getName()); }