require "Effect.rb"
require "NoMove.rb"

module RubyMud

class FreezeSpell < Effect

	def initialize(actor, target)
		super(actor,target,"FreezeSpell")

		# This spell puts a NoMove flag on the target
		@noMove = NoMove.new(@target)
		
		# The spell is active for 5 ticks
		@ticks = 5
		
		# Add the spell to the tick queue
		$mainTick.AddTickable(self)
		
	end
	
	def Tick()

		@ticks -= 1
		
		# Spell also causes target to loose 1hp per tick
		@target.GetStatByClass(Hp).Value -= 1
				
		# If we are on tick 0, remove this effect from the target
		if (@ticks <= 0)
			@target.RemoveEffect(self)
		end
	end
	
	# Called when it is removed from the target.
	def Removing()
		# When this effect is removed we also remove the NoMove stat from the target
		@target.RemoveFlag(@noMove)
		# And remove it from the ticking queue
		$mainTick.RemoveTickable(self)
	end
	
end

# Add it to our effects list
Effects.Add(FreezeSpell)

end #effect