feat: 1st version of icons: champion, trash, yellow faction (so far)
release-tag / release-image (push) Has been cancelled

This commit is contained in:
2026-03-15 16:23:18 +01:00
parent 1410f02e0b
commit 8a024929bc
2 changed files with 79 additions and 1 deletions
+75 -1
View File
@@ -1,4 +1,6 @@
from math import sin, cos, pi
from typing import Optional
import drawsvg as dw
import json
@@ -26,6 +28,7 @@ def is_base_effect(effect: Effect):
def create_icon(
amount: int,
fill_circle: str,
outline_circle: Optional[str] = None,
effect_id: str | None = None,
fill_text: str = "black",
radius: float = stats_radius,
@@ -35,7 +38,9 @@ def create_icon(
else:
click_function = js_event_function(effect_id)
group = dw.Group(**{"class": "svg_resource_icon", "v-on:click": click_function})
group.append(dw.Circle(cx=0, cy=0, r=radius, fill=fill_circle, x=0, y=0))
if outline_circle:
group.append(dw.Circle(cx=0, cy=0, r=radius, fill=outline_circle, x=0, y=0))
group.append(dw.Circle(cx=0, cy=0, r=radius-2, fill=fill_circle, x=0, y=0))
group.append(
dw.Text(
str(amount),
@@ -58,6 +63,7 @@ def create_damage_icon(
amount,
radius=radius,
fill_circle="red",
outline_circle="black",
fill_text="white",
effect_id=effect_id,
)
@@ -70,6 +76,7 @@ def create_heal_icon(
amount,
radius=radius,
fill_circle="green",
outline_circle="black",
fill_text="white",
effect_id=effect_id,
)
@@ -82,6 +89,7 @@ def create_gold_icon(
amount,
radius=radius,
fill_circle="yellow",
outline_circle="goldenrod",
effect_id=effect_id,
)
@@ -313,6 +321,31 @@ def create_effect_text(
return group
def create_arrow():
return dw.Lines(7, 10,
7, -5,
-5, -5,
-5, -9,
-10, -2,
-5, 4,
-5, 0,
2, 0,
2, 10,
stroke='black', fill='white', close='true')
def create_faction_icon(faction: str, transform: str = None):
if faction == "yellow":
return dw.Lines(9, 0,
2, -2,
0, -5,
-2, -2,
-9, 0,
-2, 2,
0, 5,
2, 2,
stroke='grey', fill='white', close='true', transform=transform)
def create_effect_row(
card: Card, effects: list[Effect], type: str, height: int, width: int
@@ -330,6 +363,9 @@ def create_effect_row(
filter="url(#drop-shadow)",
)
)
subg = dw.Group(transform=f"translate({30},{height / 2})")
subg.append(create_faction_icon(faction="yellow"))
group.append(subg)
elif type == "suicide":
has_icon = True
group.append(
@@ -341,6 +377,30 @@ def create_effect_row(
filter="url(#drop-shadow)",
)
)
group.append(
dw.Line(
sx=19,
sy=(height / 2) - 11,
ex=41,
ey=(height / 2) + 11,
stroke="black",
stroke_width=2,
stroke_dasharray='3,1',
stroke_opacity=0.3,
)
)
group.append(
dw.Line(
sx=41,
sy=(height / 2) - 11,
ex=19,
ey=(height / 2) + 11,
stroke="black",
stroke_width=2,
stroke_dasharray='3,1',
stroke_opacity=0.3,
)
)
elif type == "champion_action":
has_icon = True
@@ -349,10 +409,24 @@ def create_effect_row(
cx=30,
cy=height / 2,
r=15,
fill="#444444",
filter="url(#drop-shadow)",
)
)
group.append(
dw.Circle(
cx=30,
cy=height / 2,
r=13,
fill="gray",
filter="url(#drop-shadow)",
)
)
subg = dw.Group(transform=f"translate({30},{height / 2})")
subg.append(create_arrow())
group.append(subg)
effect_with_icons = list(
filter(lambda x: x.get("effect") in resourceIcons and not x.get("per"), effects)
)
+4
View File
@@ -10,6 +10,7 @@ from card_types import Card, SkinData, SkinFile, Translation
from drawsvg.drawing import Drawing
from edit_card import finish_card
from src.draw_functions import create_faction_icon
with open("src/data/translation_fr.json", encoding="utf-8") as f:
translation_fr: Translation = json.load(f)
@@ -113,6 +114,9 @@ for card_data in cards:
fill=f'url(#grad2-{card_data["id"]})',
)
)
faction_icon.append(
create_faction_icon("yellow", transform="scale(1.5)"),
)
# Define linear colored gradient
gradient = dw.LinearGradient(