mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
CardEdition: add collector number for other (#7504)
* CardEdition: add collector number for other * EditionEntry record * Add getOtherImageKey * Update StaticData.java * use getOtherImageKey in getFacedownImageKey * Update CardEdition.java Remove findOther in favor of getOtherSet * Update CardEdition.java return findOther, but with Aggregates.random * ~ move more helper images to ImageKeys
This commit is contained in:
@@ -25,7 +25,7 @@ import java.util.Set;
|
||||
|
||||
import forge.card.CardDb;
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.CardEdition.CardInSet;
|
||||
import forge.card.CardEdition.EditionEntry;
|
||||
import forge.deck.generation.DeckGenPool;
|
||||
import forge.game.GameType;
|
||||
import forge.item.PaperCard;
|
||||
@@ -192,9 +192,9 @@ public class ConquestPlane {
|
||||
for (String setCode : setCodes) {
|
||||
CardEdition edition = FModel.getMagicDb().getEditions().get(setCode);
|
||||
if (edition != null) {
|
||||
for (CardInSet card : edition.getAllCardsInSet()) {
|
||||
if (bannedCardSet == null || !bannedCardSet.contains(card.name)) {
|
||||
addCard(commonCards.getCard(card.name, setCode));
|
||||
for (EditionEntry card : edition.getAllCardsInSet()) {
|
||||
if (bannedCardSet == null || !bannedCardSet.contains(card.name())) {
|
||||
addCard(commonCards.getCard(card.name(), setCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import forge.card.CardEdition;
|
||||
import forge.card.CardEdition.CardInSet;
|
||||
import forge.card.CardEdition.EditionEntry;
|
||||
import forge.card.CardRarity;
|
||||
import forge.deck.Deck;
|
||||
import forge.deck.DeckGroup;
|
||||
@@ -445,9 +445,9 @@ public class QuestEventDraft implements IQuestEvent {
|
||||
final List<String> cardNames = new ArrayList<>();
|
||||
|
||||
for (final CardEdition edition : getAllEditions()) {
|
||||
for (final CardInSet card : edition.getAllCardsInSet()) {
|
||||
if (card.rarity == CardRarity.Rare || card.rarity == CardRarity.MythicRare) {
|
||||
final PaperCard cardToAdd = FModel.getMagicDb().getCommonCards().getCard(card.name, edition.getCode());
|
||||
for (final EditionEntry card : edition.getAllCardsInSet()) {
|
||||
if (card.rarity() == CardRarity.Rare || card.rarity() == CardRarity.MythicRare) {
|
||||
final PaperCard cardToAdd = FModel.getMagicDb().getCommonCards().getCard(card.name(), edition.getCode());
|
||||
if (cardToAdd != null && !cardNames.contains(cardToAdd.getName())) {
|
||||
possibleCards.add(cardToAdd);
|
||||
cardNames.add(cardToAdd.getName());
|
||||
@@ -468,26 +468,26 @@ public class QuestEventDraft implements IQuestEvent {
|
||||
private PaperCard getPromoCard() {
|
||||
|
||||
final CardEdition randomEdition = getRandomEdition();
|
||||
final List<CardInSet> cardsInEdition = new ArrayList<>();
|
||||
final List<EditionEntry> cardsInEdition = new ArrayList<>();
|
||||
final List<String> cardNames = new ArrayList<>();
|
||||
|
||||
for (final CardInSet card : randomEdition.getAllCardsInSet()) {
|
||||
if (card.rarity == CardRarity.Rare || card.rarity == CardRarity.MythicRare) {
|
||||
if (!cardNames.contains(card.name)) {
|
||||
for (final EditionEntry card : randomEdition.getAllCardsInSet()) {
|
||||
if (card.rarity() == CardRarity.Rare || card.rarity() == CardRarity.MythicRare) {
|
||||
if (!cardNames.contains(card.name())) {
|
||||
cardsInEdition.add(card);
|
||||
cardNames.add(card.name);
|
||||
cardNames.add(card.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CardInSet randomCard;
|
||||
EditionEntry randomCard;
|
||||
PaperCard promo = null;
|
||||
|
||||
int attempts = 25;
|
||||
|
||||
while (promo == null && attempts-- > 0) {
|
||||
randomCard = cardsInEdition.get((int) (MyRandom.getRandom().nextDouble() * cardsInEdition.size()));
|
||||
promo = FModel.getMagicDb().getCommonCards().getCard(randomCard.name, randomEdition.getCode());
|
||||
promo = FModel.getMagicDb().getCommonCards().getCard(randomCard.name(), randomEdition.getCode());
|
||||
}
|
||||
|
||||
if (promo == null) {
|
||||
|
||||
@@ -249,7 +249,7 @@ public abstract class ImageFetcher {
|
||||
if (edition == null || edition.getType() == CardEdition.Type.CUSTOM_SET) return; //Custom set token, skip fetching.
|
||||
|
||||
//PaperToken pt = StaticData.instance().getAllTokens().getToken(tokenName, setCode);
|
||||
Collection<CardEdition.TokenInSet> allTokens = edition.getTokens().get(tokenName);
|
||||
Collection<CardEdition.EditionEntry> allTokens = edition.getTokens().get(tokenName);
|
||||
|
||||
if (!allTokens.isEmpty()) {
|
||||
// This loop is going to try to download all the arts until it finds one
|
||||
@@ -258,17 +258,17 @@ public abstract class ImageFetcher {
|
||||
// Ideally we would have some mapping for generating card to determine which art indexed/collector number to try to fetch
|
||||
// Token art we're downloading and which location we're storing it in.
|
||||
// Once we're pulling from PaperTokens this section will change a bit
|
||||
Iterator <CardEdition.TokenInSet> it = allTokens.iterator();
|
||||
CardEdition.TokenInSet tis;
|
||||
Iterator <CardEdition.EditionEntry> it = allTokens.iterator();
|
||||
CardEdition.EditionEntry tis;
|
||||
while(it.hasNext()) {
|
||||
tis = it.next();
|
||||
String tokenCode = edition.getTokensCode();
|
||||
String langCode = edition.getCardsLangCode();
|
||||
if (tis.collectorNumber == null || tis.collectorNumber.isEmpty()) {
|
||||
if (tis.collectorNumber() == null || tis.collectorNumber().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
downloadUrls.add(ForgeConstants.URL_PIC_SCRYFALL_DOWNLOAD + ImageUtil.getScryfallTokenDownloadUrl(tis.collectorNumber, tokenCode, langCode));
|
||||
downloadUrls.add(ForgeConstants.URL_PIC_SCRYFALL_DOWNLOAD + ImageUtil.getScryfallTokenDownloadUrl(tis.collectorNumber(), tokenCode, langCode));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user