mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Limit deck to 1000 cards
This commit is contained in:
parent
9b8f1b3d5c
commit
b65c1180e4
1 changed files with 11 additions and 4 deletions
|
@ -86,11 +86,15 @@ public class Deck implements Serializable {
|
||||||
deck.cardsLayout = deckCardLists.getCardLayout();
|
deck.cardsLayout = deckCardLists.getCardLayout();
|
||||||
deck.sideboardLayout = deckCardLists.getSideboardLayout();
|
deck.sideboardLayout = deckCardLists.getSideboardLayout();
|
||||||
List<String> deckCardNames = new ArrayList<>();
|
List<String> deckCardNames = new ArrayList<>();
|
||||||
|
int totalCards = 0;
|
||||||
for (DeckCardInfo deckCardInfo : deckCardLists.getCards()) {
|
for (DeckCardInfo deckCardInfo : deckCardLists.getCards()) {
|
||||||
Card card = createCard(deckCardInfo, mockCards);
|
Card card = createCard(deckCardInfo, mockCards);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
if (totalCards < 1000) {
|
||||||
deck.cards.add(card);
|
deck.cards.add(card);
|
||||||
deckCardNames.add(card.getName());
|
deckCardNames.add(card.getName());
|
||||||
|
totalCards++;
|
||||||
|
}
|
||||||
} else if (!ignoreErrors) {
|
} else if (!ignoreErrors) {
|
||||||
throw createCardNotFoundGameException(deckCardInfo, deckCardLists.getName());
|
throw createCardNotFoundGameException(deckCardInfo, deckCardLists.getName());
|
||||||
}
|
}
|
||||||
|
@ -99,8 +103,11 @@ public class Deck implements Serializable {
|
||||||
for (DeckCardInfo deckCardInfo : deckCardLists.getSideboard()) {
|
for (DeckCardInfo deckCardInfo : deckCardLists.getSideboard()) {
|
||||||
Card card = createCard(deckCardInfo, mockCards);
|
Card card = createCard(deckCardInfo, mockCards);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
if (totalCards < 1000) {
|
||||||
deck.sideboard.add(card);
|
deck.sideboard.add(card);
|
||||||
sbCardNames.add(card.getName());
|
sbCardNames.add(card.getName());
|
||||||
|
totalCards++;
|
||||||
|
}
|
||||||
} else if (!ignoreErrors) {
|
} else if (!ignoreErrors) {
|
||||||
throw createCardNotFoundGameException(deckCardInfo, deckCardLists.getName());
|
throw createCardNotFoundGameException(deckCardInfo, deckCardLists.getName());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue