Class: Natural20::Spell

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

Direct Known Subclasses

Firebolt, MageArmor, MagicHand, MagicMissile, Shield

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, spell_name, details) ⇒ Spell

Returns a new instance of Spell.



5
6
7
8
9
10
# File 'lib/natural_20/spell_library/spell.rb', line 5

def initialize(source, spell_name, details)
  @name = spell_name
  @properties = details
  @source = source
  @errors = []
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



2
3
4
# File 'lib/natural_20/spell_library/spell.rb', line 2

def errors
  @errors
end

#propertiesObject (readonly)

Returns the value of attribute properties.



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

def properties
  @properties
end

#sourceObject (readonly)

Returns the value of attribute source.



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

def source
  @source
end

Class Method Details

.apply!(battle, item) ⇒ Object



20
# File 'lib/natural_20/spell_library/spell.rb', line 20

def self.apply!(battle, item); end

Instance Method Details

#idObject



16
17
18
# File 'lib/natural_20/spell_library/spell.rb', line 16

def id
  @properties[:id]
end

#labelObject



12
13
14
# File 'lib/natural_20/spell_library/spell.rb', line 12

def label
  t(:"spell.#{@name}")
end

#validate!(_action) ⇒ Object



22
23
24
# File 'lib/natural_20/spell_library/spell.rb', line 22

def validate!(_action)
  @errors.clear
end