ScriptName VampireMindBlastTimerScript extends ActiveMagicEffect

GlobalVariable Property RECASTVampireMindBlast Auto
GlobalVariable Property VampireAbilityTimers Auto
Spell Property VampireCloak Auto
PlayerVampireQuestScript Property PlayerVampireQuest  Auto
GlobalVariable Property EnableVampireBloodPoints Auto
GlobalVariable Property VampireMindBlastToggle Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)

	If VampireMindBlastToggle.GetValue() == 0
	
		VampireMindBlastToggle.SetValue(1)	
	
		If EnableVampireBloodPoints.GetValue() == 10000 && RECASTVampireMindBlast.GetValue() == 0
			PlayerVampireQuest.VampireBloodPoints(50)
		EndIf		
	
	Else
	
		Game.GetPlayer().DispelSpell(VampireCloak)
		VampireMindBlastToggle.SetValue(0)		
		
	EndIf
	
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)

	If RECASTVampireMindBlast.GetValue() <= 1
		RECASTVampireMindBlast.SetValue(1)
	EndIf

	If RECASTVampireMindBlast.GetValue() == 1
	
		RECASTVampireMindBlast.SetValue(2)	
		If VampireAbilityTimers.GetValue() == 0	
			Debug.Notification("You need to wait before attempting to mind blast again")	
			Utility.WaitGameTime(5)
			Utility.Wait(0.1)
			If Game.GetPlayer().HasSpell(VampireCloak)
				Debug.Notification("Mind Blast is available for use")
			EndIf	
		EndIf	
		RECASTVampireMindBlast.SetValue(0)
		
	EndIf		
		
	VampireMindBlastToggle.SetValue(0)	
		
EndEvent
