diff --git a/data/cards.xlsx b/data/cards.xlsx index 938e980..bcc8f54 100644 Binary files a/data/cards.xlsx and b/data/cards.xlsx differ diff --git a/graphics/stand-alone/bg_numbers.svg b/graphics/stand-alone/bg_numbers.svg new file mode 100644 index 0000000..994ae1e --- /dev/null +++ b/graphics/stand-alone/bg_numbers.svg @@ -0,0 +1,115 @@ + + + + + + + + + 0 0 1 0 1 1 0 1 0 1 0 1 0 0 0 0 1 0 1 1 1 1 1 0 0 0 0 1 0 1 0 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 1 0 1 0 0 0 0 1 0 1 1 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 1 0 1 0 0 1 1 0 0 1 0 1 1 1 1 0 1 1 1 0 0 0 1 0 0 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 0 1 1 1 1 1 1 1 0 1 0 1 1 0 1 0 0 1 0 0 1 0 0 0 0 1 0 1 0 1 1 1 1 1 1 1 0 0 0 1 0 1 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 0 0 0 0 1 1 0 1 1 1 0 0 0 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 0 1 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 1 0 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 1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 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 0 0 1 0 0 0 0 + + diff --git a/graphics/stand-alone/effet.svg b/graphics/stand-alone/effet.svg new file mode 100644 index 0000000..21683c3 --- /dev/null +++ b/graphics/stand-alone/effet.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + diff --git a/graphics/stand-alone/icone_assassinat.svg b/graphics/stand-alone/icone_assassinat.svg new file mode 100644 index 0000000..d583b97 --- /dev/null +++ b/graphics/stand-alone/icone_assassinat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/stand-alone/icone_campagne-comm.svg b/graphics/stand-alone/icone_campagne-comm.svg new file mode 100644 index 0000000..c1152bb --- /dev/null +++ b/graphics/stand-alone/icone_campagne-comm.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/stand-alone/icone_casserole.svg b/graphics/stand-alone/icone_casserole.svg new file mode 100644 index 0000000..55b87da --- /dev/null +++ b/graphics/stand-alone/icone_casserole.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/stand-alone/icone_corruption.svg b/graphics/stand-alone/icone_corruption.svg new file mode 100644 index 0000000..0c1e873 --- /dev/null +++ b/graphics/stand-alone/icone_corruption.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/stand-alone/icone_propagande.svg b/graphics/stand-alone/icone_propagande.svg new file mode 100644 index 0000000..3c18fac --- /dev/null +++ b/graphics/stand-alone/icone_propagande.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + diff --git a/graphics/stand-alone/icone_retournement.svg b/graphics/stand-alone/icone_retournement.svg new file mode 100644 index 0000000..e222213 --- /dev/null +++ b/graphics/stand-alone/icone_retournement.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/stand-alone/icone_robocaine.svg b/graphics/stand-alone/icone_robocaine.svg new file mode 100644 index 0000000..9f0b01b --- /dev/null +++ b/graphics/stand-alone/icone_robocaine.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/stand-alone/icone_spin-doctor.svg b/graphics/stand-alone/icone_spin-doctor.svg new file mode 100644 index 0000000..bb1b1a1 --- /dev/null +++ b/graphics/stand-alone/icone_spin-doctor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/stand-alone/magouille.svg b/graphics/stand-alone/magouille.svg new file mode 100644 index 0000000..4658166 --- /dev/null +++ b/graphics/stand-alone/magouille.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/graphics/stand-alone/pv.svg b/graphics/stand-alone/pv.svg new file mode 100644 index 0000000..7b44ece --- /dev/null +++ b/graphics/stand-alone/pv.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/scripts/compute_layout.py b/scripts/compute_layout.py deleted file mode 100644 index b025692..0000000 --- a/scripts/compute_layout.py +++ /dev/null @@ -1,121 +0,0 @@ -from typing import * - - -# Card size info -TOTAL_HEIGHT = 1125 -TOTAL_WIDTH = 825 -BLEED_MARGIN = 37.5 -SAFE_MARGIN = 75 -MAX_SAFE_X = TOTAL_WIDTH - SAFE_MARGIN -MAX_SAFE_Y = TOTAL_HEIGHT - SAFE_MARGIN - -# Icon info -ICON_SIZE = 125 -ICON_MARGIN_LEFT = 0 -ICON_MARGIN_TOP = 0 -ICON_X = ICON_MARGIN_LEFT + SAFE_MARGIN -ICON_Y = ICON_MARGIN_TOP + SAFE_MARGIN - -# Banner info -BANNER_WIDTH = 75 -BANNER_HEIGHT = 225 -BANNER_X = ICON_X + ICON_SIZE + 10 -BANNER_Y = 0 -BANNER_TEXT_FONT = "\"ethnocentric 12\"" -BANNER_TEXT_X = BANNER_X - 10 -BANNER_TEXT_Y = BANNER_HEIGHT // 3 -BANNER_TEXT_WIDTH = BANNER_WIDTH + 20 - -# Name info -NAME_X = ICON_X + ICON_SIZE -NAME_Y = SAFE_MARGIN + 10 -NAME_WIDTH = MAX_SAFE_X - NAME_X -NAME_HEIGHT = 125 -NAME_FONT = "\"ethnocentric 11\"" - -NAME_WITH_BANNER_X = BANNER_X + BANNER_WIDTH -NAME_WITH_BANNER_WIDTH = NAME_WIDTH - (NAME_WITH_BANNER_X - NAME_X) - -def central_sym(x: int, y: int) -> Tuple[int, int]: - return TOTAL_WIDTH - x, TOTAL_HEIGHT - y - -# Alternative objects -ALT_ICON_X, ALT_ICON_Y = central_sym(ICON_X, ICON_Y) -ALT_BANNER_X, ALT_BANNER_Y = central_sym(BANNER_X, BANNER_Y) -ALT_BANNER_TEXT_X, ALT_BANNER_TEXT_Y = central_sym(BANNER_TEXT_X, BANNER_TEXT_Y) - -LAYOUT: str = f""" -icon: - x: {ICON_X} - y: {ICON_Y} - width: {ICON_SIZE} - height: {ICON_SIZE} - -alt_icon: - extends: icon - x: {ALT_ICON_X} - y: {ALT_ICON_Y} - angle: 3.14159 - -banner: - x: {BANNER_X} - y: {BANNER_Y} - width: {BANNER_WIDTH} - height: {BANNER_HEIGHT} - -banner_text: - x: {BANNER_TEXT_X} - y: {BANNER_TEXT_Y} - width: {BANNER_TEXT_WIDTH} - height: 2c - font: {BANNER_TEXT_FONT} - align: center -# hint: blue - -alt_banner: - extends: banner - x: {ALT_BANNER_X} - y: {ALT_BANNER_Y} - angle: 3.14159 - - -alt_banner_text: - extends: banner_text - angle: 3.14159 - x: {ALT_BANNER_TEXT_X} - y: {ALT_BANNER_TEXT_Y} - -name: - x: {NAME_X} - y: {NAME_Y} - width: {NAME_WIDTH} - height: {NAME_HEIGHT} - align: center - valign: middle - font: {NAME_FONT} -# hint: red - -name_with_banner: - extends: name - x: {NAME_WITH_BANNER_X} - width: {NAME_WITH_BANNER_WIDTH} - -cut: - x: {BLEED_MARGIN} - y: {BLEED_MARGIN} - width: {TOTAL_WIDTH - (2 * BLEED_MARGIN)} - height: {TOTAL_HEIGHT - (2 * BLEED_MARGIN)} - stroke_color: gray - stroke_width: 2 - -safe: - x: {SAFE_MARGIN} - y: {SAFE_MARGIN} - width: {TOTAL_WIDTH - (2 * SAFE_MARGIN)} - height: {TOTAL_HEIGHT - (2 * SAFE_MARGIN)} - radius: 0.5c - dash: 3mm 3mm -""" - -if __name__ == "__main__": - open("layout.yml", "w").write(LAYOUT) diff --git a/scripts/generate_layouts.py b/scripts/generate_layouts.py index a720717..6dd246a 100644 --- a/scripts/generate_layouts.py +++ b/scripts/generate_layouts.py @@ -10,6 +10,8 @@ BLEED_MARGIN = 1 SAFE_MARGIN = 2 MAX_SAFE_X = TOTAL_WIDTH - SAFE_MARGIN MAX_SAFE_Y = TOTAL_HEIGHT - SAFE_MARGIN +SAFE_WIDTH = TOTAL_WIDTH - 2 * SAFE_MARGIN +SAFE_HEIGHT = TOTAL_HEIGHT - 2 * SAFE_MARGIN # Icon info ICON_SIZE = 3.7 @@ -46,7 +48,27 @@ ALT_ICON_X, ALT_ICON_Y = central_sym(ICON_X, ICON_Y) ALT_BANNER_X, ALT_BANNER_Y = central_sym(BANNER_X, BANNER_Y) ALT_BANNER_TEXT_X, ALT_BANNER_TEXT_Y = central_sym(BANNER_TEXT_X, BANNER_TEXT_Y) +# Effects +EFFECT_FRAME_WIDTH = SAFE_WIDTH - 2 +EFFECT_FRAME_HEIGHT = 6 +EFFECT_FRAME_RADIUS = 0.2 +EFFECT_FRAME_MARGIN_BOTTOM = 2 +EFFECT_FRAME_X = (TOTAL_WIDTH - EFFECT_FRAME_WIDTH) / 2. +EFFECT_FRAME_Y = MAX_SAFE_Y - EFFECT_FRAME_MARGIN_BOTTOM - EFFECT_FRAME_HEIGHT + +EFFECT_TEXT_MARGIN = 1 +EFFECT_TEXT_X = EFFECT_FRAME_X + EFFECT_TEXT_MARGIN +EFFECT_TEXT_Y = EFFECT_FRAME_Y + EFFECT_TEXT_MARGIN +EFFECT_TEXT_WIDTH = EFFECT_FRAME_WIDTH - 2 * EFFECT_TEXT_MARGIN +EFFECT_TEXT_HEIGHT = EFFECT_FRAME_HEIGHT - 2 * EFFECT_TEXT_MARGIN + POKER_LAYOUT: str = f""" +background: + x: 0 + y: 0 + width: {TOTAL_WIDTH}c + height: {TOTAL_HEIGHT}c + icon: x: {ICON_X}c y: {ICON_Y}c @@ -102,6 +124,26 @@ name_with_banner: x: {NAME_WITH_BANNER_X}c width: {NAME_WITH_BANNER_WIDTH}c + +effect_frame: + x: {EFFECT_FRAME_X}c + y: {EFFECT_FRAME_Y}c + width: {EFFECT_FRAME_WIDTH}c + height: {EFFECT_FRAME_HEIGHT}c + radius: {EFFECT_FRAME_RADIUS}c + stroke_width: 0.3mm + +effect_text: + x: {EFFECT_TEXT_X}c + y: {EFFECT_TEXT_Y}c + width: {EFFECT_TEXT_WIDTH}c + height: {EFFECT_TEXT_HEIGHT}c + font_size: 9 + spacing: 5 + align: center + valign: middle + markup: true + border: x: 0 y: 0 diff --git a/src/deck.rb b/src/deck.rb index 8dad4ca..b93b380 100644 --- a/src/deck.rb +++ b/src/deck.rb @@ -10,6 +10,10 @@ def rank_to_banner_svg(rank) rank.nil? ? nil : (rank.start_with?('+') || rank.start_with?('-')) ? "banniere_mod.svg" : "banniere_rang.svg" end +def embed_custom(embed, id) + embed.svg width: '0.8c', height: '0.8c', dx: '0c', dy: '-0.7c', key: ":#{id}:", file: "._graphics/#{id}.svg" +end + DPI = 300 CELL_PX = DPI / 8.0 BLEED = 0.125 # In inches @@ -26,6 +30,7 @@ Squib::Deck.new( dpi: DPI, ) do background color: 'white' + svg file: 'bg_numbers.svg', layout: 'background' build :debug do rect layout: 'border', stroke_color: 'black' @@ -49,6 +54,20 @@ Squib::Deck.new( svg file: alt_banner_file, layout: 'alt_banner' text str: data['rang_alt'], layout: 'alt_banner_text' + fill_color = data['effet'].map { |effet| effet.nil? ? '#0000': '#f5f5f5ff' } + stroke_color = data['effet'].map { |effet| effet.nil? ? '#0000': '#bb98' } + rect layout: 'effect_frame', fill_color: fill_color, stroke_color: stroke_color + text(str: data['effet'], layout: 'effect_text') do |embed| + embed_custom(embed, 'effet') + embed_custom(embed, 'magouille') + embed_custom(embed, 'pv') + embed_custom(embed, 'icone_ind') + embed_custom(embed, 'icone_gau') + embed_custom(embed, 'icone_roy') + embed_custom(embed, 'icone_ana') + embed_custom(embed, 'icone_dro') + embed_custom(embed, 'icone_eco') + end build :debug do save_pdf sprue: 'sprues/debug.yml', file: 'debug.pdf'