Class: PfrpgCore::Spell

Inherits:
Object
  • Object
show all
Defined in:
lib/pfrpg_core/spell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(array) ⇒ Spell

Returns a new instance of Spell.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pfrpg_core/spell.rb', line 7

def initialize(array)
  @id = array[0]
  @name = array[1]
  @spell_level = array[2]
  @effect = array[3]
  @targets = array[4]
  @duration = array[5]
  @range = array[6]
  @saving_throw = array[7]
  @spell_resistance = array[8]
  @sorcerer_level = array[9]
  @description = array[10]
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def description
  @description
end

#durationObject (readonly)

Returns the value of attribute duration.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def duration
  @duration
end

#effectObject (readonly)

Returns the value of attribute effect.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def effect
  @effect
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def name
  @name
end

#rangeObject (readonly)

Returns the value of attribute range.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def range
  @range
end

#saving_throwObject (readonly)

Returns the value of attribute saving_throw.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def saving_throw
  @saving_throw
end

#sorcerer_levelObject (readonly)

Returns the value of attribute sorcerer_level.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def sorcerer_level
  @sorcerer_level
end

#spell_levelObject (readonly)

Returns the value of attribute spell_level.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def spell_level
  @spell_level
end

#spell_resistanceObject (readonly)

Returns the value of attribute spell_resistance.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def spell_resistance
  @spell_resistance
end

#targetsObject (readonly)

Returns the value of attribute targets.



3
4
5
# File 'lib/pfrpg_core/spell.rb', line 3

def targets
  @targets
end

Instance Method Details

#as_json(options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/pfrpg_core/spell.rb', line 21

def as_json(options={})
  {
    :id => id,
    :name => name,
    :spell_level => spell_level,
    :effect => effect,
    :targets => targets,
    :duration => duration,
    :range => range,
    :saving_throw => saving_throw,
    :spell_resistance => spell_resistance,
    :sorcerer_level => sorcerer_level,
    :description => description
  }
end