Scriptname SuH_sexES_NPCconsent extends activemagiceffect  

SuH_Fun property _Fun auto
GlobalVariable property SuH_SETconsentdrain auto
GlobalVariable property SuH_rank_giftedconsent auto
Actor property PlayerRef auto

Actor char

Event OnEffectStart(Actor akTarget, Actor akCaster)
	if akTarget == PlayerRef
		debug.trace("SuH ERROR : NPCattacker set on PC - NULL Effect", 2) ;Error report to log
	else
		char = akTarget
		RegisterForSingleUpdate(5.0)
	endIf
endEvent

Event OnUpdate()
	int x = SuH_rank_giftedconsent.GetValue() as int
	if x > 0
		int h = Math.Floor(x + char.GetBaseActorValue("health"))
		int m = Math.Floor(x + char.GetBaseActorValue("magicka"))
		int s = Math.Floor(x + char.GetBaseActorValue("stamina"))
		char.SetActorValue("health", h)
		char.SetActorValue("magicka", m)
		char.SetActorValue("stamina", s)
	endIf	
	; Call functions from SuH_Fun
	if SuH_SETconsentdrain.GetValue()
		_Fun.STATcalc(char, TRUE, "PCtraining", "All", True, 0.0, 0.0, False)
	endIf
	RegisterForSingleUpdate(5.0)
endEvent