Scriptname SuH_sexES_petspell extends activemagiceffect  


SuH_Fun property _Fun auto
GlobalVariable property SuH_PETeffect auto
GlobalVariable property SuH_PETeffectstrength auto
Actor property PlayerRef auto

int isPlayer
int effect
float strength
actor char

Event OnEffectStart(Actor akTarget, Actor akCaster)
	char = akTarget
	
	effect = SuH_PETeffect.GetValue() as int
	strength = SuH_PETeffectstrength.GetValue()
	
	if char == PlayerRef
		isPlayer == 1
	endIf
	if effect != 0
		RegisterForSingleUpdate(1.0)
	endIf
endEvent

Event OnUpdate()
	if effect == 1 ; Damage Target Stamina
		if isPlayer != 1 ; if not player
			char.DamageActorValue("Stamina", strength)
		endIf
	elseif effect == 2 ; Heal Target Health
		char.RestoreActorValue("Health", strength)
	elseif effect == 3 ; Damage Target Magicka
		if isPlayer != 1
			char.DamageActorValue("Magicka", strength)
		endIf
	elseif effect == 4 ; Gain HeartXP
		int x = Math.Floor(strength)
		_Fun.XPcalc(XPearn=x)
	elseif effect == 5 ; Damage Target Stamina
		if isPlayer != 1 ; if not player
			char.DamageActorValue("Health", strength)
		endIf
	endIf
	RegisterForSingleUpdate(1.0)
endEvent