Fix Meld cards fetch (#7981)

* BOM

* ANB Update

* J25 Update

* SIR update

* Mend

* Find the right back for meld cards

* ANB Update

* J25 Update

* SIR update

* Mend

* Find the right back for meld cards

* Update PW25

* Update SPG

* Typo

* Update ACR

* Update CMM

* Add PFDN and Invasion alternate arts

* Update MKM

* Update NPH

* J25 -> J22 for non-existing cards

* Update WOC

* Update HBG

* Use printsheet

* Use helper functions
This commit is contained in:
Eradev
2025-08-18 08:31:33 -04:00
committed by GitHub
parent 0b89e9d137
commit 11d10a8129
15 changed files with 106 additions and 44 deletions

View File

@@ -21,6 +21,7 @@ import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimaps;
import forge.ImageKeys;
import forge.StaticData;
import forge.card.CardEdition.EditionEntry;
import forge.card.CardEdition.Type;
@@ -241,8 +242,8 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
setCode = info[index];
index++;
}
if(info.length > index && isArtIndex(info[index])) {
artIndex = Integer.parseInt(info[index]);
if(info.length > index && isArtIndex(info[index].replace(ImageKeys.BACKFACE_POSTFIX, ""))) {
artIndex = Integer.parseInt(info[index].replace(ImageKeys.BACKFACE_POSTFIX, ""));
index++;
}
if(info.length > index && isCollectorNumber(info[index])) {

View File

@@ -154,6 +154,31 @@ public class PaperCard implements Comparable<IPaperCard>, InventoryItemFromSet,
return this.noSellVersion;
}
public PaperCard getMeldBaseCard() {
if (getRules().getSplitType() != CardSplitType.Meld) {
return null;
}
// This is the base part of the meld duo
if (getRules().getOtherPart() == null) {
return this;
}
String meldWith = getRules().getMeldWith();
if (meldWith == null) {
return null;
}
List<PrintSheet> sheets = StaticData.instance().getCardEdition(this.edition).getPrintSheetsBySection();
for (PrintSheet sheet : sheets) {
if (sheet.contains(this)) {
return sheet.find(PaperCardPredicates.name(meldWith));
}
}
return null;
}
public PaperCard copyWithoutFlags() {
if(this.flaglessVersion == null) {
if(this.flags == PaperCardFlags.IDENTITY_FLAGS)

View File

@@ -231,7 +231,27 @@ public class ImageUtil {
}
String versionParam = useArtCrop ? "art_crop" : "normal";
String faceParam = "";
if (cp.getRules().getOtherPart() != null) {
if (cp.getRules().getSplitType() == CardSplitType.Meld) {
if (face.equals("back")) {
PaperCard meldBasePc = cp.getMeldBaseCard();
cardCollectorNumber = meldBasePc.getCollectorNumber();
String collectorNumberSuffix = "";
if (cardCollectorNumber.endsWith("a")) {
cardCollectorNumber = cardCollectorNumber.substring(0, cardCollectorNumber.length() - 1);
} else if (cardCollectorNumber.endsWith("as")) {
cardCollectorNumber = cardCollectorNumber.substring(0, cardCollectorNumber.length() - 2);
collectorNumberSuffix = "s";
} else if (cardCollectorNumber.endsWith("ap")) {
cardCollectorNumber = cardCollectorNumber.substring(0, cardCollectorNumber.length() - 2);
collectorNumberSuffix = "p";
}
cardCollectorNumber += "b" + collectorNumberSuffix;
}
faceParam = "&face=front";
} else if (cp.getRules().getOtherPart() != null) {
faceParam = (face.equals("back") && cp.getRules().getSplitType() != CardSplitType.Flip
? "&face=back"
: "&face=front");

View File

@@ -1051,7 +1051,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
// it was always created), adjust threshold based on its existence.
int threshold = states.containsKey(CardStateName.FaceDown) ? 2 : 1;
int numStates = states.keySet().size();
int numStates = states.size();
return numStates > threshold;
}

View File

@@ -7444,8 +7444,8 @@ Gandalf the White|LTR
1 Reckless Amplimancer|J25
1 Defend the Celestus|J25
1 Snakeskin Veil|J25
1 Cultivate|J25
1 Declare Dominance|J25
1 Cultivate|J22
1 Declare Dominance|J22
1 Audacity|J25
1 Warbriar Blessing|J25
1 Wolfrider's Saddle|J25

View File

@@ -13,7 +13,7 @@ ScryfallCode=HBG
1 R Klement, Novice Acolyte @Maria Poliakova
2 R Lae'zel, Githyanki Warrior @John Stanko
3 U Lulu, Forgetful Hollyphant @Jakob Eirich
4 U Rasaad, Monk of Selûne @Dan Scott
4 U Rasaad, Monk of Selûne @Dan Murayama Scott
5 U Alora, Rogue Companion @Aaron Miller
6 M Gale, Conduit of the Arcane @Cristi Balanescu
7 R Imoen, Trickster Friend @Alix Branwyn
@@ -276,26 +276,26 @@ ScryfallCode=HBG
264 C Prophetic Prism @Diego Gisbert
265 C Spiked Pit Trap @Deruchenko Alexander
266 R Baldur's Gate @Titus Lunter
267 L Plains @Bruce Brenneise
268 L Plains @Leanna Crossan
269 L Plains @Titus Lunter
270 L Plains @Emmanuel Shiu
271 L Island @Bruce Brenneise
272 L Island @Piotr Dura
273 L Island @James Paick
274 L Island @Sam White
275 L Swamp @Piotr Dura
276 L Swamp @Logan Feliciano
277 L Swamp @Grady Frederick
278 L Swamp @Sam White
279 L Mountain @Matt Gaser
280 L Mountain @Lucas Graciano
281 L Mountain @Muhammad Firdaus
282 L Mountain @Sam White
283 L Forest @Bruce Brenneise
284 L Forest @Muhammad Firdaus
285 L Forest @Lucas Graciano
286 L Forest @Julian Kok Joon Wen
289 L Plains @Bruce Brenneise
290 L Plains @Leanna Crossan
291 L Plains @Titus Lunter
292 L Plains @Emmanuel Shiu
293 L Island @Bruce Brenneise
294 L Island @Piotr Dura
295 L Island @James Paick
296 L Island @Sam White
297 L Swamp @Piotr Dura
298 L Swamp @Logan Feliciano
299 L Swamp @Grady Frederick
300 L Swamp @Sam White
301 L Mountain @Matt Gaser
302 L Mountain @Lucas Graciano
303 L Mountain @Muhammad Firdaus
304 L Mountain @Sam White
305 L Forest @Bruce Brenneise
306 L Forest @Muhammad Firdaus
307 L Forest @Lucas Graciano
308 L Forest @Julian Kok Joon Wen
[rebalanced]
A85 C A-Blessed Hippogriff @Leanna Crossan

View File

@@ -2,7 +2,6 @@
Code=EMN
Date=2016-07-22
Name=Eldritch Moon
Code2=EMN
Type=Expansion
BoosterCovers=3
Booster=9 Common:!dfc, 3 Uncommon:!dfc, 1 RareMythic:!dfc, 1 dfc:!Rare:!Mythic, 1 BasicLand SOI

View File

@@ -578,7 +578,7 @@ ScryfallCode=J25
571 C Kindled Fury @Craig J Spearing
572 R Krenko, Tin Street Kingpin @Viko Menezes
573 C Kruin Striker @Christopher Moeller
574 R Markov Blademaster @Jana Schirmer
574 R Markov Blademaster @Jana Schirmer & Johannes Voss
575 R Markov Enforcer @Wisnu Tan
576 U Markov Retribution @Uriah Voth
577 U Markov Warlord @Cynthia Sheppard

View File

@@ -0,0 +1,9 @@
[metadata]
Code=PFDN
Date=2024-11-15
Name=Foundations Promos
Type=Promo
ScryfallCode=PFDN
[cards]
1 R Sol Ring @Mike Bierek

View File

@@ -53,7 +53,7 @@ Replace=.04 Mythic:fromSheet("INR cards")
11 M Archangel Avacyn @James Ryman
12 C Avacynian Priest @Greg Staples
13 C Bound by Moonsilver @Joseph Meehan
14 R Bruna, the Fading Light @Clint Cearley
14a R Bruna, the Fading Light @Clint Cearley
15 C Cathar Commando @Evyn Fong
16 U Cathar's Call @Matt Stewart
17 R Cathars' Crusade @Karl Kopinski
@@ -196,7 +196,7 @@ Replace=.04 Mythic:fromSheet("INR cards")
154 U Fiery Temper @Johannes Voss
155 U Furyblade Vampire @Lius Lasahido
156 U Geier Reach Bandit @Slawomir Maniak
157 R Hanweir Garrison @Vincent Proce
157a R Hanweir Garrison @Vincent Proce
158 C Hanweir Watchkeep @Wayne Reynolds
159 U Honeymoon Hearse @Raoul Vitale
160 C Hungry Ridgewolf @Olena Richards

View File

@@ -0,0 +1,12 @@
[metadata]
Code=INV_AA
Date=2000-10-02
Name=Invasion Simplified Chinese Alternate Art
Type=Promo
ScryfallCode=INV
[cards]
124s C Soul Burn @Andrew Goldhawk
124★ C Soul Burn @Andrew Goldhawk
134s C Urborg Skeleton @Tom Wänerstrand
134★ C Urborg Skeleton @Tom Wänerstrand

View File

@@ -552,3 +552,6 @@ Base=Any:fromsheet("MKM prerelease promo")
18 c_a_clue_draw @Mike Burns
19 c_0_0_a_thopter_flying @David Sondered
20 c_1_1_a_thopter_flying @Samuel Perin
[other]
21 cloaked @Ben Hill

View File

@@ -26,7 +26,7 @@ ScryfallCode=SIR
14 U Blessed Alliance @Johann Bodin
15 C Borrowed Grace @Volkan Baǵa
16 C Bound by Moonsilver @Joseph Meehan
17 R Bruna, the Fading Light @Clint Cearley
17a R Bruna, the Fading Light @Clint Cearley
18 R Bygone Bishop @Jason A. Engle
19 R Collective Effort @Eric Deschamps
20 U Courageous Outrider @Ryan Alexander Lee
@@ -124,7 +124,7 @@ ScryfallCode=SIR
112 C Ghoulcaller's Accomplice @Dave Kendall
113 C Gisa's Bidding @Jason Felix
114 U Graf Harvest @Lake Hurwitz
115 C Graf Rats @Jason Felix
115a C Graf Rats @Jason Felix
116 C Grotesque Mutation @Dan Murayama Scott
117 U Haunted Dead @Lake Hurwitz
118 U Indulgent Aristocrat @Anna Steinbauer
@@ -232,7 +232,7 @@ ScryfallCode=SIR
220 R Traverse the Ulvenwald @Vincent Proce
221 C Ulvenwald Captive @Chris Rahn
222 R Ulvenwald Hydra @Raymond Swanland
223 U Ulvenwald Mysteries @Marzena Nereida Piwowar
223 U Ulvenwald Mysteries @Nereida
224 U Vessel of Nascency @Kieran Yanner
225 U Veteran Cathar @Deruchenko Alexander
226 C Weirding Wood @Jung Park

View File

@@ -2,7 +2,6 @@
Code=BRO
Date=2022-11-18
Name=The Brothers' War
Code2=BRO
Type=Expansion
BoosterCovers=3
Booster=9 Common:fromsheet("BRO cards"), 3 Uncommon:fromSheet("BRO cards"), 1 RareMythic:fromSheet("BRO cards"), 1 fromSheet("BRO lands"), 1 fromSheet("BRR cards")
@@ -173,7 +172,7 @@ ScryfallCode=BRO
160 U Heavyweight Demolisher @Svetlin Velinov
161 C Mishra's Juggernaut @Steve Prescott
162 U Mishra's Research Desk @Matt Stewart
163 R Phyrexian Dragon Engine @Chris Rahn
163a R Phyrexian Dragon Engine @Chris Rahn
164 C Scrapwork Mutt @Sidharth Chaturvedi
165 M Skitterbeam Battalion @Leon Tukker
166 U Alloy Animist @Kim Sokol
@@ -266,7 +265,7 @@ ScryfallCode=BRO
253 U Thran Power Suit @Raf Kayupov
254 R Thran Spider @Joshua Cairos
255 C Tower Worker @Gaboleps
256 R Argoth, Sanctum of Nature @Cristi Balanescu
256a R Argoth, Sanctum of Nature @Cristi Balanescu
257 R Battlefield Forge @Thomas Stoop
258 R Blast Zone @Jorge Jacinto
259 R Brushland @Thomas Stoop

View File

@@ -187,16 +187,10 @@ ScryfallCode=WOC
0 role_virtuous @Unknown
0 role_virtuous @Unknown
0 role_virtuous @Unknown
5 w_2_2_cat @April Prime
6 w_1_1_cat_lifelink @Filip Burburan
7 w_1_1_human_soldier @Kimonas Theodossiou
8 w_2_4_ox @Aaron Miller
9 w_2_2_pegasus_flying @Lars Grant-West
10 u_1_1_faerie_flying @Irina Nordsol
11 b_1_1_faerie_rogue_flying @Dave Allsop
12 r_4_2_pirate_noblock @Igor Krstic
13 g_3_3_elephant @Lars Grant-West
14 g_1_1_human_monk_g @Anastasia Ovchinnikova
15 g_1_1_saproling @Joseph Meehan
16 ub_1_1_faerie_rogue_flying @E. M. Gist
17 wb_1_1_spirit_flying @Josh Hass