Scriptname SuH_spellES_pet extends activemagiceffect  

SuH_Fun property _f auto
SuH_Status property _s auto

int hitcd
int petslot

Event OnInit()
	_f = Game.GetFormFromFile(0x814, "Succubus Heart.esp") as SuH_Fun
	_s = Game.GetFormFromFile(0x16E496, "Succubus Heart.esp") as SuH_Status
endEvent

Event OnEffectStart(Actor akTarget, Actor akCaster)
	petslot = _s.SuH_petactive
endEvent

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
	if hitcd ==0
		_f.PetXP(petslot, 10)
		hitcd = 1
		RegisterForSingleUpdate(5.0)
	endIf
endEvent

Event OnDying(Actor attchar)
	_f.PetDeath(petslot)
endEvent

Event OnUpdate()
	hitcd = 0
endEvent