ScriptName DfSV_NPCsconsentScript extends ActiveMagicEffect

GlobalVariable Property DfSV_Set_absorbconsent auto
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


Spell property DfSV_NPCsvictim auto

actor eActor

Event OnEffectStart(Actor akTarget, Actor akCaster)
	eActor = akTarget
	
	RegisterForSingleUpdate(3.0)
endEvent

Event OnUpdate()
	string bcheck = DfSV_Set_absorbconsent.GetValue()
	if bcheck == 1
		float playerhpa = DfSV_PCShpabsorb.GetValue()
		float playermpa = DfSV_PCSmpabsorb.GetValue()
		float playerspa = DfSV_PCSspabsorb.GetValue()
		float absorbMulti = DfSV_PCSabsorbmulti.GetValue()
		float eActorH = eActor.GetBaseActorValue("health")
		float eActorS = eActor.GetBaseActorValue("stamina")
		float eActorM = eActor.GetBaseActorValue("magicka")
		eActorH -= (playerhpa * absorbMulti * 0.6)
		eActorM -= (playermpa * absorbMulti * 0.6)
		eActorS -= (playerspa * absorbMulti * 0.6)
		eActor.SetActorValue("health", eActorH)
		eActor.SetActorValue("stamina", eActorS)
		eActor.SetActorValue("magicka", eActorM)
		RegisterForSingleUpdate(3.0)
	endIf
endEvent