ScriptName SuH_SuQuest extends Quest
{Dragon from Succubus Valley}

;#Include
SexLabFramework property SexLab auto

;Function Actors
Actor Property PlayerRef Auto

GlobalVariable Property SuH_PCSheartXP auto
GlobalVariable Property SuH_PCSheartXPgain auto
GlobalVariable Property SuH_PCSseductionpoints auto
GlobalVariable Property SuH_SETallowdynamic auto

MagicEffect property SuH_sp_trainingstateeffect auto
MagicEffect property SuH_sp_hungerstateeffect auto
MagicEffect property SuH_sp_focusedstateeffect auto
MagicEffect property SuH_sp_bracingstateeffect auto
MagicEffect property SuH_sp_succubusprowleffect auto

Spell Property SuH_dyna_cloakability auto
Spell Property SuH_dyna_ability auto
Spell Property SuH_dyna_player auto

int dyna
int dynaSwitch
	
;Initialization
Event OnInit()
	RegisterForSingleUpdate(5.0)
EndEvent

Event OnUpdate()
	;ent/ Dynamic Script
	playerRef.AddSpell(SuH_dyna_cloakability, false)
	playerRef.AddSpell(SuH_dyna_player, false)
	if DynaSwitch == 1
		PlayerRef.RemoveSpell(SuH_dyna_cloakability)
		dynaSwitch = 0
	else
		DynaSwitch = 1
	endIf
	;end/
	;ent/ Heart
	if playerRef.HasMagicEffect(SuH_sp_succubusprowleffect)
		float Spoints = SuH_PCSseductionpoints.GetValue()
		Spoints += 1
		SuH_PCSseductionpoints.SetValue(Spoints)
	endIf
	;end/
	;ent/ Meditation
	if playerRef.HasMagicEffect(SuH_sp_trainingstateeffect)
		float HeartXP = SuH_PCSheartXP.GetValue()
		float heartXPgain = SuH_PCSheartXPgain.GetValue()
		float Hxp = Math.Floor(HeartXP+(1*heartXPgain*0.01))
		SuH_PCSheartXP.SetValue(Hxp)
	elseIf playerRef.HasMagicEffect(SuH_sp_hungerstateeffect)
		float fstat = playerRef.GetBaseActorValue("health")
		if fstat < 1
		else
			float HeartXP = SuH_PCSheartXP.GetValue()
			float heartXPgain = SuH_PCSheartXPgain.GetValue()
			fstat -= 1
			float Hxp = Math.Floor(HeartXP+(3*heartXPgain*0.01))
			SuH_PCSheartXP.SetValue(Hxp)
			playerRef.SetActorValue("health", fstat)
		endIf
	elseIf playerRef.HasMagicEffect(SuH_sp_focusedstateeffect)
		float fstat = playerRef.GetBaseActorValue("magicka")
		if fstat < 1
		else
			float HeartXP = SuH_PCSheartXP.GetValue()
			float heartXPgain = SuH_PCSheartXPgain.GetValue()
			fstat -= 1
			float Hxp = Math.Floor(HeartXP+(3*heartXPgain*0.01))
			SuH_PCSheartXP.SetValue(Hxp)
			playerRef.SetActorValue("magicka", fstat)
		endIf
	elseIf playerRef.HasMagicEffect(SuH_sp_bracingstateeffect)
		float fstat = playerRef.GetBaseActorValue("stamina")
		if fstat < 1
		else
			float HeartXP = SuH_PCSheartXP.GetValue()
			float heartXPgain = SuH_PCSheartXPgain.GetValue()
			fstat -= 1
			float Hxp = Math.Floor(HeartXP+(3*heartXPgain*0.01))
			SuH_PCSheartXP.SetValue(Hxp)
			playerRef.SetActorValue("stamina", fstat)
		endIf
	endIf
	;end/
	
	RegisterForSingleUpdate(5.0)
endEvent