Class: Wowr::Classes::Spell
- Inherits:
-
Object
- Object
- Wowr::Classes::Spell
- Defined in:
- lib/wowr/character.rb
Overview
Decided to do funky stuff to the XML to make it more useful. instead of having two seperate lists of bonusDamage and critChance merged it into one set of objects for each thing
Instance Attribute Summary collapse
-
#arcane ⇒ Object
readonly
Returns the value of attribute arcane.
-
#bonus_healing ⇒ Object
readonly
Returns the value of attribute bonus_healing.
-
#fire ⇒ Object
readonly
Returns the value of attribute fire.
-
#frost ⇒ Object
readonly
Returns the value of attribute frost.
-
#hit_rating ⇒ Object
readonly
Returns the value of attribute hit_rating.
-
#holy ⇒ Object
readonly
Returns the value of attribute holy.
-
#mana_regen ⇒ Object
readonly
Returns the value of attribute mana_regen.
-
#nature ⇒ Object
readonly
Returns the value of attribute nature.
-
#penetration ⇒ Object
readonly
Returns the value of attribute penetration.
-
#shadow ⇒ Object
readonly
Returns the value of attribute shadow.
-
#speed ⇒ Object
readonly
Returns the value of attribute speed.
Instance Method Summary collapse
-
#initialize(elem) ⇒ Spell
constructor
A new instance of Spell.
Constructor Details
#initialize(elem) ⇒ Spell
Returns a new instance of Spell.
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
# File 'lib/wowr/character.rb', line 546 def initialize(elem) @arcane = SpellDamage.new(elem%'bonusDamage'%'arcane', elem%'critChance'%'arcane') @fire = SpellDamage.new(elem%'bonusDamage'%'fire', elem%'critChance'%'fire') @frost = SpellDamage.new(elem%'bonusDamage'%'frost', elem%'critChance'%'frost') @holy = SpellDamage.new(elem%'bonusDamage'%'holy', elem%'critChance'%'holy') @nature = SpellDamage.new(elem%'bonusDamage'%'nature', elem%'critChance'%'nature') @shadow = SpellDamage.new(elem%'bonusDamage'%'shadow', elem%'critChance'%'shadow') @bonus_healing = (elem%'bonusHealing')[:value].to_i # is this right?? @penetration = (elem%'penetration')[:value].to_i @hit_rating = WeaponHitRating.new(elem%'hitRating') @mana_regen = ManaRegen.new(elem%'manaRegen') @speed = SpellSpeed.new(elem%'hasteRating') # elements = %w[arcane fire frost holy nature shadow] # elements.each do |element| # # TODO: is this a good idea? # #instance_variable_set("@#{element}", foo) #?? # #eval("@#{element} = SpellDamage.new(elem[:bonusDamage][element][:value], elem[:critChance][element][:percent]).to_f)") # # eval("@#{element} = SpellDamage.new((elem%'bonusDamage'%element)[:value].to_i, # # (elem%'critChance'%element)[:percent].to_f)") # end end |
Instance Attribute Details
#arcane ⇒ Object (readonly)
Returns the value of attribute arcane.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def arcane @arcane end |
#bonus_healing ⇒ Object (readonly)
Returns the value of attribute bonus_healing.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def bonus_healing @bonus_healing end |
#fire ⇒ Object (readonly)
Returns the value of attribute fire.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def fire @fire end |
#frost ⇒ Object (readonly)
Returns the value of attribute frost.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def frost @frost end |
#hit_rating ⇒ Object (readonly)
Returns the value of attribute hit_rating.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def @hit_rating end |
#holy ⇒ Object (readonly)
Returns the value of attribute holy.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def holy @holy end |
#mana_regen ⇒ Object (readonly)
Returns the value of attribute mana_regen.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def mana_regen @mana_regen end |
#nature ⇒ Object (readonly)
Returns the value of attribute nature.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def nature @nature end |
#penetration ⇒ Object (readonly)
Returns the value of attribute penetration.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def penetration @penetration end |
#shadow ⇒ Object (readonly)
Returns the value of attribute shadow.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def shadow @shadow end |
#speed ⇒ Object (readonly)
Returns the value of attribute speed.
543 544 545 |
# File 'lib/wowr/character.rb', line 543 def speed @speed end |