[Oracle] Prefer higher-priority maintype when merging split cards

Adventure cards (e.g. Bonecrusher Giant, Virtue of Knowledge) are stored as
split cards in MTGJSON, with a Creature/permanent face and an Instant/Sorcery
adventure face. When the two faces are merged into a single card, the code
previously discarded the second face's maintype entirely, keeping whichever
face was processed first.

If the Instant/Sorcery adventure face appeared first, the merged card got
maintype 'Instant' with tableRow 3. At runtime this made double-clicking the
card on the stack send it to the graveyard instead of the table
(PlayerActions::playCard).

Fix the merge to follow the same priority order used by getMainCardType()
(Planeswalker > Creature > Land > Sorcery > Instant > Artifact > Enchantment),
so the permanent Creature type wins for adventure cards regardless of face
order, matching the physical card and the reported expectations.

Closes #4394
This commit is contained in:
Lukas Brübach 2026-09-07 09:57:56 +02:00
parent ebeae48652
commit ef19ac8a69

View file

@ -460,8 +460,17 @@ int OracleImporter::importCardsFromSet(const CardSetPtr &currentSet, const QJson
properties.insert(prop, thisCardPropertyValue);
} else if (prop == "colors" || prop == "coloridentity") { // the card is both colors
properties.insert(prop, originalPropertyValue + thisCardPropertyValue);
} else if (prop == "maintype") { // don't create maintypes with //es in them
continue;
} else if (prop == "maintype") {
// Use the same priority as getMainCardType() to pick the
// "best" type across faces — e.g. Creature over Instant
// for adventure cards.
static const QStringList typePriority = {
"Planeswalker", "Creature", "Land", "Sorcery", "Instant", "Artifact", "Enchantment"};
int currentPriority = typePriority.indexOf(originalPropertyValue);
int newPriority = typePriority.indexOf(thisCardPropertyValue);
if (newPriority >= 0 && (currentPriority < 0 || newPriority < currentPriority)) {
properties.insert(prop, thisCardPropertyValue);
}
} else {
properties.insert(prop,
originalPropertyValue + splitCardPropSeparator + thisCardPropertyValue);