Scriptname VampireRankBlinkAttackScript extends activemagiceffect

Actor Property BlinkTarget Auto
Sound Property QSTDA09LightBeamOn Auto
Spell Property VampireRankBlinkAttackSpell Auto
Spell Property VampireQuickReflexesSpell06 Auto
ImageSpaceModifier Property TimeFreezeIMOD Auto

GlobalVariable Property RECASTVampireBlink Auto
GlobalVariable Property VampireAbilityTimers Auto

PlayerVampireQuestScript Property PlayerVampireQuest  Auto
GlobalVariable Property EnableVampireBloodPoints Auto

EVENT OnEffectStart(Actor akTarget, Actor akBlinkCaster)

	If RECASTVampireBlink.GetValue() <= 1
	
		VampireQuickReflexesSpell06.Cast(Game.GetPlayer(), Game.GetPlayer())
	
		TimeFreezeIMOD.applyCrossFade(2.0)
	
		RECASTVampireBlink.SetValue(1)
		Utility.Wait(0.3)
		
		Int instanceID1 = QSTDA09LightBeamOn.Play(Game.GetPlayer())
		Sound.SetInstanceVolume(instanceID1, 1.0)
		Utility.Wait(0.3)
		
		If EnableVampireBloodPoints.GetValue() == 0
			Game.GetPlayer().DamageAV("Stamina", 1000)
		EndIf
		Game.GetPlayer().MoveTo(akTarget, -120 * Math.Sin(akTarget.GetAngleZ()), -120 * Math.Cos(akTarget.GetAngleZ()), 0, abMatchRotation = true)

		If EnableVampireBloodPoints.GetValue() == 10000
			PlayerVampireQuest.VampireBloodPoints(30)
		EndIf			
		
		imageSpaceModifier.removeCrossFade()			
		
		If VampireAbilityTimers.GetValue() == 0
			Debug.Notification("You need to wait before attempting to blink again")			
			Utility.WaitGameTime(2)
			Utility.Wait(0.1)
			If Game.GetPlayer().HasSpell(VampireRankBlinkAttackSpell)
				Debug.Notification("Blink Attack is available for use")
			EndIf	
		EndIf		
		RECASTVampireBlink.SetValue(0)

	EndIf	

EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
	

	
EndEvent
