Scriptname _00E_FS_A2_Ghostwalk_New_SC extends activemagiceffect  

Import _00E_TalentLibrary

;=====================================================================================
;              							 EVENTS                   					 
;=====================================================================================

Event OnEffectStart(Actor akTarget, Actor akCaster)

	_00E_FS_A2_Ghostwalk_New_IMOD.Apply()
	MAGIllusionReleaseAimedSDM.Play(PlayerREF)
	CastCloak()

EndEvent

;=====================================================================================
;              							 FUNCTIONS                   					 
;=====================================================================================

Function CastCloak()

	int iIndex = GetPlayerTalentLevel(_00E_Class_Infiltrator_P08_B_Talent_Ghostwalk_01, _00E_Class_Infiltrator_P08_B_Talent_Ghostwalk_02, _00E_Class_Infiltrator_P08_B_Talent_Ghostwalk_03)
	float iDuration = _00E_FS_A2_Ghostwalk_NewSP.GetNthEffectMagnitude(iIndex + 3)
	_00E_A2_GhostwalkCloakSP.SetNthEffectDuration(0, iDuration as Int)
	_00E_A2_GhostwalkCloakSP.Cast(PlayerREF, PlayerREF)

EndFunction

;=====================================================================================
;              							 PROPERTIES                   					 
;=====================================================================================

Actor Property PlayerREF Auto

Sound Property MAGIllusionReleaseAimedSDM Auto

Spell Property _00E_A2_GhostwalkCloakSP Auto
Spell Property _00E_FS_A2_Ghostwalk_NewSP Auto

Perk Property _00E_Class_Infiltrator_P08_B_Talent_Ghostwalk_01 Auto
Perk Property _00E_Class_Infiltrator_P08_B_Talent_Ghostwalk_02 Auto
Perk Property _00E_Class_Infiltrator_P08_B_Talent_Ghostwalk_03 Auto

ImageSpaceModifier Property _00E_FS_A2_Ghostwalk_New_IMOD Auto