Class: PfrpgReaders::AttributesReader

Inherits:
Object
  • Object
show all
Defined in:
lib/pfrpg_readers/attributes_reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(character) ⇒ AttributesReader

Returns a new instance of AttributesReader.



4
5
6
# File 'lib/pfrpg_readers/attributes_reader.rb', line 4

def initialize(character)
  @character = character
end

Instance Attribute Details

#characterObject (readonly)

Returns the value of attribute character.



2
3
4
# File 'lib/pfrpg_readers/attributes_reader.rb', line 2

def character
  @character
end

Instance Method Details

#as_json(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pfrpg_readers/attributes_reader.rb', line 8

def as_json(options={})
  {
    :values => {
      :strength => strength,
      :dexterity => dexterity,
      :charisma => charisma,
      :wisdom => wisdom,
      :constitution => constitution,
      :intelligence => intelligence
    },
    :modifier => {
      :strength => strength_modifier,
      :dexterity => dexterity_modifier,
      :charisma => charisma_modifier,
      :wisdom => wisdom_modifier,
      :constitution => constitution_modifier,
      :intelligence => intelligence_modifier
    }
  }
end

#charismaObject



45
46
47
# File 'lib/pfrpg_readers/attributes_reader.rb', line 45

def charisma
  @character.modified_cha
end

#charisma_modifierObject



49
50
51
# File 'lib/pfrpg_readers/attributes_reader.rb', line 49

def charisma_modifier
  @character.cha_mod
end

#constitutionObject



69
70
71
# File 'lib/pfrpg_readers/attributes_reader.rb', line 69

def constitution
  @character.modified_con
end

#constitution_modifierObject



73
74
75
# File 'lib/pfrpg_readers/attributes_reader.rb', line 73

def constitution_modifier
  @character.con_mod
end

#dexterityObject



37
38
39
# File 'lib/pfrpg_readers/attributes_reader.rb', line 37

def dexterity
  @character.modified_dex
end

#dexterity_modifierObject



41
42
43
# File 'lib/pfrpg_readers/attributes_reader.rb', line 41

def dexterity_modifier
 @character.dex_mod
end

#intelligenceObject



53
54
55
# File 'lib/pfrpg_readers/attributes_reader.rb', line 53

def intelligence
  @character.modified_int
end

#intelligence_modifierObject



57
58
59
# File 'lib/pfrpg_readers/attributes_reader.rb', line 57

def intelligence_modifier
  @character.int_mod
end

#strengthObject



29
30
31
# File 'lib/pfrpg_readers/attributes_reader.rb', line 29

def strength
  @character.modified_str
end

#strength_modifierObject



33
34
35
# File 'lib/pfrpg_readers/attributes_reader.rb', line 33

def strength_modifier
  @character.str_mod
end

#wisdomObject



61
62
63
# File 'lib/pfrpg_readers/attributes_reader.rb', line 61

def wisdom
  @character.modified_wis
end

#wisdom_modifierObject



65
66
67
# File 'lib/pfrpg_readers/attributes_reader.rb', line 65

def wisdom_modifier
  @character.wis_mod
end