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_PCSheartForceInc auto
	GlobalVariable Property DfSV_PCSabsorbmulti auto
	GlobalVariable Property DfSV_PCSheartXPmulti auto
	GlobalVariable Property DfSV_PCSforceusage auto
	GlobalVariable Property DfSV_PCSdecayrate auto
	GlobalVariable Property DfSV_PCSdecaydelay auto
	GlobalVariable Property DfSV_Set_playerdecay auto
	
	;Initialization
Event OnInit()
	RegisterForSingleUpdate(5.0)
EndEvent

Event OnUpdate()
	Float playerHeartForceInc = DfSV_PCSheartForceInc.GetValue()
	Float playerHeartForceMAX = DfSV_PCSheartForceMAX.GetValue()
	Float playerHeartForce = DfSV_PCSheartForce.GetValue()
;	float lowheartValCheck = (playerHeartForceMax * 0.1)
;	float highheartValCheck = (playerHeartForceMax * 0.9)
	float absorbmulti = DfSV_PCSabsorbmulti.GetValue()
	float heartXPmulti = DfSV_PCSheartXPmulti.GetValue()
	float forceusage = DfSV_PCSforceusage.GetValue()
	float playerDecayrate = DfSV_PCSdecayrate.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)
	
	playerHeartForce += playerHeartForceInc
	if playerHeartForce > playerHeartForceMAX
		DfSV_PCSheartForce.SetValue(playerHeartForceMAX)
	elseIf playerHeartForce < 0
		playerHeartForce = 0
		DfSV_PCSheartForce.SetValue(playerHeartForce)
	else
		DfSV_PCSheartForce.SetValue(playerHeartForce)
	endIf
	
;	if playerHeartForce >= highheartValCheck
;		absorbmulti = 1.5
;		DfSV_PCSabsorbmulti.SetValue(absorbmulti)
;		heartXPmulti = 1.5
;		DfSV_PCSheartXPmulti.SetValue(heartXPmulti)
;	elseIf playerHeartForce <= lowheartValCheck
;		absorbmulti = 0.5
;		DfSV_PCSabsorbmulti.SetValue(absorbmulti)
;		heartXPmulti = 0.5
;		DfSV_PCSheartXPmulti.SetValue(heartXPmulti)
;	else
;		absorbmulti = 1.0
;		DfSV_PCSabsorbmulti.SetValue(absorbmulti)
;		heartXPmulti = 1.0
;		DfSV_PCSheartXPmulti.SetValue(heartXPmulti)
;	endIf
	
	if (playerHealth > statCap)
		playerHealth -= (playerDecayrate)
		Game.GetPlayer().SetActorValue("health", playerHealth)
	endIf
	if (playerStamina > statCap)
		playerStamina -= (playerDecayrate)
		Game.GetPlayer().SetActorValue("stamina", playerStamina)
	endIf
	if (playerMagicka > statCap)
		playerMagicka -= (playerDecayrate)
		Game.GetPlayer().SetActorValue("magicka", playerMagicka)
	endIf
;	DfSV_PCSdecaydelay.SetValue(DDelay)
	RegisterForSingleUpdate(5.0)
endEvent