Scriptname _00E_FS_Affinity_Ghostblade_OnAttack extends activemagiceffect  

_FS_Phasmalist_ControlQuest Property PhasmalistControlQuest Auto
Weapon Property _00E_FS_Affinity_Ghostblade_EtherealDagger Auto
Spell Property _00E_FakeArrowSP Auto
Spell Property _00E_FS_Ghostblade_FakeAttackSpellSP Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Actor akApparition = PhasmalistControlQuest.GetApparitionFailsafeRef()
	If akApparition
		Int iEquippedItemType = akApparition.GetEquippedItemType(1)
		If iEquippedItemType <= 6
			akApparition.MoveTo(akTarget)
			Debug.SendAnimationEvent(akApparition, "attackPowerStartInPlace")
			Utility.Wait(1)
			akApparition.RemoveItem(_00E_FS_Affinity_Ghostblade_EtherealDagger, 1)
		ElseIf iEquippedItemType == 7
			_00E_FakeArrowSP.Cast(akApparition, akTarget)
		Else
			_00E_FS_Ghostblade_FakeAttackSpellSP.Cast(akApparition, akTarget)
		EndIf
		akTarget.DamageActorValue("Health", 80)
	EndIf
EndEvent