Class: Squib::Deck

Inherits:
Object
  • Object
show all
Defined in:
lib/squib_plus/deck.rb,
lib/squib_plus/deck/avatar.rb

Instance Method Summary collapse

Instance Method Details

#avatar(opts = {}) ⇒ Object



8
9
10
# File 'lib/squib_plus/deck/avatar.rb', line 8

def avatar(opts = {})
  DSL::Avatar.new(self, __callee__).run(opts)
end

#card_num(opts = {}) ⇒ Object

Adds a card number to the bottom right of the card by default. Helps with tracking down a specific card in your spreadsheet in games with many unique cards.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/squib_plus/deck.rb', line 10

def card_num(opts = {})
  defaults = {
    x: width - 100,
    y: height - 100,
    width: 50,
    height: 50,
    font: 'sans-serif',
    font_size: 9,
    color: '#000',
    align: :center,
    valign: :middle
  }
  range = Args.extract_range opts, self

  # Index from 1
  text(str: range.map { |i| i + 1 }, **(defaults.merge opts))
end

#pnp(opts = {}) ⇒ Object

Shortcut for creating a Print-n-Play sheet using poker-sized cards



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/squib_plus/deck.rb', line 35

def pnp(opts = {})
  cut_zone stroke_color: '#888'
  defaults = {
    trim: 37.5,
    sprue: if opts[:rtl]
             "#{File.dirname(__FILE__)}/sprues/letter_poker_tight_reverse.yml"
           else
             "#{File.dirname(__FILE__)}/sprues/letter_poker_tight.yml"
           end
  }
  save_pdf(defaults.merge(opts))
end

#tts(opts = {}) ⇒ Object

Shortcut for save_sheet with defaults that make sense for Tabletop Simulator



29
30
31
32
# File 'lib/squib_plus/deck.rb', line 29

def tts(opts = {})
  defaults = { columns: 10, rows: 7, trim: 37.5 }
  save_sheet(defaults.merge(opts))
end