Class: PathfinderDeckBuilder::CharacterCard

Inherits:
Card
  • Object
show all
Defined in:
lib/character_card.rb

Instance Attribute Summary

Attributes inherited from Card

#class_cards, #class_path, #index

Instance Method Summary collapse

Methods inherited from Card

#set_multiple_character_path, #set_paths, #set_single_character_path, #static_content, #variable_content

Constructor Details

#initialize(xml_file) ⇒ CharacterCard

Returns a new instance of CharacterCard.



6
7
8
# File 'lib/character_card.rb', line 6

def initialize(xml_file)
  super
end

Instance Method Details

#assembled_cardObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/character_card.rb', line 20

def assembled_card
  {
    "count" => 1,
    "color": "blue",
    "title": "#{@character_path["name"]}",
    "icon": nil,
    "contents": [
      "subtitle | Character Info",
      "property | Base HP | #{@character_path["health"]["hitpoints"]}",
      "property | Race | #{@character_path["race"]["name"].capitalize}",
      "property | Ethnicity | #{@character_path["race"]["ethnicity"].capitalize}",
      "section | Combat",
      "property | AC | #{@ac_path["ac"]}",
      "property | Touch AC | #{@character_path["armorclass"]["touch"]}",
      "property | Flat-Footed AC | #{@character_path["armorclass"]["flatfooted"]}",
      "property | Attack Bonus | #{@attack_path["attackbonus"]}",
      "property | Initiative | #{@character_path["initiative"]["total"]}",
      "property | Movement | #{@character_path["movement"]["basespeed"]["text"]}",
      "fill",
      "rule",
      "dndstats | #{@attribute_path[0]["attrvalue"]["base"]} | #{@attribute_path[1]["attrvalue"]["base"]} | #{@attribute_path[2]["attrvalue"]["base"]} | #{@attribute_path[3]["attrvalue"]["base"]} | #{@attribute_path[4]["attrvalue"]["base"]} | #{@attribute_path[5]["attrvalue"]["base"]}"
    ]
  }
end

#create_card(index = nil) ⇒ Object



10
11
12
13
14
# File 'lib/character_card.rb', line 10

def create_card(index=nil)
  @index = index
  set_paths
  @class_cards.push(assembled_card)
end

#set_class_pathObject



16
17
18
# File 'lib/character_card.rb', line 16

def set_class_path
  @class_path = @character_path
end