Skip to content

AdventureMod

src.templates.adventure.AdventureMod

Bases: NormalTemplate

A modifier class which adds functionality required by Adventure cards, introduced in Throne of Eldraine.

Adds
  • Adventure side text layers (Mana cost, name, typeline, and oracle text) and textbox reference.
Source code in src\templates\adventure.py
 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
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
class AdventureMod(NormalTemplate):
    """A modifier class which adds functionality required by Adventure cards, introduced in Throne of Eldraine.

    Adds:
        * Adventure side text layers (Mana cost, name, typeline, and oracle text) and textbox reference.
    """

    def __init__(self, layout: AdventureLayout, **kwargs):
        super().__init__(layout, **kwargs)

    """
    * Mixin Methods
    """

    @auto_prop_cached
    def text_layer_methods(self) -> list[Callable]:
        """Add Adventure text layers step."""
        funcs = [self.text_layers_adventure] if isinstance(self.layout, AdventureLayout) else []
        return [*super().text_layer_methods, *funcs]

    """
    * Text Layers
    """

    @auto_prop_cached
    def text_layer_name_adventure(self) -> Optional[ArtLayer]:
        """Name for the adventure side."""
        return psd.getLayer(LAYERS.NAME_ADVENTURE, self.text_group)

    @auto_prop_cached
    def text_layer_mana_adventure(self) -> Optional[ArtLayer]:
        """Mana cost for the adventure side."""
        return psd.getLayer(LAYERS.MANA_COST_ADVENTURE, self.text_group)

    @auto_prop_cached
    def text_layer_type_adventure(self) -> Optional[ArtLayer]:
        """Type line for the adventure side."""
        return psd.getLayer(LAYERS.TYPE_LINE_ADVENTURE, self.text_group)

    @auto_prop_cached
    def text_layer_rules_adventure(self) -> Optional[ArtLayer]:
        """Rules text for the adventure side."""
        return psd.getLayer(LAYERS.RULES_TEXT_ADVENTURE, self.text_group)

    @auto_prop_cached
    def divider_layer_adventure(self) -> Optional[ArtLayer]:
        """Flavor divider for the adventure side."""
        return psd.getLayer(LAYERS.DIVIDER_ADVENTURE, self.text_group)

    """
    * References
    """

    @auto_prop_cached
    def textbox_reference_adventure(self) -> Optional[ArtLayer]:
        return psd.get_reference_layer(LAYERS.TEXTBOX_REFERENCE_ADVENTURE, self.text_group)

    """
    * Adventure Methods
    """

    def text_layers_adventure(self):
        # Add adventure text layers
        self.text.extend([
            text_classes.FormattedTextField(
                layer=self.text_layer_mana_adventure,
                contents=self.layout.mana_adventure
            ),
            text_classes.ScaledTextField(
                layer=self.text_layer_name_adventure,
                contents=self.layout.name_adventure,
                reference=self.text_layer_mana_adventure,
            ),
            text_classes.FormattedTextArea(
                layer=self.text_layer_rules_adventure,
                contents=self.layout.oracle_text_adventure,
                reference=self.textbox_reference_adventure,
                flavor=self.layout.flavor_text_adventure,
                centered=False
            ),
            text_classes.TextField(
                layer=self.text_layer_type_adventure,
                contents=self.layout.type_line_adventure
            )
        ])

Functions

divider_layer_adventure() -> Optional[ArtLayer]

Flavor divider for the adventure side.

Source code in src\templates\adventure.py
69
70
71
72
@auto_prop_cached
def divider_layer_adventure(self) -> Optional[ArtLayer]:
    """Flavor divider for the adventure side."""
    return psd.getLayer(LAYERS.DIVIDER_ADVENTURE, self.text_group)

text_layer_mana_adventure() -> Optional[ArtLayer]

Mana cost for the adventure side.

Source code in src\templates\adventure.py
54
55
56
57
@auto_prop_cached
def text_layer_mana_adventure(self) -> Optional[ArtLayer]:
    """Mana cost for the adventure side."""
    return psd.getLayer(LAYERS.MANA_COST_ADVENTURE, self.text_group)

text_layer_methods() -> list[Callable]

Add Adventure text layers step.

Source code in src\templates\adventure.py
39
40
41
42
43
@auto_prop_cached
def text_layer_methods(self) -> list[Callable]:
    """Add Adventure text layers step."""
    funcs = [self.text_layers_adventure] if isinstance(self.layout, AdventureLayout) else []
    return [*super().text_layer_methods, *funcs]

text_layer_name_adventure() -> Optional[ArtLayer]

Name for the adventure side.

Source code in src\templates\adventure.py
49
50
51
52
@auto_prop_cached
def text_layer_name_adventure(self) -> Optional[ArtLayer]:
    """Name for the adventure side."""
    return psd.getLayer(LAYERS.NAME_ADVENTURE, self.text_group)

text_layer_rules_adventure() -> Optional[ArtLayer]

Rules text for the adventure side.

Source code in src\templates\adventure.py
64
65
66
67
@auto_prop_cached
def text_layer_rules_adventure(self) -> Optional[ArtLayer]:
    """Rules text for the adventure side."""
    return psd.getLayer(LAYERS.RULES_TEXT_ADVENTURE, self.text_group)

text_layer_type_adventure() -> Optional[ArtLayer]

Type line for the adventure side.

Source code in src\templates\adventure.py
59
60
61
62
@auto_prop_cached
def text_layer_type_adventure(self) -> Optional[ArtLayer]:
    """Type line for the adventure side."""
    return psd.getLayer(LAYERS.TYPE_LINE_ADVENTURE, self.text_group)