ScriptName DfSV_PCStrainingScript extends ActiveMagicEffect

GlobalVariable Property DfSV_PCSheartXP auto
GlobalVariable Property DfSV_PCShpabsorb auto
GlobalVariable Property DfSV_PCSmpabsorb auto
GlobalVariable Property DfSV_PCSspabsorb auto
GlobalVariable Property DfSV_PCSheartXPgain auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	RegisterForSingleUpdate(3.0)
EndEvent

Event OnUpdate()
	float playerhpa = DfSV_PCShpabsorb.GetValue()
	float playermpa = DfSV_PCSmpabsorb.GetValue()
	float playerspa = DfSV_PCSspabsorb.GetValue()
	float playerHeartXP = DfSV_PCSheartXP.GetValue()
	float playerHealth = Game.GetPlayer().GetBaseActorValue("health")
	float playerStamina = Game.GetPlayer().GetBaseActorValue("stamina")
	float playerMagicka = Game.GetPlayer().GetBaseActorValue("magicka")
	float heartXPgain = DfSV_PCSheartXPgain.GetValue()
	
	playerHeartXP += Math.Floor(3*heartXPgain)
	playerHealth += Math.Floor(playerhpa*0.5)
	playerStamina += Math.Floor(playerspa*0.5)
	playerMagicka += Math.Floor(playermpa*0.5)
	DfSV_PCSheartXP.SetValue(playerHeartXP)
	Game.GetPlayer().SetActorValue("health", playerHealth)
	Game.GetPlayer().SetActorValue("stamina", playerStamina)
	Game.GetPlayer().SetActorValue("magicka", playerMagicka)
	RegisterForSingleUpdate(3.0)
endEvent