Scriptname SuH_ss_manadropScript extends activemagiceffect  

GlobalVariable Property SuH_PCSheartXP auto
GlobalVariable Property SuH_PCSheartXPgain auto

Actor Property playerRef Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	if akCaster == playerRef
		int x = Math.Floor(playerRef.GetBaseActorValue("magicka"))
		if x > 100
			int z = Math.Floor(SuH_PCSheartXP.GetValue())
			int a = Math.Floor(SuH_PCSheartXPgain.GetValue())
			int y = Math.Floor((200*a)*0.01)
			z += y
			x -= 100
			playerRef.SetActorValue("magicka",x)
			SuH_PCSheartXP.SetValue(z)
		elseIf x > 1
			int z = Math.Floor(SuH_PCSheartXP.GetValue())
			int a = Math.Floor(SuH_PCSheartXPgain.GetValue())
			x -= 1
			int y = Math.Floor(((x*2)*a)*0.01)
			z += y
			playerRef.SetActorValue("magicka",1)
			SuH_PCSheartXP.SetValue(z)
		endIf
	endIf
endEvent