From 67c525a65f1a87ef229cd0ea06cc8f92ab13ab6d Mon Sep 17 00:00:00 2001 From: Erzangel Date: Tue, 6 Aug 2024 19:24:12 +0200 Subject: [PATCH] feat: icon colors, no faction for base, full base --- src/draw_functions.py | 53 +++++++++++++++++++++++++-------------- src/generate_cards_mvp.py | 33 ++++++++++++++---------- 2 files changed, 54 insertions(+), 32 deletions(-) diff --git a/src/draw_functions.py b/src/draw_functions.py index a82ed42..9c0e8b3 100644 --- a/src/draw_functions.py +++ b/src/draw_functions.py @@ -360,16 +360,24 @@ def create_effect_row(effects: list[Effect], type: str, height: int, width: int) 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", + dw.Group( + [ + 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", + ), + ], + **{ + "v-bind:class": f"{{used:used_effects_indexes.length > 0}}" + } ) + ) text_y_pos = text_y_pos + 7 elif len (effect_with_text) > 1: @@ -409,16 +417,23 @@ 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", - ), + dw.Group( + [ + 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", + ), + ], + **{ + "v-bind:class": f"{{used:used_effects_indexes.length > 0}}" + } + ) ) return group diff --git a/src/generate_cards_mvp.py b/src/generate_cards_mvp.py index bf48a01..bad0ae4 100644 --- a/src/generate_cards_mvp.py +++ b/src/generate_cards_mvp.py @@ -41,7 +41,7 @@ cost_right_offset = 38 background_colors = { "blue": "lightblue", "red": "lightcoral", - "yellow": "rgb(206, 182, 167)", + "yellow": "rgb(250, 229, 136)", "green": "lightgreen", "base": "lightgrey", } @@ -56,12 +56,16 @@ gradient_colors = { icon_colors = { "yellow": ["#ff9935", "#ffe744"], - "blue": ["#ff9935", "#ffe744"], - "red": ["#ff9935", "#ffe744"], - "green": ["#ff9935", "#ffe744"], - "base": ["#ff9935", "#ffe744"], + "blue": ["#3399ff", "#aa44ff"], + "red": ["#ff99ff", "#ffe744"], + "green": ["#009935", "#35dd35"], + "base": ["#8899aa", "#aa9988"], } +fullscreen_card_ids = [ + 56, 57, 58, 59 +] + shadowFilter = dw.Filter(id="drop-shadow") shadowFilter.append(dw.FilterItem("feDropShadow", dx=1, dy=1, stdDeviation=0)) @@ -195,13 +199,14 @@ 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})", + # Draw faction icon if not a base card + if card_data['faction'] != 'base': + d.append( + 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( @@ -213,12 +218,13 @@ for card_data in cards: # Draw image d.append(dw.Rectangle(x=1, y=65, width=x_width - 2, height=200)) + image_height = 200 if card_data['id'] not in fullscreen_card_ids else y_height - 65 - border_width_y d.append( dw.Image( x=border_width_x, y=65, width=x_width - (border_width_x * 2), - height=200, + height=image_height, path=card_skin_data["image_path"], preserveAspectRatio="xMidYMid slice", ) @@ -237,11 +243,12 @@ for card_data in cards: # Draw effects effects = card_data.get("effects") if effects is not None: + effects_height = 265 if card_data['id'] not in fullscreen_card_ids else 220 effects = create_effects(effects=effects, height=135, width=x_internal_width) d.append( dw.Group( effects, - transform=f"translate({border_width_x},{265})", + transform=f"translate({border_width_x},{effects_height})", ) )