Class: Core::Game::Spell

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#costObject (readonly)

Returns the value of attribute cost.



24
25
26
# File 'lib/game/spell.rb', line 24

def cost
  @cost
end

#iconObject (readonly)

Returns the value of attribute icon.



24
25
26
# File 'lib/game/spell.rb', line 24

def icon
  @icon
end

#nameObject (readonly)

Returns the value of attribute name.



24
25
26
# File 'lib/game/spell.rb', line 24

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



24
25
26
# File 'lib/game/spell.rb', line 24

def type
  @type
end

Instance Method Details

#cast(caster, target = nil) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/game/spell.rb', line 25

def cast(caster, target=nil)
  puts("#{caster} casts #{self.name} on #{target}")
  if Core::Game::Spells.respond_to?(self.name)
    Core::Game::Spells.send(self.name)
  else
    puts("ERROR: No ruby definition for spell #{self.name} found")
  end 
end