Merge branch 'main' into fuck/library_change

This commit is contained in:
2024-07-17 16:33:44 +00:00
26 changed files with 417 additions and 23 deletions
+285
View File
@@ -1,15 +1,300 @@
{
"skin_name": "heron",
"cards":{
"1": {
"title": "Tohru, Dragon Maid",
"flavor_text_type": "Lesbienne",
"image_path": "../../img/skins/heron/001.png"
},
"2": {
"title": "Serrer les... rangs?",
"flavor_text_type": "Motivation 😳",
"image_path": "../../img/skins/heron/002.png"
},
"3": {
"title": "Commandement",
"image_path": "../../img/skins/heron/003.png"
},
"4": {
"title": "Saki, Pégase de Guerre",
"flavor_text_type": "Cowboy",
"image_path": "../../img/skins/heron/004.png"
},
"5": {
"title": "Domination",
"image_path": "../../img/skins/heron/005.png"
},
"6": {
"title": "Raiden, le Juste",
"image_path": "../../img/skins/heron/006.png"
},
"7": {
"title": "Kikuri, Grande Prêtre",
"flavor_text_type": "Alcoolique",
"image_path": "../../img/skins/heron/007.png"
},
"8": {
"title": "Le Gardien",
"flavor_text_type": "Gardien",
"image_path": "../../img/skins/heron/008.png"
},
"9": {
"title": "Dlanor A. Knox",
"flavor_text_type": "Inquisitrice",
"image_path": "../../img/skins/heron/009.png"
},
"10": {
"title": "Rallier les Troupes",
"flavor_text_type": "Charme",
"image_path": "../../img/skins/heron/010.png"
},
"11": {
"title": "Recrutement",
"image_path": "../../img/skins/heron/011.png"
},
"12": {
"title": "Tits Priest",
"flavor_text_type": "Meuble",
"image_path": "../../img/skins/heron/012.png"
},
"13": {
"title": "Caprisun",
"flavor_text_type": "20cl",
"image_path": "../../img/skins/heron/013.png"
},
"14": {
"title": "Parole de Puissance",
"image_path": "../../img/skins/heron/014.png"
},
"15": {
"title": "Madeline, Mercenaire",
"flavor_text_type": "Guerrière",
"image_path": "../../img/skins/heron/015.png"
},
"16": {
"title": "Pot-de-Vin",
"image_path": "../../img/skins/heron/016.png"
},
"17": {
"title": "Menace de Mort",
"flavor_text_type": "Takano",
"image_path": "../../img/skins/heron/017.png"
},
"18": {
"title": "Fourberie",
"image_path": "../../img/skins/heron/018.png"
},
"19": {
"title": "Niko Incendiaire",
"flavor_text_type": "gfhd;spfgljh.-",
"image_path": "../../img/skins/heron/019.png"
},
"20": {
"title": "Tit job",
"image_path": "../../img/skins/heron/020.png"
},
"21": {
"title": "Intimidation",
"image_path": "../../img/skins/heron/021.png"
},
"22": {
"title": "S.W.M.G.",
"flavor_text_type": "Gang",
"image_path": "../../img/skins/heron/022.png"
},
"23": {
"title": "Parov, l'Exécuteur",
"flavor_text_type": "Bagarreur",
"image_path": "../../img/skins/heron/023.png"
},
"24": {
"title": "Bénéfice",
"image_path": "../../img/skins/heron/024.png"
},
"25": {
"title": "Jester, Maître Assassin",
"image_path": "../../img/skins/heron/025.png"
},
"26": {
"title": "Mako, le Contrebandier",
"flavor_text_type": "Charlatan",
"image_path": "../../img/skins/heron/026.png"
},
"27": {
"title": "Casser et Piller (chez toi)",
"flavor_text_type": "Crime",
"image_path": "../../img/skins/heron/027.png"
},
"28": {
"title": "Cirno",
"flavor_text_type": "Baka",
"image_path": "../../img/skins/heron/028.png"
},
"29": {
"title": "Prêtre du Cul",
"flavor_text_type": "Thicc",
"image_path": "../../img/skins/heron/029.png"
},
"30": {
"title": "LowTierGod",
"flavor_text_type": "Streamer",
"image_path": "../../img/skins/heron/030.png"
},
"31": {
"title": "Sombre Récompense",
"image_path": "../../img/skins/heron/031.png"
},
"32": {
"title": "Bracken",
"flavor_text_type": "Entité",
"image_path": "../../img/skins/heron/032.png"
},
"33": {
"title": "Bad Touch",
"flavor_text_type": "Boisson",
"image_path": "../../img/skins/heron/033.png"
},
"34": {
"title": "Alear, Tisseuse de Liens",
"flavor_text_type": "Dragon Divin",
"image_path": "../../img/skins/heron/034.png"
},
"35": {
"title": "Trick-or-Treat!",
"image_path": "../../img/skins/heron/035.png"
},
"36": {
"title": "Miguel O'Hara",
"flavor_text_type": "DILF",
"image_path": "../../img/skins/heron/036.png"
},
"37": {
"title": "Drain de Vie",
"flavor_text_type": "Pas de Bol",
"image_path": "../../img/skins/heron/037.png"
},
"38": {
"title": "V2",
"flavor_text_type": "Connard",
"image_path": "../../img/skins/heron/038.png"
},
"39": {
"title": "La Riamuification",
"flavor_text_type": "Malédiction",
"image_path": "../../img/skins/heron/039.png"
},
"40": {
"title": "Yuyuko, la Dévoreuse",
"flavor_text_type": "Fumo",
"image_path": "../../img/skins/heron/040.png"
},
"41": {
"title": "Battler, Maître du jeu",
"flavor_text_type": "Sorcier Infini",
"image_path": "../../img/skins/heron/041.png"
},
"42": {
"title": "Featherine, la Spectatrice",
"flavor_text_type": "Sorcière",
"image_path": "../../img/skins/heron/042.png"
},
"43": {
"title": "Panette, la Berserker",
"image_path": "../../img/skins/heron/043.png"
},
"44": {
"title": "Koromaru Niveau 99",
"flavor_text_type": "Persona-user",
"image_path": "../../img/skins/heron/044.png"
},
"45": {
"title": "Malédiction des Fibres",
"flavor_text_type": "Mind-control",
"image_path": "../../img/skins/heron/045.png"
},
"46": {
"title": "Don Insecte",
"flavor_text_type": "Potite",
"image_path": "../../img/skins/heron/046.png"
},
"47": {
"title": "Leshy, Géant de la Forêt",
"flavor_text_type": "Maître du jeu",
"image_path": "../../img/skins/heron/047.png"
},
"48": {
"title": "Don de la Nature",
"image_path": "../../img/skins/heron/048.png"
},
"49": {
"title": "Grognasse",
"flavor_text_type": "Fille",
"image_path": "../../img/skins/heron/049.png"
},
"50": {
"title": "Impulsion Temporelle",
"image_path": "../../img/skins/heron/050.png"
},
"51": {
"title": "Baiken, Samurai Slasher",
"image_path": "../../img/skins/heron/051.png"
},
"52": {
"title": "Étincelle de Caine",
"image_path": "../../img/skins/heron/052.png"
},
"53": {
"title": "Forme de Loup",
"image_path": "../../img/skins/heron/053.png"
},
"54": {
"title": "Leadeuse du Club",
"flavor_text_type": "Vieil Homme",
"image_path": "../../img/skins/heron/054.png"
},
"55": {
"title": "Live and maybe Kill",
"flavor_text_type": "Alien",
"image_path": "../../img/skins/heron/055.png"
},
"56": {
"title": "Live",
"image_path": "../../img/skins/heron/056.png"
},
"57": {
"title": "Superkill",
"image_path": "../../img/skins/heron/057.png"
},
"58": {
"title": "Kill",
"image_path": "../../img/skins/heron/058.png"
},
"59": {
"title": "Live Forever",
"image_path": "../../img/skins/heron/059.png"
}
}
+63 -23
View File
@@ -18,7 +18,7 @@ with open("src/data/heron_skin.json", encoding="utf-8") as f:
all_skin_data: SkinFile = json.load(f)
cards: list[Card] = []
for p in Path('src/data/cards').glob('*.json'):
for p in Path("src/data/cards").glob("*.json"):
with open(p, encoding="utf-8") as f:
temp: list[Card] = json.load(f)["cards"]
cards.extend(temp)
@@ -29,7 +29,7 @@ y_height = 417
border_width_x = 12
border_width_y = 17
x_internal_width = x_width - (border_width_x*2)
x_internal_width = x_width - (border_width_x * 2)
border_upper_offset = 5
title_y_offset = 24
@@ -46,15 +46,21 @@ background_colors = {
"base": "lightgrey",
}
gradient_colors = {"red": "red", "blue": "blue", "yellow": "yellow", "green": "green", "base":"gray"}
gradient_colors = {
"red": "red",
"blue": "blue",
"yellow": "yellow",
"green": "green",
"base": "gray",
}
icon_colors = {
"yellow": ["#ff9935", "#ffe744"],
"blue": ["#ff9935", "#ffe744"],
"red": ["#ff9935", "#ffe744"],
"green": ["#ff9935", "#ffe744"],
"base": ["#ff9935", "#ffe744"]
}
"base": ["#ff9935", "#ffe744"],
}
shadowFilter = dw.Filter(id="drop-shadow")
@@ -76,7 +82,9 @@ for card_data in cards:
try:
card_skin_data = all_skin_data["cards"][str(card_data["id"])]
except KeyError:
print("Missing skin data for card id:", card_data["id"], "using default skin data")
print(
"Missing skin data for card id:", card_data["id"], "using default skin data"
)
card_skin_data = SkinData(
title=card_data["name"],
image_path="../../img/missing.png",
@@ -89,7 +97,17 @@ for card_data in cards:
# Create a new SVG drawing
output_dir = "output/" + all_skin_data["skin_name"]
os.makedirs(output_dir, exist_ok=True)
d = Drawing(x_width, y_height, id="card"+str(card_data["id"]), id_prefix=str(card_data.get('id')) + "_", **{'class':'card', 'xmlns:v-bind':"https://vuejs.org/guide/essentials/class-and-style.html",'xmlns:v-on':"https://vuejs.org/guide/essentials/event-handling.html"})
d = Drawing(
x_width,
y_height,
id="card" + str(card_data["id"]),
id_prefix=str(card_data.get("id")) + "_",
**{
"class": "card",
"xmlns:v-bind": "https://vuejs.org/guide/essentials/class-and-style.html",
"xmlns:v-on": "https://vuejs.org/guide/essentials/event-handling.html",
},
)
d.append(shadowFilter)
# Define linear colored gradient
@@ -110,7 +128,19 @@ for card_data in cards:
# Draw card background
background = dw.Group(id="background")
background.append(dw.Rectangle(0, 0, x_width, y_height, rx=15, ry=18, fill="black", stroke="white", stroke_width=1))
background.append(
dw.Rectangle(
0,
0,
x_width,
y_height,
rx=15,
ry=18,
fill="black",
stroke="white",
stroke_width=1,
)
)
background.append(
dw.Rectangle(
border_width_x,
@@ -165,41 +195,51 @@ for card_data in cards:
)
d.append(title)
# Draw faction icon
d.append(
dw.Group(children=[faction_icon],transform=f"translate({border_width_x + 23 + 1},{border_width_y - border_upper_offset + 20 + 4 + 1})")
dw.Group(
children=[faction_icon],
transform=f"translate({border_width_x + 23 + 1},{border_width_y - border_upper_offset + 20 + 4 + 1})",
)
)
# Draw card cost
if card_data.get("cost") is not None:
d.append(
dw.Group(children=[create_gold_icon(cast(int,card_data.get("cost")))],transform=f"translate({x_width - cost_right_offset},{19 + border_width_y})")
dw.Group(
children=[create_gold_icon(cast(int, card_data.get("cost")))],
transform=f"translate({x_width - cost_right_offset},{19 + border_width_y})",
)
)
d.append(dw.Rectangle(x=0, y=65, width=x_width, height=200))
d.append(dw.Image(x=0, y=65, width=x_width, height=200,path=card_skin_data["image_path"]))
d.append(
dw.Image(
x=0, y=65, width=x_width, height=200, path=card_skin_data["image_path"]
)
)
# Draw effects
effects = card_data.get("effects")
if effects is not None:
effects = create_effects(
effects=effects,
height=135,
width=x_internal_width
)
d.append(dw.Group(
effects = create_effects(effects=effects, height=135, width=x_internal_width)
d.append(
dw.Group(
effects,
transform=f"translate({border_width_x},{265})",
))
)
)
# If champion, draw champion shield with defense
if card_data["card_type"] == "champion":
shield = draw_champion_shield(card_data, border_width_x)
d.append(dw.Group(
d.append(
dw.Group(
shield,
transform=f"translate({x_width-30},{y_height})",
))
)
)
# Save the SVG file
d.save_svg(f"output/{all_skin_data['skin_name']}/{str(card_data["id"]).zfill(3)}.svg")
d.save_svg(
f"output/{all_skin_data['skin_name']}/{str(card_data['id']).zfill(3)}.svg"
)