Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fb1c77907 | ||
|
|
b7abbb646d | ||
|
|
2d03a3b36a | ||
|
|
5b72b60aa2 | ||
|
|
f766c559d6 | ||
|
|
1a3219e6e6 |
@@ -8,4 +8,5 @@ RUN pip install -r requirements.txt
|
|||||||
|
|
||||||
# étape de production
|
# étape de production
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
|
COPY img ./img
|
||||||
CMD ["python3", "-u", "./src/generate_cards_mvp.py"]
|
CMD ["python3", "-u", "./src/generate_cards_mvp.py"]
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 963 KiB |
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -1 +1,3 @@
|
|||||||
drawsvg==2.4.0
|
drawsvg==2.4.0
|
||||||
|
pillow==10.4.0
|
||||||
|
--extra-index-url=https://packagecloud.io/github/git-lfs/pypi/simple
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
"19": {
|
"19": {
|
||||||
"title": "Niko Incendiaire",
|
"title": "Niko Incendiaire",
|
||||||
"flavor_text_type": "gfhd;spfgljh.-",
|
"flavor_text_type": "gfhd;spfgljh.-",
|
||||||
"image_path": "../../img/skins/heron/019.png"
|
"image_path": "../../img/skins/heron/019.gif"
|
||||||
},
|
},
|
||||||
"20": {
|
"20": {
|
||||||
"title": "Tit job",
|
"title": "Tit job",
|
||||||
@@ -296,6 +296,10 @@
|
|||||||
|
|
||||||
"image_path": "../../img/skins/heron/059.png"
|
"image_path": "../../img/skins/heron/059.png"
|
||||||
},
|
},
|
||||||
|
"68": {
|
||||||
|
"title": "Confisquer",
|
||||||
|
"image_path": "../../img/skins/heron/068.png"
|
||||||
|
},
|
||||||
"71": {
|
"71": {
|
||||||
"title": "Rosser",
|
"title": "Rosser",
|
||||||
"image_path": "../../img/skins/heron/071.png"
|
"image_path": "../../img/skins/heron/071.png"
|
||||||
|
|||||||
@@ -12,14 +12,21 @@
|
|||||||
"draw_amount":"Piochez %a cartes.",
|
"draw_amount":"Piochez %a cartes.",
|
||||||
"stun":"Assomez le champion ciblé.",
|
"stun":"Assomez le champion ciblé.",
|
||||||
"stack_next_card_bought":"Mettez la prochaine carte dont\nvous faites l'acquisition ce tour-ci\nau dessus de votre pioche.",
|
"stack_next_card_bought":"Mettez la prochaine carte dont\nvous faites l'acquisition ce tour-ci\nau dessus de votre pioche.",
|
||||||
|
"stack_next_action_bought": "Mettez la prochaine action dont\nvous faites l'acquisition ce tour-ci\nau dessus de votre pioche.",
|
||||||
"sacrifice":"Vous pouvez sacrifier une carte\nde votre main ou de votre défausse.",
|
"sacrifice":"Vous pouvez sacrifier une carte\nde votre main ou de votre défausse.",
|
||||||
"sacrifice_times":"Vous pouvez sacrifier jusqu'à %a\ncartes de votre main et/ou de votre défausse.",
|
"sacrifice_times":"Vous pouvez sacrifier jusqu'à %a\ncartes de votre main et/ou de votre défausse.",
|
||||||
"restack_discarded_champion":"Mettez un champion de votre défausse\nau dessus de votre pioche.",
|
"restack_discarded_card": "Vous pouvez mettre une carte de votre défausse\nau dessus de votre pioche.",
|
||||||
|
"restack_discarded_champion":"Mettez un champion de\nvotre défausse au dessus\nde votre pioche.",
|
||||||
|
"restack_discarded_action":"Mettez une action de\nvotre défausse au dessus\nde votre pioche.",
|
||||||
"make_discard":"L'adversaire ciblé%nse défausse d'une carte.",
|
"make_discard":"L'adversaire ciblé%nse défausse d'une carte.",
|
||||||
"draw_and_discard":"Vous pouvez piocher une carte, puis\n vous défausser d'une carte.",
|
"draw_and_discard":"Vous pouvez piocher une carte, puis\n vous défausser d'une carte.",
|
||||||
"draw_and_discard_times":"Vous pouvez piocher jusqu'à %a cartes,\ndéfaussez-vous ensuite d'autant de cartes",
|
"draw_and_discard_times":"Vous pouvez piocher jusqu'à %a cartes,\ndéfaussez-vous ensuite d'autant de cartes",
|
||||||
"play_next_card_bought":"Mettez la prochaine carte dont\nvous faites l'acquisition ce tour-ci\n dans votre main.",
|
"play_next_card_bought":"Mettez la prochaine carte dont\nvous faites l'acquisition ce tour-ci\n dans votre main.",
|
||||||
"prepare":"Mobilisez un Champion"
|
"prepare":"Mobilisez un Champion",
|
||||||
|
"prepare_all_champions":"Mobilisez vos Champions.",
|
||||||
|
"prepare_another_champion":"Mobilisez un autre Champion.",
|
||||||
|
"cheaper_champions_passive":"Le prochain Champion que vous achetez\nvous coûte 1 de moins ce tour-ci.",
|
||||||
|
"control_opposing_champion_passive":"Prenez le contrôle d'un Champion\nennemi jusqu'à la fin du tour."
|
||||||
},
|
},
|
||||||
"per":{
|
"per":{
|
||||||
"champion":"pour chaque Champion\nque vous avez en jeu",
|
"champion":"pour chaque Champion\nque vous avez en jeu",
|
||||||
|
|||||||
+66
-4
@@ -192,18 +192,38 @@ resourceIcons = {
|
|||||||
"damage": create_damage_icon,
|
"damage": create_damage_icon,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### This went unused, but I left it commented cause it might be cool as a card background? idk
|
||||||
|
# def create_background_with_text(x_length: int, height: int, color: str):
|
||||||
|
# font_size = 8
|
||||||
|
# gap = 11
|
||||||
|
# group = []
|
||||||
|
# y_offset = int((height % gap)/2)
|
||||||
|
# for i in range(int(height/gap)):
|
||||||
|
# group.append(
|
||||||
|
# dw.Text(
|
||||||
|
# f"{'choose' if i%2==0 else ''} one choose one choose one choose one{' choose' if i%2==1 else ''}",
|
||||||
|
# x=0,
|
||||||
|
# y=-18 + gap*i + y_offset,
|
||||||
|
# text_anchor="middle",
|
||||||
|
# fill=color,
|
||||||
|
# font_size=font_size,
|
||||||
|
# font_family="Helvetica",
|
||||||
|
# )
|
||||||
|
# )
|
||||||
|
# return group
|
||||||
|
|
||||||
def create_effect_text(effects: list[Effect], height: float, width: int):
|
|
||||||
|
def create_effect_text(effects: list[Effect], height: float, width: int, has_mutex: bool = False):
|
||||||
group = []
|
group = []
|
||||||
|
|
||||||
effect_text = ""
|
effect_text = ""
|
||||||
|
|
||||||
for e in effects:
|
for [i, e] in enumerate(effects):
|
||||||
if effect_text != "":
|
if effect_text != "":
|
||||||
effect_text += " "
|
effect_text += " "
|
||||||
per = e.get("per")
|
per = e.get("per")
|
||||||
if per is not None:
|
if per is not None:
|
||||||
translation = f"+ x {translation_fr.get('per').get(per)}"
|
translation = f"+ {e.get('amount', '1')} {translation_fr.get('per').get(per)}"
|
||||||
elif e.get("amount", 1) > 1:
|
elif e.get("amount", 1) > 1:
|
||||||
translation = (
|
translation = (
|
||||||
translation_fr.get("effects")
|
translation_fr.get("effects")
|
||||||
@@ -230,6 +250,8 @@ def create_effect_text(effects: list[Effect], height: float, width: int):
|
|||||||
if len(effect_text) > 20:
|
if len(effect_text) > 20:
|
||||||
effect_text += "\n"
|
effect_text += "\n"
|
||||||
effect_text += translation
|
effect_text += translation
|
||||||
|
if has_mutex and i is not len(effects) - 1:
|
||||||
|
effect_text += "\nou"
|
||||||
|
|
||||||
if width < 250:
|
if width < 250:
|
||||||
effect_text = effect_text.replace("%n", "\n")
|
effect_text = effect_text.replace("%n", "\n")
|
||||||
@@ -326,10 +348,35 @@ def create_effect_row(effects: list[Effect], type: str, height: int, width: int)
|
|||||||
text_width = width
|
text_width = width
|
||||||
if has_icon:
|
if has_icon:
|
||||||
text_width = width - 70
|
text_width = width - 70
|
||||||
|
|
||||||
|
is_mutex = False
|
||||||
|
if 'mutex' in effects[0]:
|
||||||
|
print("mutex exists for a card")
|
||||||
|
is_mutex = True
|
||||||
|
|
||||||
if len(effect_with_text) > 0:
|
if len(effect_with_text) > 0:
|
||||||
|
has_text_mutex = False
|
||||||
|
if is_mutex:
|
||||||
|
if len(effect_with_icons) > 0:
|
||||||
|
icon_y_pos = icon_y_pos - 15
|
||||||
|
group.append(
|
||||||
|
dw.Text(
|
||||||
|
"ou",
|
||||||
|
font_size=14,
|
||||||
|
x=width / 2,
|
||||||
|
y=text_y_pos-19,
|
||||||
|
text_anchor="middle",
|
||||||
|
fill="black",
|
||||||
|
font_family="Helvetica",
|
||||||
|
font_style="italic",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
text_y_pos = text_y_pos + 7
|
||||||
|
elif len (effect_with_text) > 1:
|
||||||
|
has_text_mutex = True
|
||||||
group.append(
|
group.append(
|
||||||
dw.Group(
|
dw.Group(
|
||||||
create_effect_text(effect_with_text, text_height, text_width),
|
create_effect_text(effect_with_text, text_height, text_width, has_mutex=has_text_mutex),
|
||||||
transform=f"translate({width / 2},{text_y_pos})",
|
transform=f"translate({width / 2},{text_y_pos})",
|
||||||
**{
|
**{
|
||||||
"class": "svg_effect",
|
"class": "svg_effect",
|
||||||
@@ -339,6 +386,8 @@ def create_effect_row(effects: list[Effect], type: str, height: int, width: int)
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
icon_radius = min(height / 3, stats_radius)
|
icon_radius = min(height / 3, stats_radius)
|
||||||
for [i, e] in enumerate(effect_with_icons):
|
for [i, e] in enumerate(effect_with_icons):
|
||||||
f = resourceIcons.get(e.get("effect"))
|
f = resourceIcons.get(e.get("effect"))
|
||||||
@@ -358,6 +407,19 @@ def create_effect_row(effects: list[Effect], type: str, height: int, width: int)
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if is_mutex and i!=0:
|
||||||
|
group.append(
|
||||||
|
dw.Text(
|
||||||
|
"ou",
|
||||||
|
# x=(width/2) - ((len(effect_with_icons) - 1) * icon_radius * 1.5) + icon_radius + 10,
|
||||||
|
x=(width/2) - ((len(effect_with_icons) - 1) * icon_radius * 1.5) + icon_radius + 10 + ((i-1) * icon_radius * 3),
|
||||||
|
y=icon_y_pos + 3,
|
||||||
|
text_anchor="middle",
|
||||||
|
fill="black",
|
||||||
|
font_size=12,
|
||||||
|
font_family="Helvetica",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
return group
|
return group
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from draw_functions import create_gold_icon, create_effects, draw_champion_shiel
|
|||||||
from card_types import Card, SkinData, SkinFile, Translation
|
from card_types import Card, SkinData, SkinFile, Translation
|
||||||
|
|
||||||
from drawsvg.drawing import Drawing
|
from drawsvg.drawing import Drawing
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
from edit_card import finish_card
|
from edit_card import finish_card
|
||||||
|
|
||||||
@@ -212,16 +213,45 @@ for card_data in cards:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Draw image
|
# Draw image
|
||||||
d.append(dw.Rectangle(x=1, y=65, width=x_width - 2, height=200))
|
image_area_width = x_width - (2 * border_width_x)
|
||||||
d.append(
|
image_area_height = 200
|
||||||
dw.Image(
|
d.append(dw.Rectangle(x=1, y=65, width=x_width - 2, height=image_area_height))
|
||||||
|
image = Image.open(card_skin_data['image_path'].replace('../../', ''))
|
||||||
|
image_natural_width, image_natural_height = image.size
|
||||||
|
image_ratio = image_natural_width / image_natural_height
|
||||||
|
area_ratio = image_area_width / image_area_height
|
||||||
|
print(image_natural_width)
|
||||||
|
print(image_area_width)
|
||||||
|
print(image_ratio)
|
||||||
|
print(area_ratio)
|
||||||
|
if image_ratio > area_ratio:
|
||||||
|
# Wider image
|
||||||
|
scale = image_area_height / image_natural_height
|
||||||
|
new_width = image_natural_width * scale
|
||||||
|
translate_x = (image_area_width - new_width) / 2
|
||||||
|
transform = f"translate({translate_x}, 0) scale ({scale})"
|
||||||
|
print(transform)
|
||||||
|
else:
|
||||||
|
# Taller image
|
||||||
|
scale = image_area_width / image_natural_width
|
||||||
|
new_height = image_natural_height * scale
|
||||||
|
translate_y = (image_area_height - new_height) / 2
|
||||||
|
transform = f"translate(0, {translate_y}) scale({scale})"
|
||||||
|
|
||||||
|
card_image = dw.Image(
|
||||||
x=border_width_x,
|
x=border_width_x,
|
||||||
y=65,
|
y=65,
|
||||||
width=x_width - (border_width_x * 2),
|
width=x_width - (border_width_x * 2),
|
||||||
height=200,
|
height=200,
|
||||||
path=card_skin_data["image_path"],
|
path=card_skin_data["image_path"],
|
||||||
|
**{
|
||||||
|
"object-fit": "cover",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
card_image.args['transform'] = transform
|
||||||
|
|
||||||
|
d.append(card_image)
|
||||||
d.append(dw.Rectangle(x=2, y=65 - 1, width=border_width_x - 2, height=200 + 2))
|
d.append(dw.Rectangle(x=2, y=65 - 1, width=border_width_x - 2, height=200 + 2))
|
||||||
# d.append(dw.Rectangle(x=0, y=65+1, width=1, height=200+2, fill='white'))
|
# d.append(dw.Rectangle(x=0, y=65+1, width=1, height=200+2, fill='white'))
|
||||||
d.append(
|
d.append(
|
||||||
|
|||||||
Reference in New Issue
Block a user