feat: champion features

This commit is contained in:
2024-05-26 19:58:10 +02:00
parent fbd7222f05
commit ba5c35368d
8 changed files with 251 additions and 8 deletions
+157
View File
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="59.500008mm"
height="79.500008mm"
viewBox="0 0 59.500008 79.500008"
version="1.1"
id="svg1"
sodipodi:docname="Unnamed document 1"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#505050"
bordercolor="#ffffff"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#505050"
inkscape:document-units="mm"
showgrid="true">
<inkscape:grid
id="grid1"
units="mm"
originx="-75.249997"
originy="-72.249997"
spacingx="0.99999998"
spacingy="1"
empcolor="#0099e5"
empopacity="0.30196078"
color="#0099e5"
opacity="0.14901961"
empspacing="5"
dotted="false"
gridanglex="30"
gridanglez="30"
visible="true"
enabled="true" />
</sodipodi:namedview>
<defs
id="defs1">
<inkscape:path-effect
effect="mirror_symmetry"
start_point="62.136614,73.509798"
end_point="62.136614,153.00981"
center_point="62.136614,113.2598"
id="path-effect21"
is_visible="true"
lpeversion="1.2"
lpesatellites=""
mode="vertical"
discard_orig_path="false"
fuse_paths="false"
oposite_fuse="false"
split_items="false"
split_open="false"
link_styles="false" />
<inkscape:path-effect
effect="mirror_symmetry"
start_point="62.136614,73.509798"
end_point="62.136614,153.00981"
center_point="62.136614,113.2598"
id="path-effect19"
is_visible="true"
lpeversion="1.2"
lpesatellites=""
mode="vertical"
discard_orig_path="false"
fuse_paths="false"
oposite_fuse="false"
split_items="false"
split_open="false"
link_styles="false" />
<inkscape:path-effect
effect="mirror_symmetry"
start_point="62.136614,73.509798"
end_point="62.136614,153.00981"
center_point="62.136614,113.2598"
id="path-effect7"
is_visible="true"
lpeversion="1.2"
lpesatellites=""
mode="vertical"
discard_orig_path="false"
fuse_paths="false"
oposite_fuse="false"
split_items="false"
split_open="false"
link_styles="false" />
</defs>
<g
inkscape:label="Stroke"
inkscape:groupmode="layer"
id="layer1"
style="display:inline"
transform="translate(-75.249994,-72.249998)">
<path
style="display:inline;opacity:1;fill:#a0a0a0;fill-opacity:1;stroke:none;stroke-width:3.5;stroke-dasharray:none;stroke-opacity:1"
d="m 62.136618,151.2598 h 15.000001 c 0,0 13,-12 13,-18 0,-13 -1,-20 -18,-34.000003 v -8 h -4 4 c 5,0 5,-7 0,-7 h -10.000001 7.000001 l 3,-8.999999 H 62.136618 m -8e-6,76.000002 H 47.136609 c 0,0 -13,-12 -13,-18 0,-13 1,-20 18,-34.000003 v -8 h 4 -4 c -5,0 -5,-7 0,-7 H 62.13661 55.136609 l -3,-8.999999 H 62.13661"
id="Fill"
sodipodi:nodetypes="ccsccccccccc"
transform="translate(42.863384,-1.2597997)"
inkscape:original-d="m 62.136618,151.2598 h 15.000001 c 0,0 13,-12 13,-18 0,-13 -1,-20 -18,-34.000003 v -8 h -4 4 c 5,0 5,-7 0,-7 h -10.000001 7.000001 l 3,-8.999999 H 62.136618"
inkscape:path-effect="#path-effect7"
inkscape:highlight-color="#47e661"
inkscape:label="Fill" />
<path
style="display:inline;opacity:1;fill:#83b229;fill-opacity:1;stroke:none;stroke-width:3.5;stroke-dasharray:none;stroke-opacity:1"
d="m 62.136618,151.2598 h 15.000001 c 0,0 13,-12 13,-18 0,-13 -2,-22 -18,-34.000003 -2.345162,0.366674 -4.685658,0.58873 -7.000001,0 -1.716931,-0.618631 -2.013396,-0.567824 -3.000002,-0.649209 m -6e-6,52.649212 H 47.136609 c 0,0 -13,-12 -13,-18 0,-13 2,-22 18,-34.000003 2.345162,0.366674 4.685658,0.58873 7.000001,0 1.716931,-0.618631 2.013396,-0.567824 3.000002,-0.649209"
id="path19"
sodipodi:nodetypes="ccsccc"
transform="translate(42.863384,-1.2597997)"
inkscape:original-d="m 62.136618,151.2598 h 15.000001 c 0,0 13,-12 13,-18 0,-13 -2,-22 -18,-34.000003 -2.345162,0.366674 -4.685658,0.58873 -7.000001,0 -1.716931,-0.618631 -2.013396,-0.567824 -3.000002,-0.649209"
inkscape:path-effect="#path-effect21"
inkscape:highlight-color="#000000"
inkscape:label="path19" />
<path
style="display:inline;opacity:1;fill:#967a3e;fill-opacity:1;stroke:none;stroke-width:3.49999;stroke-dasharray:none;stroke-opacity:1"
d="M 95.000002,73.999997 H 115 l -3,9 H 97.999996 l -2.999994,-9"
id="Bouchon"
inkscape:highlight-color="#9f633c" />
<path
style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:3.5;stroke-dasharray:none;stroke-opacity:1"
d="m 62.136618,151.2598 h 15.000001 c 0,0 13,-12 13,-18 0,-13 -1,-20 -18,-34.000003 v -8 h -4 4 c 5,0 5,-7 0,-7 h -10.000001 7.000001 l 3,-8.999999 H 62.136618 m -8e-6,76.000002 H 47.136609 c 0,0 -13,-12 -13,-18 0,-13 1,-20 18,-34.000003 v -8 h 4 -4 c -5,0 -5,-7 0,-7 H 62.13661 55.136609 l -3,-8.999999 H 62.13661"
id="Stroke"
sodipodi:nodetypes="ccsccccccccc"
transform="translate(42.863384,-1.2597997)"
inkscape:original-d="m 62.136618,151.2598 h 15.000001 c 0,0 13,-12 13,-18 0,-13 -1,-20 -18,-34.000003 v -8 h -4 4 c 5,0 5,-7 0,-7 h -10.000001 7.000001 l 3,-8.999999 H 62.136618"
inkscape:path-effect="#path-effect19"
inkscape:highlight-color="#000000" />
<ellipse
style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:6.99998;stroke-dasharray:none;stroke-opacity:1"
id="path23"
cx="101.0117"
cy="77.499992"
rx="0.99999881"
ry="1.0000011" />
<ellipse
style="display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:6.99998;stroke-dasharray:none;stroke-opacity:1"
id="path23-9"
cx="105"
cy="79"
rx="0.99999881"
ry="1.0000011" />
<ellipse
style="display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:6.99998;stroke-dasharray:none;stroke-opacity:1"
id="path23-9-4"
cx="108.9883"
cy="77.499992"
rx="0.99999881"
ry="1.0000011" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

+2
View File
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" ?>
<svg baseProfile="tiny" height="417px" version="1.2" width="298px" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><linearGradient id="grad1" x1="0" x2="1" y1="0" y2="0"><stop offset="0" stop-color="yellow" stop-opacity="1" /><stop offset="1" stop-color="yellow" stop-opacity="0" /></linearGradient><linearGradient id="grad2" x1="0" x2="0" y1="1" y2="0"><stop offset="0" stop-color="#ff9935" stop-opacity="1" /><stop offset="1" stop-color="#ffe744" stop-opacity="1" /></linearGradient></defs><rect fill="black" height="417px" rx="15" ry="18" width="298px" x="0" y="0" /><rect fill="rgb(206, 182, 167)" height="388px" rx="0" ry="0" width="274px" x="12" y="12" /><text fill="black" font-family="Helvetica" font-size="16px" font-weight="bold" text-anchor="middle" x="149.0" y="36">Arkus, Imperial Dragon</text><text fill="black" font-family="Helvetica" font-size="13px" text-anchor="middle" x="149.0" y="53">Champion</text><circle cx="36" cy="37" fill="black" r="20" /><circle cx="35" cy="36" fill="url(#grad2)" r="20" /><circle cx="262" cy="38" fill="rgb(202, 129, 25)" r="21" /><circle cx="260" cy="36" fill="yellow" r="20" /><text fill="black" font-family="Helvetica" font-size="24px" font-weight="bold" text-anchor="middle" x="260" y="43">8</text><rect fill="black" height="200px" width="298px" x="0" y="65" /><image height="200" width="298" x="0" xlink:href="../../img/missing.png" y="65" /><rect fill="url(#grad1)" height="135px" width="30px" x="12" y="265" /><circle cx="48" cy="301" fill="#111" r="15" /><circle cx="47" cy="300" fill="#555" r="15" /><circle cx="129.0" cy="302" fill="red" r="22" /><text fill="white" font-family="Helvetica" font-size="24px" font-weight="bold" text-anchor="middle" x="129.0" y="311">5</text><line stroke="black" stroke-width="1" x1="20" x2="278" y1="345" y2="345" /><circle cx="48" cy="371" fill="black" r="15" /><circle cx="47" cy="370" fill="url(#grad2)" r="15" /><circle cx="149.0" cy="372" fill="green" r="22" /><text fill="white" font-family="Helvetica" font-size="24px" font-weight="bold" text-anchor="middle" x="149.0" y="381">6</text><text fill="black" font-family="Helvetica" font-size="14px" text-anchor="middle" x="149.0" y="375" /><polygon fill="black" points="271.0,415.0 244.3704,395.6525 254.542,364.3475 287.458,364.3475 297.6296,395.6525" stroke="lightgrey" stroke-width="1" /><rect fill="lightgrey" height="17" width="49" x="246" y="345" /><rect fill="#111" height="15" width="47" x="247" y="346" /><text fill="white" font-family="Helvetica" font-size="12px" font-weight="bold" text-anchor="middle" x="271" y="358">Garde</text><text fill="white" font-family="Helvetica" font-size="28px" font-weight="bold" text-anchor="middle" x="271" y="397">6</text></svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

+1 -1
View File
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<svg baseProfile="tiny" height="417px" version="1.2" width="298px" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><linearGradient id="grad1" x1="0" x2="1" y1="0" y2="0"><stop offset="0" stop-color="yellow" stop-opacity="1" /><stop offset="1" stop-color="yellow" stop-opacity="0" /></linearGradient><linearGradient id="grad2" x1="0" x2="0" y1="1" y2="0"><stop offset="0" stop-color="#ff9935" stop-opacity="1" /><stop offset="1" stop-color="#ffe744" stop-opacity="1" /></linearGradient></defs><rect fill="black" height="417px" rx="15" ry="18" width="298px" x="0" y="0" /><rect fill="rgb(206, 182, 167)" height="388px" rx="0" ry="0" width="274px" x="12" y="12" /><text fill="black" font-family="Helvetica" font-size="19px" font-weight="bold" text-anchor="middle" x="149.0" y="36">Rallier les Troupes</text><text fill="black" font-family="Helvetica" font-size="13px" text-anchor="middle" x="149.0" y="53">Action, Charme</text><circle cx="36" cy="37" fill="black" r="20" /><circle cx="35" cy="36" fill="url(#grad2)" r="20" /><circle cx="262" cy="38" fill="rgb(202, 129, 25)" r="21" /><circle cx="260" cy="36" fill="yellow" r="20" /><text fill="black" font-family="Helvetica" font-size="24px" font-weight="bold" text-anchor="middle" x="260" y="43">4</text><rect fill="black" height="200px" width="298px" x="0" y="65" /><image height="200" width="298" x="0" xlink:href="img/skins/heron/010.png" y="65" /><rect fill="url(#grad1)" height="135px" width="30px" x="12" y="265" /><circle cx="129.0" cy="302" fill="green" r="22" /><text fill="white" font-family="Helvetica" font-size="24px" font-weight="bold" text-anchor="middle" x="129.0" y="311">5</text><circle cx="189.0" cy="302" fill="red" r="22" /><text fill="white" font-family="Helvetica" font-size="24px" font-weight="bold" text-anchor="middle" x="189.0" y="311">5</text><line stroke="black" stroke-width="1" x1="20" x2="278" y1="345" y2="345" /><circle cx="48" cy="371" fill="black" r="15" /><circle cx="47" cy="370" fill="url(#grad2)" r="15" /><text fill="black" font-family="Helvetica" font-size="14px" text-anchor="middle" x="149.0" y="375">Mobilisez un champion.</text></svg> <svg baseProfile="tiny" height="417px" version="1.2" width="298px" xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><linearGradient id="grad1" x1="0" x2="1" y1="0" y2="0"><stop offset="0" stop-color="yellow" stop-opacity="1" /><stop offset="1" stop-color="yellow" stop-opacity="0" /></linearGradient><linearGradient id="grad2" x1="0" x2="0" y1="1" y2="0"><stop offset="0" stop-color="#ff9935" stop-opacity="1" /><stop offset="1" stop-color="#ffe744" stop-opacity="1" /></linearGradient></defs><rect fill="black" height="417px" rx="15" ry="18" width="298px" x="0" y="0" /><rect fill="rgb(206, 182, 167)" height="388px" rx="0" ry="0" width="274px" x="12" y="12" /><text fill="black" font-family="Helvetica" font-size="19px" font-weight="bold" text-anchor="middle" x="149.0" y="36">Rallier les Troupes</text><text fill="black" font-family="Helvetica" font-size="13px" text-anchor="middle" x="149.0" y="53">Action, Charme</text><circle cx="36" cy="37" fill="black" r="20" /><circle cx="35" cy="36" fill="url(#grad2)" r="20" /><circle cx="262" cy="38" fill="rgb(202, 129, 25)" r="21" /><circle cx="260" cy="36" fill="yellow" r="20" /><text fill="black" font-family="Helvetica" font-size="24px" font-weight="bold" text-anchor="middle" x="260" y="43">4</text><rect fill="black" height="200px" width="298px" x="0" y="65" /><image height="200" width="298" x="0" xlink:href="../../img/skins/heron/010.png" y="65" /><rect fill="url(#grad1)" height="135px" width="30px" x="12" y="265" /><circle cx="129.0" cy="302" fill="green" r="22" /><text fill="white" font-family="Helvetica" font-size="24px" font-weight="bold" text-anchor="middle" x="129.0" y="311">5</text><circle cx="189.0" cy="302" fill="red" r="22" /><text fill="white" font-family="Helvetica" font-size="24px" font-weight="bold" text-anchor="middle" x="189.0" y="311">5</text><line stroke="black" stroke-width="1" x1="20" x2="278" y1="345" y2="345" /><circle cx="48" cy="371" fill="black" r="15" /><circle cx="47" cy="370" fill="url(#grad2)" r="15" /><text fill="black" font-family="Helvetica" font-size="14px" text-anchor="middle" x="149.0" y="375">Mobilisez un champion.</text></svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

+28
View File
@@ -1,5 +1,33 @@
{ {
"cards": [ "cards": [
{
"id": 1,
"role": "market",
"card_type": "champion",
"faction": "yellow",
"name": "Arkus, Imperial Dragon",
"cost": 8,
"defense": 6,
"guard": true,
"init_amount": 1,
"effects": [
{
"effect": "draw",
"amount": 1,
"effect_type": "champion_action"
},
{
"effect": "damage",
"amount": 5,
"effect_type": "champion_action"
},
{
"effect": "heal",
"amount": 6,
"effect_type": "faction_combo"
}
]
},
{ {
"id": 13, "id": 13,
"role": "market", "role": "market",
+3 -3
View File
@@ -2,12 +2,12 @@
"skin_name": "heron", "skin_name": "heron",
"10": { "10": {
"title": "Rallier les Troupes", "title": "Rallier les Troupes",
"type": "Action, Charme", "flavor_text_type": "Charme",
"image_path": "img/skins/heron/010.png" "image_path": "../../img/skins/heron/010.png"
}, },
"13": { "13": {
"title": "Caprisun", "title": "Caprisun",
"type": "Action, 20cl", "flavor_text_type": "20cl",
"image_path": "lancersiz3.png" "image_path": "lancersiz3.png"
} }
} }
+9
View File
@@ -1,4 +1,5 @@
from typing import List from typing import List
from math import sin, cos, pi
stats_radius = 22 stats_radius = 22
@@ -34,3 +35,11 @@ def draw_effects_resources_for_row(dwg, effects: List, y: int, x_width: int):
dwg.add(dwg.circle(center=(x_effect_pos, y + stats_radius), r=stats_radius, fill='green')) dwg.add(dwg.circle(center=(x_effect_pos, y + stats_radius), r=stats_radius, fill='green'))
dwg.add(dwg.text(str(effect.get('amount')), insert=(x_effect_pos, y + stats_radius + 9), text_anchor='middle', fill='white', font_size='24px', font_weight="bold", font_family='Helvetica')) dwg.add(dwg.text(str(effect.get('amount')), insert=(x_effect_pos, y + stats_radius + 9), text_anchor='middle', fill='white', font_size='24px', font_weight="bold", font_family='Helvetica'))
row_1_nb_effects_applied += 1 row_1_nb_effects_applied += 1
def create_pentagon(center, radius):
points = []
for i in range(5):
x = center[0] + radius * cos(2 * pi * i / 5 + (pi / 2))
y = center[1] + radius * sin(2 * pi * i / 5 + (pi / 2))
points.append((x, y))
return points
+51 -4
View File
@@ -3,7 +3,7 @@ import json
from typing import List from typing import List
import os import os
from draw import draw_effects_resources_for_row from draw import create_pentagon, draw_effects_resources_for_row
with open('src/data/heron_skin.json') as f: with open('src/data/heron_skin.json') as f:
@@ -17,6 +17,7 @@ border_width_y = 17
border_upper_offset = 5 border_upper_offset = 5
title_y_offset = 24 title_y_offset = 24
title_font_size = 19 title_font_size = 19
title_font_size_small = 16
subtitle_font_size = 13 subtitle_font_size = 13
cost_right_offset = 38 cost_right_offset = 38
effect_text_size = 14 effect_text_size = 14
@@ -50,7 +51,11 @@ with open('src/data/cards_data.json') as f:
for card_data in cards: for card_data in cards:
# Get card skin data # Get card skin data
card_skin_data = all_skin_data[str(card_data['id'])] try:
card_skin_data = all_skin_data[str(card_data['id'])]
except KeyError:
print('Missing skin data for card id:', card_data['id'], 'using default skin data')
card_skin_data = { 'title': card_data['name'], 'image_path': '../../img/missing.png'}
# Create a new SVG drawing # Create a new SVG drawing
output_dir = 'output/' + all_skin_data['skin_name'] output_dir = 'output/' + all_skin_data['skin_name']
@@ -83,10 +88,23 @@ for card_data in cards:
# Draw title area # Draw title area
# dwg.add(dwg.rect(insert=(0, 0), size=(str(x_width) + 'px', '50px'), fill='white')) # dwg.add(dwg.rect(insert=(0, 0), size=(str(x_width) + 'px', '50px'), fill='white'))
dwg.add(dwg.text(card_skin_data['title'], insert=(x_width/2, title_y_offset + border_width_y - border_upper_offset), text_anchor='middle', fill='black', font_size=str(title_font_size) + 'px', font_weight="bold", font_family='Helvetica')) card_title = card_skin_data['title']
temp_title_font_size = title_font_size
if len(card_title) > 20:
temp_title_font_size = title_font_size_small
if len(card_title) > 23:
temp_title_font_size = title_font_size_small - 2
dwg.add(dwg.text(card_skin_data['title'], insert=(x_width/2, title_y_offset + border_width_y - border_upper_offset), text_anchor='middle', fill='black', font_size=str(temp_title_font_size) + 'px', font_weight="bold", font_family='Helvetica'))
# Draw type area # Draw type area
dwg.add(dwg.text(card_skin_data['type'], insert=(x_width/2, title_y_offset + title_font_size + 10), text_anchor='middle', fill='black', font_size=str(subtitle_font_size) + 'px', font_family='Helvetica')) card_type_text = ""
if card_data['card_type'] == 'champion':
card_type_text = "Champion"
elif card_data['card_type'] == 'action':
card_type_text = "Action"
if 'flavor_text_type' in card_skin_data.keys():
card_type_text += ', ' + card_skin_data['flavor_text_type']
dwg.add(dwg.text(card_type_text, insert=(x_width/2, title_y_offset + title_font_size + 10), text_anchor='middle', fill='black', font_size=str(subtitle_font_size) + 'px', font_family='Helvetica'))
# Draw faction icon # Draw faction icon
dwg.add(dwg.circle(center=(border_width_x + 23 + 1, border_width_y - border_upper_offset + 20 + 4 + 1), r=20, fill='black')) dwg.add(dwg.circle(center=(border_width_x + 23 + 1, border_width_y - border_upper_offset + 20 + 4 + 1), r=20, fill='black'))
@@ -104,6 +122,12 @@ for card_data in cards:
dwg.add(dwg.rect(insert=(border_width_x, 265), size=(str(30) + 'px', str(y_height - 265 - border_width_y) + 'px'), fill='url(#grad1)')) dwg.add(dwg.rect(insert=(border_width_x, 265), size=(str(30) + 'px', str(y_height - 265 - border_width_y) + 'px'), fill='url(#grad1)'))
# If champion, draw champion action icon
if card_data['card_type'] == 'champion':
row_1_icon_x = border_width_x + 35
dwg.add(dwg.circle(center=(row_1_icon_x + 1, row_1_base_y + 20 + 1), r=15, fill='#111'))
dwg.add(dwg.circle(center=(row_1_icon_x, row_1_base_y + 20), r=15, fill='#555'))
# TODO: figure out nb of effects and adjust row_1_x_offset accordingly # TODO: figure out nb of effects and adjust row_1_x_offset accordingly
def is_base_effect(array: List): def is_base_effect(array: List):
return not 'effect_type' in array.keys() or array['effect_type'] == 'champion_action' return not 'effect_type' in array.keys() or array['effect_type'] == 'champion_action'
@@ -117,6 +141,9 @@ for card_data in cards:
# Draw row 1 stats # Draw row 1 stats
draw_effects_resources_for_row(dwg, base_effects, row_1_base_y, x_width) draw_effects_resources_for_row(dwg, base_effects, row_1_base_y, x_width)
# Draw row 1 text
effect_text_1 = ""
if other_effects: if other_effects:
# Draw row 1 to row 2 separator # Draw row 1 to row 2 separator
@@ -139,5 +166,25 @@ for card_data in cards:
effect_text_2 = "Mobilisez un champion." effect_text_2 = "Mobilisez un champion."
dwg.add(dwg.text(effect_text_2, insert=(x_width/2, row_2_base_y), text_anchor='middle', fill='black', font_size=str(effect_text_size) + 'px', font_family='Helvetica')) dwg.add(dwg.text(effect_text_2, insert=(x_width/2, row_2_base_y), text_anchor='middle', fill='black', font_size=str(effect_text_size) + 'px', font_family='Helvetica'))
# If champion, draw champion shield with defense
if card_data['card_type'] == 'champion':
if not card_data['guard']:
pentagon_points = create_pentagon(center=(x_width - border_width_x - 15, y_height - 30), radius=28)
dwg.add(dwg.polygon(points=pentagon_points, fill='darkgrey', stroke='#eee', stroke_width=1))
# dwg.add(dwg.circle(center=(x_width - border_width_x - 15, y_height - 30), r=27, fill='darkgrey'))
# dwg.add(dwg.circle(center=(x_width - border_width_x - 15, y_height - 30), r=25, fill='lightgrey'))
dwg.add(dwg.text(str(card_data['defense']), insert=(x_width - border_width_x - 15, y_height - 20), text_anchor='middle', fill='black', font_size='28px', font_weight="bold", font_family='Helvetica'))
else:
pentagon_points = create_pentagon(center=(x_width - border_width_x - 15, y_height - 30), radius=28)
dwg.add(dwg.polygon(points=pentagon_points, fill='black', stroke='lightgrey', stroke_width=1))
# dwg.add(dwg.circle(center=(x_width - border_width_x - 15, y_height - 30), r=27, fill='lightgrey'))
# dwg.add(dwg.circle(center=(x_width - border_width_x - 15, y_height - 30), r=25, fill='#111'))
# Draw guard rectangle with text inside, above the shield
dwg.add(dwg.rect(insert=(x_width - border_width_x - 40, y_height - 72), size=(49, 17), fill='lightgrey'))
dwg.add(dwg.rect(insert=(x_width - border_width_x - 39, y_height - 71), size=(47, 15), fill='#111'))
dwg.add(dwg.text('Garde', insert=(x_width - border_width_x - 15, y_height - 59), text_anchor='middle', fill='white', font_size='12px', font_weight="bold", font_family='Helvetica'))
dwg.add(dwg.text(str(card_data['defense']), insert=(x_width - border_width_x - 15, y_height - 20), text_anchor='middle', fill='white', font_size='28px', font_weight="bold", font_family='Helvetica'))
# Save the SVG file # Save the SVG file
dwg.save() dwg.save()