mtgjson
mtgjson copied to clipboard
Incorrect totalSetSize Calculation for Sets with Split/Transform/Double-Faced Cards
There seems to be a discrepancy between how the totalSetSize is calculated in MTGJson and the card counts displayed on Scryfall or other sources. The issue is related to how double-faced or split cards are handled.
For instance, for the set Duskmourn (DSK), the totalSetSize reported by MTGJson is 451, while the actual unique card count should be 417 (matching Scryfall). The current implementation counts both sides of split/transform/double-faced cards, inflating the total set size.
In my project, I calculate the total set size using the following logic:
OR: [{side: "a"}, {side: null}, {side: "b", layout: "meld"}]
This logic ensures that I count only the front face of cards or cards with a single side, with a special rule for meld cards (side "b"). This method yields a correct total set size of 417 for Duskmourn.
Current Behavior: The totalSetSize includes both sides of double-faced cards, split cards, etc., resulting in an inflated card count.
Expected Behavior: The totalSetSize should count only cards with unique collector numbers, not counting the back or other sides of split/transform/double-faced cards more than once. For example, for Duskmourn (DSK), the expected totalSetSize is 417.
Suggested Fix: The current logic in the code doesn't account for special handling of split/transform/double-faced cards properly. Here's the relevant code snippet for the totalSetSize calculation: set_builder.py#L1549. Update the totalSetSize calculation to exclude the additional sides of split/transform/double-faced cards and only count them once, based on their unique collector number.