Scriptname SuH_ss_drainshotScript extends activemagiceffect  

GlobalVariable Property SuH_PCSheartXP auto
GlobalVariable Property SuH_PCSheartXPgain auto

actor property playerRef auto

event OnEffectStart(Actor akTarget, Actor akCaster)
	actor tC = akTarget
	actor cC = akCaster
	
	int tH = tC.GetBaseActorValue("health") as int
	int tHd = Math.Floor(tH*0.1)
	int tM = tC.GetBaseActorValue("magicka") as int
	int tMd = Math.FLoor(tM*0.1)
	int tS = tC.GetBaseActorValue("stamina") as int
	int tSd = Math.Floor(tS*0.1)
	tC.SetActorValue("health", tH*0.9)
	tC.SetActorValue("magicka", tM*0.9)
	tC.SetActorValue("stamina", tS*0.9)
	
	if cC == playerRef
		int tA = tHd+tMd+tSd
		float XPgain = SuH_PCSheartXPgain.GetValue()
		float XP = SuH_PCSheartXP.GetValue()
		int XPup = Math.Floor(XP+(tA*(XPgain*0.01)))
		SuH_PCSheartXP.SetValue(XPup)
	endIf
endEvent