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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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 | class LevelerMod(NormalTemplate):
"""
* Modifier for Level-Up cards introduced in Rise of the Eldrazi.
Adds:
* First, second, and third level ability text.
* First, second, and third level power/toughness.
* Level requirements for second and third stage.
"""
"""
* Mixin Methods
"""
@auto_prop_cached
def text_layer_methods(self) -> list[Callable]:
"""Add Adventure text layers."""
funcs = [self.text_layers_leveler] if isinstance(self.layout, LevelerLayout) else []
return [*super().text_layer_methods, *funcs]
"""
* Groups
"""
@auto_prop_cached
def leveler_group(self) -> Optional[LayerSet]:
"""Group containing Leveler text layers."""
return psd.getLayerSet("Leveler Text", self.text_group)
"""
* Layers
"""
@auto_prop_cached
def pt_layer(self) -> Optional[ArtLayer]:
return psd.getLayer(self.twins, LAYERS.PT_AND_LEVEL_BOXES)
"""
* Text Layers
"""
@auto_prop_cached
def text_layer_rules(self) -> Optional[ArtLayer]:
return psd.getLayer("Rules Text - Level Up", self.leveler_group)
@auto_prop_cached
def text_layer_pt(self) -> Optional[ArtLayer]:
return psd.getLayer("Top Power / Toughness", self.leveler_group)
"""
* Leveler Text Layers
"""
@auto_prop_cached
def text_layer_rules_x_y(self) -> Optional[ArtLayer]:
return psd.getLayer("Rules Text - Levels X-Y", self.leveler_group)
@auto_prop_cached
def text_layer_rules_z(self) -> Optional[ArtLayer]:
return psd.getLayer("Rules Text - Levels Z+", self.leveler_group)
@auto_prop_cached
def text_layer_level_middle(self) -> Optional[ArtLayer]:
return psd.getLayer("Middle Level", self.leveler_group)
@auto_prop_cached
def text_layer_level_bottom(self) -> Optional[ArtLayer]:
return psd.getLayer("Bottom Level", self.leveler_group)
@auto_prop_cached
def text_layer_pt_middle(self) -> Optional[ArtLayer]:
return psd.getLayer("Middle Power / Toughness", self.leveler_group)
@auto_prop_cached
def text_layer_pt_bottom(self) -> Optional[ArtLayer]:
return psd.getLayer("Bottom Power / Toughness", self.leveler_group)
"""
* References
"""
@auto_prop_cached
def textbox_reference(self) -> Optional[ArtLayer]:
return psd.get_reference_layer(f'{LAYERS.TEXTBOX_REFERENCE} - Level Text', self.leveler_group)
"""
* Leveler References
"""
@auto_prop_cached
def textbox_reference_x_y(self) -> Optional[ArtLayer]:
return psd.get_reference_layer(f'{LAYERS.TEXTBOX_REFERENCE} - Level X-Y', self.leveler_group)
@auto_prop_cached
def textbox_reference_z(self) -> Optional[ArtLayer]:
return psd.get_reference_layer(f'{LAYERS.TEXTBOX_REFERENCE} - Levels Z+', self.leveler_group)
"""
* Leveler Text Methods
"""
def rules_text_and_pt_layers(self) -> None:
"""Add rules and power/toughness text."""
# Level-Up text and starting P/T
self.text.extend([
text_classes.FormattedTextArea(
layer=self.text_layer_rules,
contents=self.layout.level_up_text,
reference=self.textbox_reference
),
text_classes.TextField(
layer=self.text_layer_pt,
contents=str(self.layout.power) + "/" + str(self.layout.toughness)
)
])
def text_layers_leveler(self):
"""Add and modify text layers required by Leveler cards."""
# Add Leveler sections
self.text.extend([
# Level 2
text_classes.TextField(
layer=self.text_layer_level_middle,
contents=self.layout.middle_level
),
text_classes.TextField(
layer=self.text_layer_pt_middle,
contents=self.layout.middle_power_toughness
),
text_classes.FormattedTextArea(
layer=self.text_layer_rules_x_y,
contents=self.layout.middle_text,
reference=self.textbox_reference_x_y
),
# Level 3
text_classes.TextField(
layer=self.text_layer_level_bottom,
contents=self.layout.bottom_level
),
text_classes.TextField(
layer=self.text_layer_pt_bottom,
contents=self.layout.bottom_power_toughness
),
text_classes.FormattedTextArea(
layer=self.text_layer_rules_z,
contents=self.layout.bottom_text,
reference=self.textbox_reference_z
)
])
|