Skip to content

PlanarTemplate

src.templates.planar.PlanarTemplate

Bases: StarterTemplate

Planar template for Planar and Phenomenon cards introduced in the Planechase block.

Todo

Needs a complete rework and a 'Modifier' class.

Source code in src\templates\planar.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
class PlanarTemplate (StarterTemplate):
    """Planar template for Planar and Phenomenon cards introduced in the Planechase block.

    Todo:
        Needs a complete rework and a 'Modifier' class.
    """

    def __init__(self, layout: CardLayout, **kwargs):
        CFG.exit_early = True
        super().__init__(layout, **kwargs)

    @auto_prop_cached
    def text_layer_static_ability(self) -> ArtLayer:
        return psd.getLayer(LAYERS.STATIC_ABILITY, self.text_group)

    @auto_prop_cached
    def text_layer_chaos_ability(self) -> ArtLayer:
        return psd.getLayer(LAYERS.CHAOS_ABILITY, self.text_group)

    def basic_text_layers(self):
        """No mana cost, don't scale name layer."""
        self.text.extend([
            text_classes.TextField(
                layer = self.text_layer_name,
                contents = self.layout.name
            ),
            text_classes.ScaledTextField(
                layer = self.text_layer_type,
                contents = self.layout.type_line,
                reference = self.type_reference
            )
        ])

    def rules_text_and_pt_layers(self):

        # Phenomenon card?
        if self.layout.type_line == LAYERS.PHENOMENON:

            # Insert oracle text into static ability layer and disable chaos ability & layer mask on textbox
            self.text.append(
                text_classes.FormattedTextField(
                    layer = self.text_layer_static_ability,
                    contents = self.layout.oracle_text
                )
            )
            psd.enable_mask(psd.getLayerSet(LAYERS.TEXTBOX))
            psd.getLayer(LAYERS.CHAOS_SYMBOL, self.text_group).visible = False
            self.text_layer_chaos_ability.visible = False

        else:

            # Split oracle text on last line break, insert everything before into static, the rest into chaos
            linebreak_index = self.layout.oracle_text.rindex("\n")
            self.text.extend([
                text_classes.FormattedTextField(
                    layer = self.text_layer_static_ability,
                    contents = self.layout.oracle_text[0:linebreak_index]
                ),
                text_classes.FormattedTextField(
                    layer = self.text_layer_chaos_ability,
                    contents = self.layout.oracle_text[linebreak_index+1:]
                ),
            ])

    def paste_scryfall_scan(self, rotate: bool = False, visible: bool = False) -> Optional[ArtLayer]:
        """Ensure we rotate the scan for Planar cards."""
        return super().paste_scryfall_scan(rotate=True, visible=visible)

Functions

basic_text_layers()

No mana cost, don't scale name layer.

Source code in src\templates\planar.py
43
44
45
46
47
48
49
50
51
52
53
54
55
def basic_text_layers(self):
    """No mana cost, don't scale name layer."""
    self.text.extend([
        text_classes.TextField(
            layer = self.text_layer_name,
            contents = self.layout.name
        ),
        text_classes.ScaledTextField(
            layer = self.text_layer_type,
            contents = self.layout.type_line,
            reference = self.type_reference
        )
    ])

paste_scryfall_scan(rotate: bool = False, visible: bool = False) -> Optional[ArtLayer]

Ensure we rotate the scan for Planar cards.

Source code in src\templates\planar.py
88
89
90
def paste_scryfall_scan(self, rotate: bool = False, visible: bool = False) -> Optional[ArtLayer]:
    """Ensure we rotate the scan for Planar cards."""
    return super().paste_scryfall_scan(rotate=True, visible=visible)