ScriptName DfSV_PCSmasteryScript extends ActiveMagicEffect

GlobalVariable Property DfSV_PCSheartXP auto
GlobalVariable Property DfSV_PCSheartForce auto
GlobalVariable Property DfSV_PCSheartForceMax auto
GlobalVariable Property DfSV_PCShpabsorb auto
GlobalVariable Property DfSV_PCSmpabsorb auto
GlobalVariable Property DfSV_PCSspabsorb auto
GlobalVariable Property DfSV_PCSabsorbmulti auto
GlobalVariable Property DfSV_PCSheartXPmulti auto
GlobalVariable Property DfSV_PCSforceusage auto
GlobalVariable Property DfSV_PCSforceabsorb auto
GlobalVariable Property DfSV_PCSheartXPgain auto

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

Event OnUpdate()
	Float fPlayerHeartForce = DfSV_PCSheartForce.GetValue()
	Float fPlayerHeartForceMax = DfSV_PCSheartForceMax.GetValue()
	float playerhpa = DfSV_PCShpabsorb.GetValue()
	float playermpa = DfSV_PCSmpabsorb.GetValue()
	float playerspa = DfSV_PCSspabsorb.GetValue()
	float absorbmulti = DfSV_PCSabsorbmulti.GetValue()
	float heartXPmulti = DfSV_PCSheartXPmulti.GetValue()
	float playerHeartXP = DfSV_PCSheartXP.GetValue()
	Float playerHeartForce = DfSV_PCSheartForce.GetValue()
	float playerHealth = Game.GetPlayer().GetBaseActorValue("health")
	float playerStamina = Game.GetPlayer().GetBaseActorValue("stamina")
	float playerMagicka = Game.GetPlayer().GetBaseActorValue("magicka")
	float forceusage = DfSV_PCSforceusage.GetValue()
	float forceabsorb = DfSV_PCSforceabsorb.GetValue()
	float heartXPgain = DfSV_PCSheartXPgain.GetValue()
	
	playerHeartXP += (heartXPgain * heartXPmulti)
	playerHeartForce += (forceabsorb)
	playerHealth += (playerhpa * absorbmulti)
	playerStamina += (playerspa * absorbmulti)
	playerMagicka += (playermpa * absorbmulti)
	DfSV_PCSheartXP.SetValue(playerHeartXP)
	DfSV_PCSheartForce.SetValue(playerHeartForce)
	Game.GetPlayer().SetActorValue("health", playerHealth)
	Game.GetPlayer().SetActorValue("stamina", playerStamina)
	Game.GetPlayer().SetActorValue("magicka", playerMagicka)
	RegisterForSingleUpdate(5.0)
endEvent