ScriptName SuH_NPCsconsentScript extends ActiveMagicEffect

GlobalVariable Property SuH_PCShpabsorb auto
GlobalVariable Property SuH_PCSmpabsorb auto
GlobalVariable Property SuH_PCSspabsorb auto

MagicEffect property SuH_sp_speciallovereffect auto
MagicEffect property SuH_sp_caringlovereffect auto
MagicEffect property SuH_sp_magicallovereffect auto
MagicEffect property SuH_sp_lastinglovereffect auto

Spell property SuH_NPCsvictim auto

Actor Property playerRef Auto

actor c

Event OnEffectStart(Actor akTarget, Actor akCaster)
	c = akTarget
	
	RegisterForSingleUpdate(5.0)
endEvent

Event OnUpdate()
	
	float fhealth = c.GetBaseActorValue("health")
	float fmagicka = c.GetBaseActorValue("magicka")
	float fstamina = c.GetBaseActorValue("stamina")
	cL = c.GetLevel()
	statCap = Math.Floor(100+(5*cL))
	
	if playerRef.HasMagicEffect(SuH_sp_speciallovereffect)
		float chealth = c.GetActorValue("health")
		float hheal = math.Floor((fhealth - chealth)*0.1)
		c.RestoreActorValue("health",hheal)
		float cmagicka = c.GetActorValue("magicka")
		float mheal = math.Floor((fmagicka - cmagicka)*0.1)
		c.RestoreActorValue("magicka",mheal)
		float cstamina = c.GetActorValue("stamina")
		float sheal = math.Floor((fstamina - cstamina)*0.1)
		c.RestoreActorValue("stamina",sheal)
	endIf
	if playerRef.HasMagicEffect(SuH_sp_caringlovereffect)
		if fhealth < statCap
			fhealth += 1
			c.SetActorValue("health",fhealth)
		endIf
	endIf
	if playerRef.HasMagicEffect(SuH_sp_magicallovereffect)
		if fmagicka < statCap
			fmagicka += 1
			c.SetActorValue("magicka",fmagicka)
		endIf
	endIf
	if playerRef.HasMagicEffect(SuH_sp_lastinglovereffect)
		if shealth < statCap
			fstamina += 1
			c.SetActorValue("stamina",fstamina)
		endIf
	endIf
	
	
	RegisterForSingleUpdate(5.0)
endEvent