Class: Wowr::Classes::Spell

Inherits:
Object
  • Object
show all
Defined in:
lib/wowr/classes.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

Instance Method Summary collapse

Constructor Details

#initialize(elem) ⇒ Spell

Returns a new instance of Spell.



470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/wowr/classes.rb', line 470

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')
	
	# 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

#arcaneObject (readonly)

Returns the value of attribute arcane.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def arcane
  @arcane
end

#bonus_healingObject (readonly)

Returns the value of attribute bonus_healing.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def bonus_healing
  @bonus_healing
end

#fireObject (readonly)

Returns the value of attribute fire.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def fire
  @fire
end

#frostObject (readonly)

Returns the value of attribute frost.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def frost
  @frost
end

#hit_ratingObject (readonly)

Returns the value of attribute hit_rating.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def hit_rating
  @hit_rating
end

#holyObject (readonly)

Returns the value of attribute holy.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def holy
  @holy
end

#mana_regenObject (readonly)

Returns the value of attribute mana_regen.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def mana_regen
  @mana_regen
end

#natureObject (readonly)

Returns the value of attribute nature.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def nature
  @nature
end

#penetrationObject (readonly)

Returns the value of attribute penetration.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def penetration
  @penetration
end

#shadowObject (readonly)

Returns the value of attribute shadow.



467
468
469
# File 'lib/wowr/classes.rb', line 467

def shadow
  @shadow
end