Class: PfrpgCore::SpellBooks
- Inherits:
-
Object
- Object
- PfrpgCore::SpellBooks
- Defined in:
- lib/pfrpg_core/spell_books.rb
Defined Under Namespace
Classes: InvalidClassException, InvalidSpellException, SpellNotFoundException, TooLowAttributeException, TooManySpellsException
Instance Attribute Summary collapse
-
#bard ⇒ Object
readonly
Returns the value of attribute bard.
-
#cleric ⇒ Object
readonly
Returns the value of attribute cleric.
-
#druid ⇒ Object
readonly
Returns the value of attribute druid.
-
#paladin ⇒ Object
readonly
Returns the value of attribute paladin.
-
#ranger ⇒ Object
readonly
Returns the value of attribute ranger.
-
#sorcerer ⇒ Object
readonly
Returns the value of attribute sorcerer.
-
#wizard ⇒ Object
readonly
Returns the value of attribute wizard.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(character) ⇒ SpellBooks
constructor
A new instance of SpellBooks.
Constructor Details
#initialize(character) ⇒ SpellBooks
Returns a new instance of SpellBooks.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pfrpg_core/spell_books.rb', line 12 def initialize(character) l = character.latest_levels @wizard = character.spells_per_level('Wizard', l) @cleric = character.spells_per_level('Cleric', l) @druid = character.spells_per_level('Druid', l) @paladin = character.spells_per_level('Paladin', l) @ranger = character.spells_per_level('Ranger', l) = character.spells_per_level('Bard', l) @sorcerer = character.known_sorcerer_spells end |
Instance Attribute Details
#bard ⇒ Object (readonly)
Returns the value of attribute bard.
10 11 12 |
# File 'lib/pfrpg_core/spell_books.rb', line 10 def end |
#cleric ⇒ Object (readonly)
Returns the value of attribute cleric.
10 11 12 |
# File 'lib/pfrpg_core/spell_books.rb', line 10 def cleric @cleric end |
#druid ⇒ Object (readonly)
Returns the value of attribute druid.
10 11 12 |
# File 'lib/pfrpg_core/spell_books.rb', line 10 def druid @druid end |
#paladin ⇒ Object (readonly)
Returns the value of attribute paladin.
10 11 12 |
# File 'lib/pfrpg_core/spell_books.rb', line 10 def paladin @paladin end |
#ranger ⇒ Object (readonly)
Returns the value of attribute ranger.
10 11 12 |
# File 'lib/pfrpg_core/spell_books.rb', line 10 def ranger @ranger end |
#sorcerer ⇒ Object (readonly)
Returns the value of attribute sorcerer.
10 11 12 |
# File 'lib/pfrpg_core/spell_books.rb', line 10 def sorcerer @sorcerer end |
#wizard ⇒ Object (readonly)
Returns the value of attribute wizard.
10 11 12 |
# File 'lib/pfrpg_core/spell_books.rb', line 10 def wizard @wizard end |
Instance Method Details
#as_json(options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pfrpg_core/spell_books.rb', line 23 def as_json(={}) { :sorcerer_spells => @sorcerer, :Cleric => @cleric, :Wizard => @wizard, :Druid => @druid, :Paladin => @paladin, :Ranger => @ranger, :Bard => } end |