Class: Core::Game::Spell
Instance Attribute Summary collapse
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
24 25 26 |
# File 'lib/game/spell.rb', line 24 def cost @cost end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
24 25 26 |
# File 'lib/game/spell.rb', line 24 def icon @icon end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/game/spell.rb', line 24 def name @name end |
#type ⇒ Object (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 |