18cards/hexpertise/deck.rb

50 lines
1.9 KiB
Ruby
Raw Permalink Normal View History

2022-05-21 20:05:23 -04:00
require 'squib'
2022-05-23 23:31:37 -04:00
element_descs = {
"light" => "3 per cluster",
"dark" => "3 each after first in clusters",
2022-05-27 14:13:02 -04:00
"fire" => "2 points per connection between hexes",
"water" => "3 points for each in longest path",
2022-05-23 23:31:37 -04:00
"earth" => "4 per triangle cluster",
2022-05-27 14:13:02 -04:00
"air" => "4 points for every fork in line"
2022-05-23 23:31:37 -04:00
}
2022-05-21 20:05:23 -04:00
Squib::Deck.new(cards: 18, layout: 'layout.yml', width: '3.5in', height: '2.5in') do
data = csv file: 'data.csv'
background color: 'white'
safe_zone
cut_zone
text layout: :title, str: 'Mana', align: :center, range: (0..14)
text layout: :title, str: 'Border', align: :center, range: (15..17)
svg layout: :leftSymbol, width: 200, file: data.left.map { |elem| "images/#{elem}.svg" }
2022-05-23 23:31:37 -04:00
text layout: :leftText, str: data.left
text layout: :leftDescription, str: data.left.map { |elem| element_descs[elem] }
2022-05-21 20:05:23 -04:00
svg layout: :rightSymbol, width: 200, file: data.right.map { |elem| "images/#{elem}.svg" }
2022-05-23 23:31:37 -04:00
text layout: :rightText, str: data.right
text layout: :rightDescription, str: data.right.map { |elem| element_descs[elem] }
2022-05-21 20:05:23 -04:00
save format: :png, prefix: 'card_'
save_pdf trim: 37.5, file: 'pnp.pdf'
2022-05-26 21:25:45 -04:00
save_sheet prefix: "tts_", columns: 3, rows: 6, trim: '0.125in', count_format: ''
2022-05-21 20:05:23 -04:00
end
2022-05-21 20:49:00 -04:00
2022-05-22 21:04:00 -04:00
Squib::Deck.new(cards: 6, width: '3in', height: '4in') do
2022-05-21 20:49:00 -04:00
rect
2022-05-22 21:04:00 -04:00
2022-05-22 21:17:36 -04:00
svg x: '0.5in', y: '0.5in', width: '2.0in', height: '2.0in', file: 'images/hexgrid.svg'
2022-05-22 21:04:00 -04:00
text x: '0.5in', y: '2.75in', width: '2in', height: '0.5in', str: 'Scoring', align: :center
2022-05-27 14:13:02 -04:00
syms = %w(light dark fire water earth air)
(0..5).each do |i|
svg x: inches(0.5) + i * inches(2.0/7.0), y: '3.0in', width: '0.25in', height: '0.25in',
file: "images/#{syms[i]}.svg"
2022-05-22 21:04:00 -04:00
rect x: inches(0.5) + i * inches(2.0/7.0), y: '3.25in', width: '0.25in', height: '0.25in'
end
2022-05-23 23:31:37 -04:00
star x: inches(0.5) + 6 * inches(2.0/7.0) + inches(0.125), y: '3.125in',
outer_radius: '0.125in', inner_radius: inches(1.0/16.0), angle: '270deg'
2022-05-22 21:04:00 -04:00
2022-05-21 20:49:00 -04:00
save_pdf trim: 37.5, file: 'player.pdf'
end