mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
[ZNR] Added images download for modal double faces cards (#7012)
This commit is contained in:
parent
a73c9bddae
commit
c60bf3ccef
4 changed files with 21 additions and 7 deletions
|
@ -86,9 +86,9 @@ public enum ScryfallImageSource implements CardImageSource {
|
|||
}
|
||||
}
|
||||
|
||||
// double faced card
|
||||
// double faced cards (modal double faces cards too)
|
||||
// the front face can be downloaded normally
|
||||
// the back face is prepared beforehand
|
||||
// the back face is prepared before hand
|
||||
if (baseUrl == null && card.isTwoFacedCard() && !card.isSecondSide()) {
|
||||
baseUrl = "https://api.scryfall.com/cards/" + formatSetName(card.getSet(), isToken) + "/"
|
||||
+ card.getCollectorId() + "/" + localizedCode + "?format=image";
|
||||
|
|
|
@ -449,12 +449,30 @@ public class DownloadPicturesService extends DefaultBoundedRangeModel implements
|
|||
if (card.getFlipCardName() == null || card.getFlipCardName().trim().isEmpty()) {
|
||||
throw new IllegalStateException("Flipped card can't have empty name.");
|
||||
}
|
||||
CardDownloadData cardDownloadData = new CardDownloadData(card.getFlipCardName(), card.getSetCode(), card.getCardNumber(), card.usesVariousArt(), 0, "", "", false, card.isDoubleFaced(), card.isNightCard());
|
||||
CardDownloadData cardDownloadData = new CardDownloadData(
|
||||
card.getFlipCardName(),
|
||||
card.getSetCode(),
|
||||
card.getCardNumber(),
|
||||
card.usesVariousArt(),
|
||||
0, "", "", false, card.isDoubleFaced(), card.isNightCard());
|
||||
cardDownloadData.setFlipCard(true);
|
||||
cardDownloadData.setFlippedSide(true);
|
||||
cardDownloadData.setType2(isType2);
|
||||
allCardsUrls.add(cardDownloadData);
|
||||
}
|
||||
if (card.isModalDoubleFacesCard()) {
|
||||
if (card.getModalDoubleFacesSecondSideName() == null || card.getModalDoubleFacesSecondSideName().trim().isEmpty()) {
|
||||
throw new IllegalStateException("MDF card can't have empty name.");
|
||||
}
|
||||
CardDownloadData cardDownloadData = new CardDownloadData(
|
||||
card.getModalDoubleFacesSecondSideName(),
|
||||
card.getSetCode(),
|
||||
card.getCardNumber(),
|
||||
card.usesVariousArt(),
|
||||
0, "", "", false, true, true);
|
||||
cardDownloadData.setType2(isType2);
|
||||
allCardsUrls.add(cardDownloadData);
|
||||
}
|
||||
} else if (card.getCardNumber().isEmpty() || "0".equals(card.getCardNumber())) {
|
||||
logger.error("Card has no collector ID and won't be sent to client: " + card.getName());
|
||||
} else if (card.getSetCode().isEmpty()) {
|
||||
|
|
|
@ -58,8 +58,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
protected String flipCardName;
|
||||
protected boolean usesVariousArt = false;
|
||||
protected boolean morphCard;
|
||||
protected boolean modalDFC; // modal double faces card
|
||||
|
||||
protected List<UUID> attachments = new ArrayList<>();
|
||||
|
||||
public CardImpl(UUID ownerId, CardSetInfo setInfo, CardType[] cardTypes, String costs) {
|
||||
|
@ -139,7 +137,6 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
flipCardName = card.flipCardName;
|
||||
usesVariousArt = card.usesVariousArt;
|
||||
morphCard = card.morphCard;
|
||||
modalDFC = card.modalDFC;
|
||||
|
||||
this.attachments.addAll(card.attachments);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ public abstract class ModalDoubleFacesCard extends CardImpl {
|
|||
typesLeft, subTypesLeft, costsLeft, this, SpellAbilityType.MODAL_LEFT);
|
||||
rightHalfCard = new ModalDoubleFacesCardHalfImpl(this.getOwnerId(), new CardSetInfo(secondSideName, setInfo.getExpansionSetCode(), setInfo.getCardNumber(), setInfo.getRarity(), setInfo.getGraphicInfo()),
|
||||
typesRight, subTypesRight, costsRight, this, SpellAbilityType.MODAL_RIGHT);
|
||||
this.modalDFC = true;
|
||||
}
|
||||
|
||||
public ModalDoubleFacesCard(ModalDoubleFacesCard card) {
|
||||
|
|
Loading…
Reference in a new issue