ScriptName DfSV_SuccubusQuest extends Quest
{Dragon from Succubus Valley}

;#Include
SexLabFramework property SexLab auto

	;Function Actors
	Actor Property PlayerRef Auto

	;Global
	GlobalVariable Property DfSV_PCSheartForce auto
	GlobalVariable Property DfSV_PCSheartForceMAX auto
	GlobalVariable Property DfSV_PCSabsorbmulti auto
	GlobalVariable Property DfSV_PCSheartXPmulti auto
	GlobalVariable Property DfSV_PCSdecaydelay auto
	GlobalVariable Property DfSV_Set_playerdecay auto
	
	;Initialization
Event OnInit()
	RegisterForSingleUpdate(3.0)
EndEvent

Event OnUpdate()
	Float playerHeartForceMAX = DfSV_PCSheartForceMAX.GetValue()
	Float playerHeartForce = DfSV_PCSheartForce.GetValue()
	float absorbmulti = DfSV_PCSabsorbmulti.GetValue()
	float heartXPmulti = DfSV_PCSheartXPmulti.GetValue()
	float DDelay = DfSV_PCSdecaydelay.GetValue()
	float Dcheck = DfSV_Set_playerdecay.GetValue()
	float playerHealth = Game.GetPlayer().GetBaseActorValue("health")
	float playerStamina = Game.GetPlayer().GetBaseActorValue("stamina")
	float playerMagicka = Game.GetPlayer().GetBaseActorValue("magicka")
	int charLevel = Game.GetPlayer().GetLevel()
	float statCap = 101+(10*charLevel)
	
	float playerHeartForceGain = (playerHeartForceMAX/100*3)
	
	playerHeartForce += playerHeartForceGain
	if playerHeartForce > playerHeartForceMAX
		DfSV_PCSheartForce.SetValue(playerHeartForceMAX)
	elseIf playerHeartForce < 0
		playerHeartForce = 0
		DfSV_PCSheartForce.SetValue(playerHeartForce)
	else
		DfSV_PCSheartForce.SetValue(playerHeartForce)
	endIf
	
	
	if DDelay >= 2
		if (playerHealth >= statCap)
			playerHealth -= 1
			Game.GetPlayer().SetActorValue("health", playerHealth)
		endIf
		if (playerStamina >= statCap)
			playerStamina -= 1
			Game.GetPlayer().SetActorValue("stamina", playerStamina)
		endIf
		if (playerMagicka >= statCap)
			playerMagicka -= 1
			Game.GetPlayer().SetActorValue("magicka", playerMagicka)
		endIf
		DDelay == 0
		DfSV_PCSdecaydelay.SetValue(DDelay)
	else
		DDelay += 1
		DfSV_PCSdecaydelay.SetValue(DDelay)
	endIf
	
;	DfSV_PCSdecaydelay.SetValue(DDelay)
	RegisterForSingleUpdate(3.0)
endEvent