Skip to content

NormalLayout

src.layouts.NormalLayout

Defines unified properties for all cards and serves as the layout for any M15 style typical card.

Source code in src\layouts.py
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
class NormalLayout:
    """Defines unified properties for all cards and serves as the layout for any M15 style typical card."""
    card_class: str = LayoutType.Normal

    # Static properties
    is_transform: bool = False
    is_mdfc: bool = False

    def __init__(self, scryfall: dict, file: dict):

        # Establish core properties
        self._file = file
        self._scryfall = scryfall

        # Cache set data and frame data
        _ = self.set_data
        _ = self.frame

    def __str__(self):
        """String representation of the card layout object."""
        return (f"{self.name}"
                f"{f' [{self.set}]' if self.set else ''}"
                f"{f' {{{self.collector_number_raw}}}' if self.collector_number else ''}")

    """
    * Core Data
    """

    @auto_prop
    def file(self) -> CardDetails:
        """Dictionary containing parsed art file details."""
        return self._file

    @auto_prop
    def scryfall(self) -> dict:
        """Card data fetched from Scryfall."""
        return self._scryfall

    @auto_prop_cached
    def template_file(self) -> Path:
        """Template PSD file path, replaced before render process."""
        return PATH.TEMPLATES / 'normal.psd'

    @auto_prop_cached
    def art_file(self) -> Path:
        """Path: Art image file path."""
        return self.file['file']

    @auto_prop_cached
    def scryfall_scan(self) -> str:
        """Scryfall large image scan, if available."""
        return self.card.get('image_uris', {}).get('large', '')

    """
    * Set Data
    """

    @auto_prop_cached
    def set(self) -> str:
        """Card set code, uppercase enforced, falls back to 'MTG' if missing."""
        return self.scryfall.get('set', 'MTG').upper()

    @auto_prop_cached
    def set_data(self) -> dict:
        """Set data from the current hexproof.io data file."""
        return CON.set_data.get(self.scryfall.get('set', 'mtg').lower(), {})

    @auto_prop_cached
    def set_type(self) -> str:
        """str: Type of set the card was printed in, e.g. promo, draft_innovation, etc."""
        return self.scryfall.get('set_type', '')

    """
    * Gameplay Info
    """

    @auto_prop_cached
    def card(self) -> dict:
        """Main card data object to pull most relevant data from."""
        for i, face in enumerate(self.scryfall.get('card_faces', [])):
            # Card with multiple faces, first index is always front side
            if normalize_str(face['name']) == normalize_str(self.input_name):
                return face

        # Treat single face cards as front
        return self.scryfall

    @auto_prop_cached
    def first_print(self) -> dict:
        """Card data fetched from Scryfall representing the first print of this card."""
        first = get_cards_oracle(self.scryfall.get('oracle_id', ''))
        return first[0] if first else {}

    """
    * Card Collections
    """

    @auto_prop_cached
    def frame_effects(self) -> list[str]:
        """Array of frame effects, e.g. nyxtouched, snow, etc."""
        return self.scryfall.get('frame_effects', [])

    @auto_prop_cached
    def keywords(self) -> list[str]:
        """Array of keyword abilities, e.g. Flying, Haste, etc."""
        return self.scryfall.get('keywords', [])

    @auto_prop_cached
    def promo_types(self) -> list[str]:
        """list[str]: Promo types this card matches, e.g. stamped, datestamped, etc."""
        return self.scryfall.get('promo_types', [])

    """
    * Text Info
    """

    @auto_prop_cached
    def name(self) -> str:
        """Card name, supports alternate language source."""
        return self.card.get('printed_name', self.name_raw) if self.is_alt_lang else self.name_raw

    @auto_prop_cached
    def name_raw(self) -> str:
        """Card name, enforced English representation."""
        return self.card.get('name', '')

    @auto_prop_cached
    def display_name(self) -> str:
        """Card name, GUI appropriate representation."""
        return self.name

    @auto_prop_cached
    def input_name(self) -> str:
        """Card name, version provided in art file name."""
        return self.file['name']

    @auto_prop_cached
    def mana_cost(self) -> Optional[str]:
        """Scryfall formatted card mana cost."""
        return self.card.get('mana_cost', '')

    @auto_prop_cached
    def oracle_text(self) -> str:
        """Card rules text, supports alternate language source."""
        return self.card.get('printed_text', self.oracle_text_raw) if self.is_alt_lang else self.oracle_text_raw

    @auto_prop_cached
    def oracle_text_raw(self) -> str:
        """Card rules text, enforced English representation."""
        return self.card.get('oracle_text', '')

    @auto_prop_cached
    def flavor_text(self) -> str:
        """Card flavor text, alternate language version shares the same key."""
        return self.card.get('flavor_text', '')

    @auto_prop_cached
    def rules_text(self) -> str:
        """Utility definition comprised of rules and flavor text as available."""
        return (self.oracle_text or '') + (self.flavor_text or '')

    @auto_prop_cached
    def power(self) -> str:
        """Creature power, if provided."""
        return self.card.get('power', '')

    @auto_prop_cached
    def toughness(self) -> str:
        """Creature toughness, if provided."""
        return self.card.get('toughness', '')

    """
    * Card Types
    """

    @auto_prop_cached
    def type_line(self) -> str:
        """Card type line, supports alternate language source."""
        return self.card.get('printed_type_line', self.type_line_raw) if self.is_alt_lang else self.type_line_raw

    @auto_prop_cached
    def type_line_raw(self) -> str:
        """Card type line, enforced English representation."""
        return self.card.get('type_line', '')

    @auto_prop_cached
    def types_raw(self) -> list[str]:
        """List of types extracted from the raw typeline."""
        return self.type_line_raw.replace(' —', '').split(' ')

    @auto_prop_cached
    def types(self) -> list[str]:
        """Main cards types represented, e.g. Sorcery, Instant, Creature, etc."""
        return [n for n in self.types_raw if n in CardTypes]

    @auto_prop_cached
    def supertypes(self) -> list[str]:
        """Supertypes represented, e.g. Basic, Legendary, Snow, etc."""
        return [n for n in self.types_raw if n in CardTypesSuper]

    @auto_prop_cached
    def subtypes(self) -> list[str]:
        """Subtypes represented, e.g. Elf, Human, Goblin, etc."""
        return [
            n for n in self.types_raw
            if n not in self.supertypes
            and n not in self.types
        ]

    """
    * Color Info
    """

    @auto_prop_cached
    def color_identity(self) -> list[str]:
        """Commander relevant color identity array, e.g. [W, U]."""
        return self.card.get('color_identity', [])

    @auto_prop_cached
    def color_indicator(self) -> str:
        """Color indicator identity array, e.g. [W, U]."""
        return get_ordered_colors(self.card.get('color_indicator', []))

    """
    * Collector Info
    """

    @auto_prop_cached
    def symbol_code(self) -> str:
        """Code used to match a symbol to this card's set. Provided by hexproof.io."""
        if CFG.symbol_force_default:
            return CFG.symbol_default.upper()
        code = self.set_data.get('code_symbol', 'DEFAULT').upper()
        return CFG.symbol_default.upper() if code == 'DEFAULT' else code

    @auto_prop_cached
    def lang(self) -> str:
        """Card print language, uppercase enforced, falls back to settings defined value."""
        return self.scryfall.get('lang', CFG.lang).upper()

    @auto_prop_cached
    def rarity(self) -> str:
        """Card rarity, interprets 'special' rarities based on card data."""
        return self.rarity_raw if self.rarity_raw in [
            Rarity.C, Rarity.U, Rarity.R, Rarity.M, Rarity.T
        ] else get_special_rarity(self.rarity_raw, self.scryfall)

    @auto_prop_cached
    def rarity_raw(self) -> str:
        """Card rarity, doesn't interpret 'special' rarities."""
        return self.scryfall.get('rarity', Rarity.C)

    @auto_prop_cached
    def rarity_letter(self) -> str:
        """First letter of card rarity, uppercase enforced."""
        return self.rarity[0].upper()

    @auto_prop_cached
    def artist(self) -> str:
        """Card artist name, prioritizes user provided artist name. Controls for duplicate last names."""
        if self.file.get('artist'):
            return self.file['artist']

        # Check for duplicate last names
        artist, count = self.card.get('artist', 'Unknown'), []
        if '&' in artist:
            for w in artist.split(' '):
                if w in count:
                    count.remove(w)
                count.append(w)
            return ' '.join(count)
        return artist

    @auto_prop_cached
    def collector_number(self) -> int:
        """int: Card number assigned within release set. Non-digit characters are ignored, falls back to 0."""
        if self.collector_number_raw:
            return int(''.join(char for char in self.collector_number_raw if char.isdigit()))
        return 0

    @auto_prop_cached
    def collector_number_raw(self) -> Optional[str]:
        """str | None: Card number assigned within release set. Raw string representation, allows non-digits."""
        return self.scryfall.get('collector_number')

    @auto_prop_cached
    def card_count(self) -> Optional[int]:
        """int | None: Number of cards within the card's release set. Only required in 'Normal' Collector Mode."""

        # Skip if collector mode doesn't require it or if collector number is bad
        if CFG.collector_mode != CollectorMode.Normal or not self.collector_number_raw:
            return

        # Prefer printed count, fallback to card count, skip if count isn't found
        count = self.set_data.get('count_printed', self.set_data.get('count_cards'))
        if count is None:
            return

        # Skip if count is smaller than collector number
        return count if int(count) >= self.collector_number else None

    @auto_prop_cached
    def collector_data(self) -> str:
        """str: Formatted collector info line, e.g. 050/230 M."""
        if self.card_count:
            return f"{str(self.collector_number).zfill(3)}/{str(self.card_count).zfill(3)} {self.rarity_letter}"
        if self.collector_number_raw:
            return f"{self.rarity_letter} {str(self.collector_number).zfill(4)}"
        return ''

    @auto_prop_cached
    def creator(self) -> str:
        """str: Optional creator string provided by user in art file name."""
        return self.file.get('creator', '')

    """
    * Symbols
    """

    @auto_prop_cached
    def symbol_svg(self) -> Optional[Path]:
        """SVG path definition for card's expansion symbol."""

        # Does SVG exist?
        path = (PATH.SRC_IMG_SYMBOLS / 'set' / self.symbol_code / self.rarity_letter).with_suffix('.svg')
        if path.is_file():
            return path

        # Revert to mythic for special rarities
        if self.rarity not in [Rarity.C, Rarity.U, Rarity.R, Rarity.M]:
            path = (PATH.SRC_IMG_SYMBOLS / 'set' / self.symbol_code / 'M').with_suffix('.svg')
            if path.is_file():
                return path

        # Revert to default symbol or None
        path = (PATH.SRC_IMG_SYMBOLS / 'set' / 'DEFAULT' / self.rarity_letter).with_suffix('.svg')
        if path.is_file():
            return path
        return

    @auto_prop_cached
    def watermark(self) -> Optional[str]:
        """Name of the card's watermark file that is actually used, if provided."""
        if not self.watermark_svg:
            return
        if self.watermark_svg.stem.upper() == 'WM':
            return self.watermark_svg.parent.stem.lower()
        return self.watermark_svg.stem.lower()

    @auto_prop_cached
    def watermark_raw(self) -> Optional[str]:
        """Name of the card's watermark from raw Scryfall data, if provided."""
        return self.card.get('watermark')

    @auto_prop_cached
    def watermark_svg(self) -> Optional[Path]:
        """Path to the watermark SVG file, if provided."""
        def _find_watermark_svg(wm: str) -> Optional[Path]:
            """Try to find a watermark SVG asset, allowing for special cases and set code fallbacks.

            Args:
                wm: Watermark name or set code to look for.

            Returns:
                Path to a watermark SVG file if found, otherwise None.

            Notes:
                - 'set' maps to the symbol collection of the set this card was first printed in.
                - 'symbol' maps to the symbol collection of this card object's set.
            """
            if not wm:
                return
            wm = wm.lower()

            # Special case watermarks
            if wm in ['set', 'symbol']:
                return get_watermark_svg_from_set(
                    self.first_print.get('set', self.set) if wm == 'set' else self.set)

            # Look for normal watermark
            return get_watermark_svg(wm)

        # WatermarkMode: Disabled, Forced
        if CFG.watermark_mode == WatermarkMode.Disabled:
            return
        elif CFG.watermark_mode == WatermarkMode.Forced:
            return _find_watermark_svg(CFG.watermark_default)

        # WatermarkMode: Automatic
        path = _find_watermark_svg(self.watermark_raw)
        if path or CFG.watermark_mode == WatermarkMode.Automatic:
            return path

        # WatermarkMode: Fallback
        return _find_watermark_svg(CFG.watermark_default)

    @auto_prop_cached
    def watermark_basic(self) -> Optional[Path]:
        """Optional[Path]: Path to basic land watermark, if card is a Basic Land."""
        if not self.is_basic_land:
            return

        # Map pinlines to basic land type
        _map = {
            'W': 'plains',
            'U': 'island',
            'B': 'swamp',
            'R': 'mountain',
            'G': 'forest',
            'Land': 'wastes'}
        if basic_type := _map.get(self.pinlines):
            return (PATH.SRC_IMG_SYMBOLS / 'watermark' / basic_type).with_suffix('.svg')
        return

    """
    * Bool Properties
    """

    @auto_prop_cached
    def is_creature(self) -> bool:
        """True if card is a Creature."""
        return bool(self.power and self.toughness)

    @auto_prop_cached
    def is_land(self) -> bool:
        """True if card is a Land."""
        return 'Land' in self.type_line_raw

    @auto_prop_cached
    def is_basic_land(self) -> bool:
        """True if card is a Basic Land."""
        return self.type_line_raw.startswith('Basic')

    @auto_prop_cached
    def is_legendary(self) -> bool:
        """True if card is Legendary."""
        return 'Legendary' in self.type_line_raw

    @auto_prop_cached
    def is_colorless(self) -> bool:
        """True if card is colorless or devoid."""
        return self.frame['is_colorless']

    @auto_prop_cached
    def is_hybrid(self) -> bool:
        """True if card is a hybrid frame."""
        return self.frame['is_hybrid']

    @auto_prop_cached
    def is_artifact(self) -> bool:
        """True if card is an Artifact."""
        return 'Artifact' in self.type_line_raw

    @auto_prop_cached
    def is_vehicle(self) -> bool:
        """True if card is a Vehicle."""
        return 'Vehicle' in self.type_line_raw

    @auto_prop_cached
    def is_promo(self) -> bool:
        """True if card is a promotional print."""
        if self.scryfall.get('promo', False):
            return True
        if self.set_type == 'promo':
            return True
        if self.promo_types:
            return True
        return False

    @auto_prop_cached
    def is_front(self) -> bool:
        """True if card is front face."""
        return bool(self.scryfall.get('front', True))

    @auto_prop_cached
    def is_alt_lang(self) -> bool:
        """True if language selected isn't English."""
        return bool(self.lang != 'EN')

    """
    * Cosmetic Bool
    """

    @auto_prop_cached
    def is_token(self) -> bool:
        """bool: True if card is a Token or Emblem."""
        return bool('Token' in self.type_line_raw or self.is_emblem)

    @auto_prop_cached
    def is_emblem(self) -> bool:
        """bool: True on card is an Emblem."""
        return bool('Emblem' in self.type_line_raw)

    @auto_prop_cached
    def is_nyx(self) -> bool:
        """True if card has Nyx enchantment background texture."""
        if 'nyxtouched' in self.frame_effects:
            return True
        # Nyxtouched often not provided, check for 'Enchantment Creature'
        return bool(self.is_creature and 'Enchantment' in self.type_line_raw)

    @auto_prop_cached
    def is_companion(self) -> bool:
        """True if card is a Companion."""
        return "companion" in self.frame_effects

    @auto_prop_cached
    def is_miracle(self) -> bool:
        """True if card is a 'Miracle' card."""
        return bool("Miracle" in self.frame_effects)

    @auto_prop_cached
    def is_snow(self) -> bool:
        """True if card is a 'Snow' card."""
        return bool('Snow' in self.type_line_raw)

    """
    * Frame Details
    """

    @auto_prop_cached
    def frame(self) -> FrameDetails:
        """Dictionary containing calculated frame information."""
        return get_frame_details(self.card)

    @auto_prop_cached
    def twins(self) -> str:
        """Identity of the name and title boxes."""
        return self.frame['twins']

    @auto_prop_cached
    def pinlines(self) -> str:
        """Identity of the pinlines."""
        return self.frame['pinlines']

    @auto_prop_cached
    def background(self) -> str:
        """Identity of the background."""
        return self.frame['background']

    @auto_prop_cached
    def identity(self) -> str:
        """Frame appropriate color identity of the card."""
        return self.frame['identity']

    """
    * Opposing Face Properties
    """

    @auto_prop_cached
    def other_face(self) -> dict:
        """Card data from opposing face if provided."""
        for face in self.scryfall.get('card_faces', []):
            if face.get('name') != self.name_raw:
                return face
        return {}

    @auto_prop_cached
    def other_face_frame(self) -> Union[FrameDetails, dict]:
        """Calculated frame information of opposing face, if provided."""
        return get_frame_details(self.other_face) if self.other_face else {}

    @auto_prop_cached
    def other_face_twins(self) -> str:
        """Name and title box identity of opposing face."""
        return self.other_face_frame.get('twins', '')

    @auto_prop_cached
    def transform_icon(self) -> str:
        """Transform icon if provided, data possibly deprecated in modern practice."""
        for effect in self.frame_effects:
            if effect in TransformIcons:
                return effect
        # Fallback: New Transform cards use 'convert' arrow introduced in Transformer set
        return TransformIcons.UPSIDEDOWN if self.is_land else TransformIcons.CONVERT

    @auto_prop_cached
    def other_face_mana_cost(self) -> str:
        """Mana cost of opposing face."""
        return self.other_face.get('mana_cost', '')

    @auto_prop_cached
    def other_face_type_line(self) -> str:
        """Type line of opposing face."""
        return self.other_face.get('type_line', '')

    @auto_prop_cached
    def other_face_type_line_raw(self) -> str:
        """Type line of opposing face, English language enforced."""
        if self.is_alt_lang:
            return self.other_face.get('printed_type_line', self.other_face_type_line)
        return self.other_face_type_line

    @auto_prop_cached
    def other_face_oracle_text(self) -> str:
        """Rules text of opposing face."""
        if self.is_alt_lang:
            return self.other_face.get('printed_text', self.other_face_oracle_text_raw)
        return self.other_face_oracle_text_raw

    @auto_prop_cached
    def other_face_oracle_text_raw(self) -> str:
        """Rules text of opposing face."""
        return self.other_face.get('oracle_text', '')

    @auto_prop_cached
    def other_face_power(self) -> str:
        """Creature power of opposing face, if provided."""
        return self.other_face.get('power', '')

    @auto_prop_cached
    def other_face_toughness(self) -> str:
        """Creature toughness of opposing face, if provided."""
        return self.other_face.get('toughness', '')

    @auto_prop_cached
    def other_face_left(self) -> Optional[str]:
        """Abridged type of the opposing side to display on bottom MDFC bar."""
        return self.other_face_type_line_raw.split(' ')[-1] if self.other_face else ''

    @auto_prop_cached
    def other_face_right(self) -> str:
        """Mana cost or mana ability of opposing side, depending on land or nonland."""
        if not self.other_face:
            return ''

        # Other face is not a land
        if 'Land' not in self.other_face_type_line_raw:
            return self.other_face_mana_cost

        # Other face is a land, find the mana tap ability
        for line in self.other_face_oracle_text.split('\n'):
            if line.startswith('{T}'):
                return f"{line.split('.')[0]}."
        return self.other_face_oracle_text

Functions

art_file() -> Path

Source code in src\layouts.py
168
169
170
171
@auto_prop_cached
def art_file(self) -> Path:
    """Path: Art image file path."""
    return self.file['file']

artist() -> str

Card artist name, prioritizes user provided artist name. Controls for duplicate last names.

Source code in src\layouts.py
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
@auto_prop_cached
def artist(self) -> str:
    """Card artist name, prioritizes user provided artist name. Controls for duplicate last names."""
    if self.file.get('artist'):
        return self.file['artist']

    # Check for duplicate last names
    artist, count = self.card.get('artist', 'Unknown'), []
    if '&' in artist:
        for w in artist.split(' '):
            if w in count:
                count.remove(w)
            count.append(w)
        return ' '.join(count)
    return artist

background() -> str

Identity of the background.

Source code in src\layouts.py
660
661
662
663
@auto_prop_cached
def background(self) -> str:
    """Identity of the background."""
    return self.frame['background']

card() -> dict

Main card data object to pull most relevant data from.

Source code in src\layouts.py
201
202
203
204
205
206
207
208
209
210
@auto_prop_cached
def card(self) -> dict:
    """Main card data object to pull most relevant data from."""
    for i, face in enumerate(self.scryfall.get('card_faces', [])):
        # Card with multiple faces, first index is always front side
        if normalize_str(face['name']) == normalize_str(self.input_name):
            return face

    # Treat single face cards as front
    return self.scryfall

card_count() -> Optional[int]

int | None: Number of cards within the card's release set. Only required in 'Normal' Collector Mode.

Source code in src\layouts.py
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
@auto_prop_cached
def card_count(self) -> Optional[int]:
    """int | None: Number of cards within the card's release set. Only required in 'Normal' Collector Mode."""

    # Skip if collector mode doesn't require it or if collector number is bad
    if CFG.collector_mode != CollectorMode.Normal or not self.collector_number_raw:
        return

    # Prefer printed count, fallback to card count, skip if count isn't found
    count = self.set_data.get('count_printed', self.set_data.get('count_cards'))
    if count is None:
        return

    # Skip if count is smaller than collector number
    return count if int(count) >= self.collector_number else None

collector_data() -> str

Source code in src\layouts.py
426
427
428
429
430
431
432
433
@auto_prop_cached
def collector_data(self) -> str:
    """str: Formatted collector info line, e.g. 050/230 M."""
    if self.card_count:
        return f"{str(self.collector_number).zfill(3)}/{str(self.card_count).zfill(3)} {self.rarity_letter}"
    if self.collector_number_raw:
        return f"{self.rarity_letter} {str(self.collector_number).zfill(4)}"
    return ''

collector_number() -> int

Source code in src\layouts.py
398
399
400
401
402
403
@auto_prop_cached
def collector_number(self) -> int:
    """int: Card number assigned within release set. Non-digit characters are ignored, falls back to 0."""
    if self.collector_number_raw:
        return int(''.join(char for char in self.collector_number_raw if char.isdigit()))
    return 0

collector_number_raw() -> Optional[str]

str | None: Card number assigned within release set. Raw string representation, allows non-digits.

Source code in src\layouts.py
405
406
407
408
@auto_prop_cached
def collector_number_raw(self) -> Optional[str]:
    """str | None: Card number assigned within release set. Raw string representation, allows non-digits."""
    return self.scryfall.get('collector_number')

color_identity() -> list[str]

Commander relevant color identity array, e.g. [W, U].

Source code in src\layouts.py
338
339
340
341
@auto_prop_cached
def color_identity(self) -> list[str]:
    """Commander relevant color identity array, e.g. [W, U]."""
    return self.card.get('color_identity', [])

color_indicator() -> str

Color indicator identity array, e.g. [W, U].

Source code in src\layouts.py
343
344
345
346
@auto_prop_cached
def color_indicator(self) -> str:
    """Color indicator identity array, e.g. [W, U]."""
    return get_ordered_colors(self.card.get('color_indicator', []))

creator() -> str

Source code in src\layouts.py
435
436
437
438
@auto_prop_cached
def creator(self) -> str:
    """str: Optional creator string provided by user in art file name."""
    return self.file.get('creator', '')

display_name() -> str

Card name, GUI appropriate representation.

Source code in src\layouts.py
251
252
253
254
@auto_prop_cached
def display_name(self) -> str:
    """Card name, GUI appropriate representation."""
    return self.name

file() -> CardDetails

Dictionary containing parsed art file details.

Source code in src\layouts.py
153
154
155
156
@auto_prop
def file(self) -> CardDetails:
    """Dictionary containing parsed art file details."""
    return self._file

first_print() -> dict

Card data fetched from Scryfall representing the first print of this card.

Source code in src\layouts.py
212
213
214
215
216
@auto_prop_cached
def first_print(self) -> dict:
    """Card data fetched from Scryfall representing the first print of this card."""
    first = get_cards_oracle(self.scryfall.get('oracle_id', ''))
    return first[0] if first else {}

flavor_text() -> str

Card flavor text, alternate language version shares the same key.

Source code in src\layouts.py
276
277
278
279
@auto_prop_cached
def flavor_text(self) -> str:
    """Card flavor text, alternate language version shares the same key."""
    return self.card.get('flavor_text', '')

frame() -> FrameDetails

Dictionary containing calculated frame information.

Source code in src\layouts.py
645
646
647
648
@auto_prop_cached
def frame(self) -> FrameDetails:
    """Dictionary containing calculated frame information."""
    return get_frame_details(self.card)

frame_effects() -> list[str]

Array of frame effects, e.g. nyxtouched, snow, etc.

Source code in src\layouts.py
222
223
224
225
@auto_prop_cached
def frame_effects(self) -> list[str]:
    """Array of frame effects, e.g. nyxtouched, snow, etc."""
    return self.scryfall.get('frame_effects', [])

identity() -> str

Frame appropriate color identity of the card.

Source code in src\layouts.py
665
666
667
668
@auto_prop_cached
def identity(self) -> str:
    """Frame appropriate color identity of the card."""
    return self.frame['identity']

input_name() -> str

Card name, version provided in art file name.

Source code in src\layouts.py
256
257
258
259
@auto_prop_cached
def input_name(self) -> str:
    """Card name, version provided in art file name."""
    return self.file['name']

is_alt_lang() -> bool

True if language selected isn't English.

Source code in src\layouts.py
599
600
601
602
@auto_prop_cached
def is_alt_lang(self) -> bool:
    """True if language selected isn't English."""
    return bool(self.lang != 'EN')

is_artifact() -> bool

True if card is an Artifact.

Source code in src\layouts.py
573
574
575
576
@auto_prop_cached
def is_artifact(self) -> bool:
    """True if card is an Artifact."""
    return 'Artifact' in self.type_line_raw

is_basic_land() -> bool

True if card is a Basic Land.

Source code in src\layouts.py
553
554
555
556
@auto_prop_cached
def is_basic_land(self) -> bool:
    """True if card is a Basic Land."""
    return self.type_line_raw.startswith('Basic')

is_colorless() -> bool

True if card is colorless or devoid.

Source code in src\layouts.py
563
564
565
566
@auto_prop_cached
def is_colorless(self) -> bool:
    """True if card is colorless or devoid."""
    return self.frame['is_colorless']

is_companion() -> bool

True if card is a Companion.

Source code in src\layouts.py
626
627
628
629
@auto_prop_cached
def is_companion(self) -> bool:
    """True if card is a Companion."""
    return "companion" in self.frame_effects

is_creature() -> bool

True if card is a Creature.

Source code in src\layouts.py
543
544
545
546
@auto_prop_cached
def is_creature(self) -> bool:
    """True if card is a Creature."""
    return bool(self.power and self.toughness)

is_emblem() -> bool

Source code in src\layouts.py
613
614
615
616
@auto_prop_cached
def is_emblem(self) -> bool:
    """bool: True on card is an Emblem."""
    return bool('Emblem' in self.type_line_raw)

is_front() -> bool

True if card is front face.

Source code in src\layouts.py
594
595
596
597
@auto_prop_cached
def is_front(self) -> bool:
    """True if card is front face."""
    return bool(self.scryfall.get('front', True))

is_hybrid() -> bool

True if card is a hybrid frame.

Source code in src\layouts.py
568
569
570
571
@auto_prop_cached
def is_hybrid(self) -> bool:
    """True if card is a hybrid frame."""
    return self.frame['is_hybrid']

is_land() -> bool

True if card is a Land.

Source code in src\layouts.py
548
549
550
551
@auto_prop_cached
def is_land(self) -> bool:
    """True if card is a Land."""
    return 'Land' in self.type_line_raw

is_legendary() -> bool

True if card is Legendary.

Source code in src\layouts.py
558
559
560
561
@auto_prop_cached
def is_legendary(self) -> bool:
    """True if card is Legendary."""
    return 'Legendary' in self.type_line_raw

is_miracle() -> bool

True if card is a 'Miracle' card.

Source code in src\layouts.py
631
632
633
634
@auto_prop_cached
def is_miracle(self) -> bool:
    """True if card is a 'Miracle' card."""
    return bool("Miracle" in self.frame_effects)

is_nyx() -> bool

True if card has Nyx enchantment background texture.

Source code in src\layouts.py
618
619
620
621
622
623
624
@auto_prop_cached
def is_nyx(self) -> bool:
    """True if card has Nyx enchantment background texture."""
    if 'nyxtouched' in self.frame_effects:
        return True
    # Nyxtouched often not provided, check for 'Enchantment Creature'
    return bool(self.is_creature and 'Enchantment' in self.type_line_raw)

is_promo() -> bool

True if card is a promotional print.

Source code in src\layouts.py
583
584
585
586
587
588
589
590
591
592
@auto_prop_cached
def is_promo(self) -> bool:
    """True if card is a promotional print."""
    if self.scryfall.get('promo', False):
        return True
    if self.set_type == 'promo':
        return True
    if self.promo_types:
        return True
    return False

is_snow() -> bool

True if card is a 'Snow' card.

Source code in src\layouts.py
636
637
638
639
@auto_prop_cached
def is_snow(self) -> bool:
    """True if card is a 'Snow' card."""
    return bool('Snow' in self.type_line_raw)

is_token() -> bool

Source code in src\layouts.py
608
609
610
611
@auto_prop_cached
def is_token(self) -> bool:
    """bool: True if card is a Token or Emblem."""
    return bool('Token' in self.type_line_raw or self.is_emblem)

is_vehicle() -> bool

True if card is a Vehicle.

Source code in src\layouts.py
578
579
580
581
@auto_prop_cached
def is_vehicle(self) -> bool:
    """True if card is a Vehicle."""
    return 'Vehicle' in self.type_line_raw

keywords() -> list[str]

Array of keyword abilities, e.g. Flying, Haste, etc.

Source code in src\layouts.py
227
228
229
230
@auto_prop_cached
def keywords(self) -> list[str]:
    """Array of keyword abilities, e.g. Flying, Haste, etc."""
    return self.scryfall.get('keywords', [])

lang() -> str

Card print language, uppercase enforced, falls back to settings defined value.

Source code in src\layouts.py
360
361
362
363
@auto_prop_cached
def lang(self) -> str:
    """Card print language, uppercase enforced, falls back to settings defined value."""
    return self.scryfall.get('lang', CFG.lang).upper()

mana_cost() -> Optional[str]

Scryfall formatted card mana cost.

Source code in src\layouts.py
261
262
263
264
@auto_prop_cached
def mana_cost(self) -> Optional[str]:
    """Scryfall formatted card mana cost."""
    return self.card.get('mana_cost', '')

name() -> str

Card name, supports alternate language source.

Source code in src\layouts.py
241
242
243
244
@auto_prop_cached
def name(self) -> str:
    """Card name, supports alternate language source."""
    return self.card.get('printed_name', self.name_raw) if self.is_alt_lang else self.name_raw

name_raw() -> str

Card name, enforced English representation.

Source code in src\layouts.py
246
247
248
249
@auto_prop_cached
def name_raw(self) -> str:
    """Card name, enforced English representation."""
    return self.card.get('name', '')

oracle_text() -> str

Card rules text, supports alternate language source.

Source code in src\layouts.py
266
267
268
269
@auto_prop_cached
def oracle_text(self) -> str:
    """Card rules text, supports alternate language source."""
    return self.card.get('printed_text', self.oracle_text_raw) if self.is_alt_lang else self.oracle_text_raw

oracle_text_raw() -> str

Card rules text, enforced English representation.

Source code in src\layouts.py
271
272
273
274
@auto_prop_cached
def oracle_text_raw(self) -> str:
    """Card rules text, enforced English representation."""
    return self.card.get('oracle_text', '')

other_face() -> dict

Card data from opposing face if provided.

Source code in src\layouts.py
674
675
676
677
678
679
680
@auto_prop_cached
def other_face(self) -> dict:
    """Card data from opposing face if provided."""
    for face in self.scryfall.get('card_faces', []):
        if face.get('name') != self.name_raw:
            return face
    return {}

other_face_frame() -> Union[FrameDetails, dict]

Calculated frame information of opposing face, if provided.

Source code in src\layouts.py
682
683
684
685
@auto_prop_cached
def other_face_frame(self) -> Union[FrameDetails, dict]:
    """Calculated frame information of opposing face, if provided."""
    return get_frame_details(self.other_face) if self.other_face else {}

other_face_left() -> Optional[str]

Abridged type of the opposing side to display on bottom MDFC bar.

Source code in src\layouts.py
740
741
742
743
@auto_prop_cached
def other_face_left(self) -> Optional[str]:
    """Abridged type of the opposing side to display on bottom MDFC bar."""
    return self.other_face_type_line_raw.split(' ')[-1] if self.other_face else ''

other_face_mana_cost() -> str

Mana cost of opposing face.

Source code in src\layouts.py
701
702
703
704
@auto_prop_cached
def other_face_mana_cost(self) -> str:
    """Mana cost of opposing face."""
    return self.other_face.get('mana_cost', '')

other_face_oracle_text() -> str

Rules text of opposing face.

Source code in src\layouts.py
718
719
720
721
722
723
@auto_prop_cached
def other_face_oracle_text(self) -> str:
    """Rules text of opposing face."""
    if self.is_alt_lang:
        return self.other_face.get('printed_text', self.other_face_oracle_text_raw)
    return self.other_face_oracle_text_raw

other_face_oracle_text_raw() -> str

Rules text of opposing face.

Source code in src\layouts.py
725
726
727
728
@auto_prop_cached
def other_face_oracle_text_raw(self) -> str:
    """Rules text of opposing face."""
    return self.other_face.get('oracle_text', '')

other_face_power() -> str

Creature power of opposing face, if provided.

Source code in src\layouts.py
730
731
732
733
@auto_prop_cached
def other_face_power(self) -> str:
    """Creature power of opposing face, if provided."""
    return self.other_face.get('power', '')

other_face_right() -> str

Mana cost or mana ability of opposing side, depending on land or nonland.

Source code in src\layouts.py
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
@auto_prop_cached
def other_face_right(self) -> str:
    """Mana cost or mana ability of opposing side, depending on land or nonland."""
    if not self.other_face:
        return ''

    # Other face is not a land
    if 'Land' not in self.other_face_type_line_raw:
        return self.other_face_mana_cost

    # Other face is a land, find the mana tap ability
    for line in self.other_face_oracle_text.split('\n'):
        if line.startswith('{T}'):
            return f"{line.split('.')[0]}."
    return self.other_face_oracle_text

other_face_toughness() -> str

Creature toughness of opposing face, if provided.

Source code in src\layouts.py
735
736
737
738
@auto_prop_cached
def other_face_toughness(self) -> str:
    """Creature toughness of opposing face, if provided."""
    return self.other_face.get('toughness', '')

other_face_twins() -> str

Name and title box identity of opposing face.

Source code in src\layouts.py
687
688
689
690
@auto_prop_cached
def other_face_twins(self) -> str:
    """Name and title box identity of opposing face."""
    return self.other_face_frame.get('twins', '')

other_face_type_line() -> str

Type line of opposing face.

Source code in src\layouts.py
706
707
708
709
@auto_prop_cached
def other_face_type_line(self) -> str:
    """Type line of opposing face."""
    return self.other_face.get('type_line', '')

other_face_type_line_raw() -> str

Type line of opposing face, English language enforced.

Source code in src\layouts.py
711
712
713
714
715
716
@auto_prop_cached
def other_face_type_line_raw(self) -> str:
    """Type line of opposing face, English language enforced."""
    if self.is_alt_lang:
        return self.other_face.get('printed_type_line', self.other_face_type_line)
    return self.other_face_type_line

pinlines() -> str

Identity of the pinlines.

Source code in src\layouts.py
655
656
657
658
@auto_prop_cached
def pinlines(self) -> str:
    """Identity of the pinlines."""
    return self.frame['pinlines']

power() -> str

Creature power, if provided.

Source code in src\layouts.py
286
287
288
289
@auto_prop_cached
def power(self) -> str:
    """Creature power, if provided."""
    return self.card.get('power', '')

promo_types() -> list[str]

list[str]: Promo types this card matches, e.g. stamped, datestamped, etc.

Source code in src\layouts.py
232
233
234
235
@auto_prop_cached
def promo_types(self) -> list[str]:
    """list[str]: Promo types this card matches, e.g. stamped, datestamped, etc."""
    return self.scryfall.get('promo_types', [])

rarity() -> str

Card rarity, interprets 'special' rarities based on card data.

Source code in src\layouts.py
365
366
367
368
369
370
@auto_prop_cached
def rarity(self) -> str:
    """Card rarity, interprets 'special' rarities based on card data."""
    return self.rarity_raw if self.rarity_raw in [
        Rarity.C, Rarity.U, Rarity.R, Rarity.M, Rarity.T
    ] else get_special_rarity(self.rarity_raw, self.scryfall)

rarity_letter() -> str

First letter of card rarity, uppercase enforced.

Source code in src\layouts.py
377
378
379
380
@auto_prop_cached
def rarity_letter(self) -> str:
    """First letter of card rarity, uppercase enforced."""
    return self.rarity[0].upper()

rarity_raw() -> str

Card rarity, doesn't interpret 'special' rarities.

Source code in src\layouts.py
372
373
374
375
@auto_prop_cached
def rarity_raw(self) -> str:
    """Card rarity, doesn't interpret 'special' rarities."""
    return self.scryfall.get('rarity', Rarity.C)

rules_text() -> str

Utility definition comprised of rules and flavor text as available.

Source code in src\layouts.py
281
282
283
284
@auto_prop_cached
def rules_text(self) -> str:
    """Utility definition comprised of rules and flavor text as available."""
    return (self.oracle_text or '') + (self.flavor_text or '')

scryfall() -> dict

Card data fetched from Scryfall.

Source code in src\layouts.py
158
159
160
161
@auto_prop
def scryfall(self) -> dict:
    """Card data fetched from Scryfall."""
    return self._scryfall

scryfall_scan() -> str

Scryfall large image scan, if available.

Source code in src\layouts.py
173
174
175
176
@auto_prop_cached
def scryfall_scan(self) -> str:
    """Scryfall large image scan, if available."""
    return self.card.get('image_uris', {}).get('large', '')

set() -> str

Card set code, uppercase enforced, falls back to 'MTG' if missing.

Source code in src\layouts.py
182
183
184
185
@auto_prop_cached
def set(self) -> str:
    """Card set code, uppercase enforced, falls back to 'MTG' if missing."""
    return self.scryfall.get('set', 'MTG').upper()

set_data() -> dict

Set data from the current hexproof.io data file.

Source code in src\layouts.py
187
188
189
190
@auto_prop_cached
def set_data(self) -> dict:
    """Set data from the current hexproof.io data file."""
    return CON.set_data.get(self.scryfall.get('set', 'mtg').lower(), {})

set_type() -> str

Source code in src\layouts.py
192
193
194
195
@auto_prop_cached
def set_type(self) -> str:
    """str: Type of set the card was printed in, e.g. promo, draft_innovation, etc."""
    return self.scryfall.get('set_type', '')

subtypes() -> list[str]

Subtypes represented, e.g. Elf, Human, Goblin, etc.

Source code in src\layouts.py
325
326
327
328
329
330
331
332
@auto_prop_cached
def subtypes(self) -> list[str]:
    """Subtypes represented, e.g. Elf, Human, Goblin, etc."""
    return [
        n for n in self.types_raw
        if n not in self.supertypes
        and n not in self.types
    ]

supertypes() -> list[str]

Supertypes represented, e.g. Basic, Legendary, Snow, etc.

Source code in src\layouts.py
320
321
322
323
@auto_prop_cached
def supertypes(self) -> list[str]:
    """Supertypes represented, e.g. Basic, Legendary, Snow, etc."""
    return [n for n in self.types_raw if n in CardTypesSuper]

symbol_code() -> str

Code used to match a symbol to this card's set. Provided by hexproof.io.

Source code in src\layouts.py
352
353
354
355
356
357
358
@auto_prop_cached
def symbol_code(self) -> str:
    """Code used to match a symbol to this card's set. Provided by hexproof.io."""
    if CFG.symbol_force_default:
        return CFG.symbol_default.upper()
    code = self.set_data.get('code_symbol', 'DEFAULT').upper()
    return CFG.symbol_default.upper() if code == 'DEFAULT' else code

symbol_svg() -> Optional[Path]

SVG path definition for card's expansion symbol.

Source code in src\layouts.py
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
@auto_prop_cached
def symbol_svg(self) -> Optional[Path]:
    """SVG path definition for card's expansion symbol."""

    # Does SVG exist?
    path = (PATH.SRC_IMG_SYMBOLS / 'set' / self.symbol_code / self.rarity_letter).with_suffix('.svg')
    if path.is_file():
        return path

    # Revert to mythic for special rarities
    if self.rarity not in [Rarity.C, Rarity.U, Rarity.R, Rarity.M]:
        path = (PATH.SRC_IMG_SYMBOLS / 'set' / self.symbol_code / 'M').with_suffix('.svg')
        if path.is_file():
            return path

    # Revert to default symbol or None
    path = (PATH.SRC_IMG_SYMBOLS / 'set' / 'DEFAULT' / self.rarity_letter).with_suffix('.svg')
    if path.is_file():
        return path
    return

template_file() -> Path

Template PSD file path, replaced before render process.

Source code in src\layouts.py
163
164
165
166
@auto_prop_cached
def template_file(self) -> Path:
    """Template PSD file path, replaced before render process."""
    return PATH.TEMPLATES / 'normal.psd'

toughness() -> str

Creature toughness, if provided.

Source code in src\layouts.py
291
292
293
294
@auto_prop_cached
def toughness(self) -> str:
    """Creature toughness, if provided."""
    return self.card.get('toughness', '')

transform_icon() -> str

Transform icon if provided, data possibly deprecated in modern practice.

Source code in src\layouts.py
692
693
694
695
696
697
698
699
@auto_prop_cached
def transform_icon(self) -> str:
    """Transform icon if provided, data possibly deprecated in modern practice."""
    for effect in self.frame_effects:
        if effect in TransformIcons:
            return effect
    # Fallback: New Transform cards use 'convert' arrow introduced in Transformer set
    return TransformIcons.UPSIDEDOWN if self.is_land else TransformIcons.CONVERT

twins() -> str

Identity of the name and title boxes.

Source code in src\layouts.py
650
651
652
653
@auto_prop_cached
def twins(self) -> str:
    """Identity of the name and title boxes."""
    return self.frame['twins']

type_line() -> str

Card type line, supports alternate language source.

Source code in src\layouts.py
300
301
302
303
@auto_prop_cached
def type_line(self) -> str:
    """Card type line, supports alternate language source."""
    return self.card.get('printed_type_line', self.type_line_raw) if self.is_alt_lang else self.type_line_raw

type_line_raw() -> str

Card type line, enforced English representation.

Source code in src\layouts.py
305
306
307
308
@auto_prop_cached
def type_line_raw(self) -> str:
    """Card type line, enforced English representation."""
    return self.card.get('type_line', '')

types() -> list[str]

Main cards types represented, e.g. Sorcery, Instant, Creature, etc.

Source code in src\layouts.py
315
316
317
318
@auto_prop_cached
def types(self) -> list[str]:
    """Main cards types represented, e.g. Sorcery, Instant, Creature, etc."""
    return [n for n in self.types_raw if n in CardTypes]

types_raw() -> list[str]

List of types extracted from the raw typeline.

Source code in src\layouts.py
310
311
312
313
@auto_prop_cached
def types_raw(self) -> list[str]:
    """List of types extracted from the raw typeline."""
    return self.type_line_raw.replace(' —', '').split(' ')

watermark() -> Optional[str]

Name of the card's watermark file that is actually used, if provided.

Source code in src\layouts.py
465
466
467
468
469
470
471
472
@auto_prop_cached
def watermark(self) -> Optional[str]:
    """Name of the card's watermark file that is actually used, if provided."""
    if not self.watermark_svg:
        return
    if self.watermark_svg.stem.upper() == 'WM':
        return self.watermark_svg.parent.stem.lower()
    return self.watermark_svg.stem.lower()

watermark_basic() -> Optional[Path]

Optional[Path]: Path to basic land watermark, if card is a Basic Land.

Source code in src\layouts.py
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
@auto_prop_cached
def watermark_basic(self) -> Optional[Path]:
    """Optional[Path]: Path to basic land watermark, if card is a Basic Land."""
    if not self.is_basic_land:
        return

    # Map pinlines to basic land type
    _map = {
        'W': 'plains',
        'U': 'island',
        'B': 'swamp',
        'R': 'mountain',
        'G': 'forest',
        'Land': 'wastes'}
    if basic_type := _map.get(self.pinlines):
        return (PATH.SRC_IMG_SYMBOLS / 'watermark' / basic_type).with_suffix('.svg')
    return

watermark_raw() -> Optional[str]

Name of the card's watermark from raw Scryfall data, if provided.

Source code in src\layouts.py
474
475
476
477
@auto_prop_cached
def watermark_raw(self) -> Optional[str]:
    """Name of the card's watermark from raw Scryfall data, if provided."""
    return self.card.get('watermark')

watermark_svg() -> Optional[Path]

Path to the watermark SVG file, if provided.

Source code in src\layouts.py
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
@auto_prop_cached
def watermark_svg(self) -> Optional[Path]:
    """Path to the watermark SVG file, if provided."""
    def _find_watermark_svg(wm: str) -> Optional[Path]:
        """Try to find a watermark SVG asset, allowing for special cases and set code fallbacks.

        Args:
            wm: Watermark name or set code to look for.

        Returns:
            Path to a watermark SVG file if found, otherwise None.

        Notes:
            - 'set' maps to the symbol collection of the set this card was first printed in.
            - 'symbol' maps to the symbol collection of this card object's set.
        """
        if not wm:
            return
        wm = wm.lower()

        # Special case watermarks
        if wm in ['set', 'symbol']:
            return get_watermark_svg_from_set(
                self.first_print.get('set', self.set) if wm == 'set' else self.set)

        # Look for normal watermark
        return get_watermark_svg(wm)

    # WatermarkMode: Disabled, Forced
    if CFG.watermark_mode == WatermarkMode.Disabled:
        return
    elif CFG.watermark_mode == WatermarkMode.Forced:
        return _find_watermark_svg(CFG.watermark_default)

    # WatermarkMode: Automatic
    path = _find_watermark_svg(self.watermark_raw)
    if path or CFG.watermark_mode == WatermarkMode.Automatic:
        return path

    # WatermarkMode: Fallback
    return _find_watermark_svg(CFG.watermark_default)