Basic groundwork for extra decks (contraptions, attractions) (#10378)

* extra deck cards not counted in deck size

* extra deck handling in deckbuilder

* move responsibility for extraDeckCard boolean to CardImpl

* remove redundant field copy
This commit is contained in:
Artemis Kearney 2023-08-06 20:06:32 -05:00 committed by GitHub
parent 978ebfc873
commit 9ba0da00ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 97 additions and 47 deletions

View file

@ -77,8 +77,8 @@ public final class DeckBuilder {
addCardsToDeck(remainingCards, min, max, deckCount[index]);
min = max + 1;
}
addCardsToDeck(remainingCards, 0, 4, deckSpells - deck.getCards().size());
addCardsToDeck(remainingCards, 5, 10, deckSpells - deck.getCards().size());
addCardsToDeck(remainingCards, 0, 4, deckSpells - deck.getMaindeckCards().size());
addCardsToDeck(remainingCards, 5, 10, deckSpells - deck.getMaindeckCards().size());
addLandsToDeck(allowedColors, setsToUse, landCardPool, callback);
Deck returnedDeck = deck;
@ -174,7 +174,7 @@ public final class DeckBuilder {
}
// Add optimal basic lands to deck.
while (deck.getCards().size() < deckSize) {
while (deck.getMaindeckCards().size() < deckSize) {
ColoredManaSymbol bestColor = null;
//Default to a color in the allowed colors
if (allowedColors != null && !allowedColors.isEmpty()) {

View file

@ -88,6 +88,7 @@ public class CardView extends SimpleCardView {
protected CardView ability;
protected int imageNumber;
protected boolean extraDeckCard;
protected boolean transformable; // can toggle one card side to another (transformable cards, modal double faces)
protected CardView secondCardFace;
protected boolean transformed;
@ -198,6 +199,7 @@ public class CardView extends SimpleCardView {
this.isToken = cardView.isToken;
this.ability = cardView.ability; // reference, not copy
this.extraDeckCard = cardView.extraDeckCard;
this.transformable = cardView.transformable;
this.secondCardFace = cardView.secondCardFace == null ? null : new CardView(cardView.secondCardFace);
this.transformed = cardView.transformed;
@ -500,6 +502,8 @@ public class CardView extends SimpleCardView {
this.isToken = false;
}
this.extraDeckCard = card.isExtraDeckCard();
// transformable, double faces cards
this.transformable = card.isTransformable();
@ -1246,6 +1250,9 @@ public class CardView extends SimpleCardView {
return typeText.toString();
}
public boolean isExtraDeckCard() {
return this.extraDeckCard;
}
public boolean isLand() {
return cardTypes.contains(CardType.LAND);
}