Bases: StarterTemplate
Utility Template containing the most common "batteries included" functionality.
Notes
- Adds remaining logic that is required for any normal M15 style card, including:
- Rules and PT text.
- Enabling typical frame layers.
- Enabling the legendary crown / hollow crown if supported.
- Extend this template for broad support of most typical card functionality.
Source code in src\templates\_core.py
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666 | class NormalTemplate(StarterTemplate):
"""Utility Template containing the most common "batteries included" functionality.
Notes:
- Adds remaining logic that is required for any normal M15 style card, including:
- Rules and PT text.
- Enabling typical frame layers.
- Enabling the legendary crown / hollow crown if supported.
- Extend this template for broad support of most typical card functionality.
"""
@auto_prop_cached
def is_fullart(self) -> bool:
"""Colorless cards use Fullart reference."""
return self.is_colorless
"""
* Text Layer Methods
"""
def rules_text_and_pt_layers(self) -> None:
"""Add rules and power/toughness text."""
self.text.extend([
FormattedTextArea(
layer=self.text_layer_rules,
contents=self.layout.oracle_text,
flavor=self.layout.flavor_text,
reference=self.textbox_reference,
divider=self.divider_layer,
pt_reference=self.pt_reference,
centered=self.is_centered
),
TextField(
layer=self.text_layer_pt,
contents=f"{self.layout.power}/{self.layout.toughness}"
) if self.is_creature else None
])
"""
* Frame Layer Methods
"""
def enable_frame_layers(self) -> None:
"""Enable layers which make-up the frame of the card."""
# Twins
if self.twins_layer:
self.twins_layer.visible = True
# PT Box
if self.is_creature and self.pt_layer:
self.pt_layer.visible = True
# Pinlines
if self.pinlines_layer:
self.pinlines_layer.visible = True
# Color Indicator
if self.is_type_shifted and self.color_indicator_layer:
self.color_indicator_layer.visible = True
# Background
if self.background_layer:
self.background_layer.visible = True
# Legendary crown
if self.is_legendary and self.crown_layer:
self.enable_crown()
def enable_crown(self) -> None:
"""Enable layers which make-up the Legendary crown."""
# Enable crown and legendary border
self.crown_layer.visible = True
if self.border_group and isinstance(self.border_group, LayerContainer):
psd.getLayer(LAYERS.NORMAL_BORDER, self.border_group).visible = False
psd.getLayer(LAYERS.LEGENDARY_BORDER, self.border_group).visible = True
# Call hollow crown step
if self.is_hollow_crown:
self.enable_hollow_crown(
psd.getLayer(LAYERS.SHADOWS))
def enable_hollow_crown(self, shadows: Optional[ArtLayer] = None) -> None:
"""Enable the hollow legendary crown."""
if shadows:
psd.enable_mask(shadows)
psd.enable_mask(self.crown_layer.parent)
psd.enable_mask(self.pinlines_layer.parent)
self.crown_shadow_layer.visible = True
|
Functions
enable_crown() -> None
Enable layers which make-up the Legendary crown.
Source code in src\templates\_core.py
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658 | def enable_crown(self) -> None:
"""Enable layers which make-up the Legendary crown."""
# Enable crown and legendary border
self.crown_layer.visible = True
if self.border_group and isinstance(self.border_group, LayerContainer):
psd.getLayer(LAYERS.NORMAL_BORDER, self.border_group).visible = False
psd.getLayer(LAYERS.LEGENDARY_BORDER, self.border_group).visible = True
# Call hollow crown step
if self.is_hollow_crown:
self.enable_hollow_crown(
psd.getLayer(LAYERS.SHADOWS))
|
enable_frame_layers() -> None
Enable layers which make-up the frame of the card.
Source code in src\templates\_core.py
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644 | def enable_frame_layers(self) -> None:
"""Enable layers which make-up the frame of the card."""
# Twins
if self.twins_layer:
self.twins_layer.visible = True
# PT Box
if self.is_creature and self.pt_layer:
self.pt_layer.visible = True
# Pinlines
if self.pinlines_layer:
self.pinlines_layer.visible = True
# Color Indicator
if self.is_type_shifted and self.color_indicator_layer:
self.color_indicator_layer.visible = True
# Background
if self.background_layer:
self.background_layer.visible = True
# Legendary crown
if self.is_legendary and self.crown_layer:
self.enable_crown()
|
enable_hollow_crown(shadows: Optional[ArtLayer] = None) -> None
Enable the hollow legendary crown.
Source code in src\templates\_core.py
1660
1661
1662
1663
1664
1665
1666 | def enable_hollow_crown(self, shadows: Optional[ArtLayer] = None) -> None:
"""Enable the hollow legendary crown."""
if shadows:
psd.enable_mask(shadows)
psd.enable_mask(self.crown_layer.parent)
psd.enable_mask(self.pinlines_layer.parent)
self.crown_shadow_layer.visible = True
|
is_fullart() -> bool
Colorless cards use Fullart reference.
Source code in src\templates\_core.py
| @auto_prop_cached
def is_fullart(self) -> bool:
"""Colorless cards use Fullart reference."""
return self.is_colorless
|
rules_text_and_pt_layers() -> None
Add rules and power/toughness text.
Source code in src\templates\_core.py
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613 | def rules_text_and_pt_layers(self) -> None:
"""Add rules and power/toughness text."""
self.text.extend([
FormattedTextArea(
layer=self.text_layer_rules,
contents=self.layout.oracle_text,
flavor=self.layout.flavor_text,
reference=self.textbox_reference,
divider=self.divider_layer,
pt_reference=self.pt_reference,
centered=self.is_centered
),
TextField(
layer=self.text_layer_pt,
contents=f"{self.layout.power}/{self.layout.toughness}"
) if self.is_creature else None
])
|