Scriptname nDragonStatsScript extends activemagiceffect  

actor me
float fHP
float fMP
float fSP
float fAP
float fMD
float fMR

Event OnEffectStart(Actor akTarget, Actor akCaster)

me = akTarget
If !(me.IsInFaction(nDragonFaction))
		me.addtofaction(nDragonFaction)
		fHP = me.GetAV("Health") * (DDAttValue.Value/100.0)
		fMP = me.GetAV("Magicka") * (DDAttValue.Value/100.0)
		fSP = me.GetAV("Stamina") * (DDAttValue.Value/100.0)
		fMD = me.GetAV("UnarmedDamage") * (DDMeleeValue.Value/100.0)
		fAP = DDArmorValue.Value
		fMR = DDResValue.Value
		me.modAV("Health", fHP)
		me.modAV("Magicka", fMP)
		me.modAV("Stamina", fSP)
		me.modAV("UnarmedDamage", fMD) 
		me.modAV("DamageResist", fAP)
		me.modAV("MagicResist", fMR)
	If me.GetActorBase() != alduinBase
		me.GetActorBase().SetCombatStyle(nCSList.GetAt(nCS.GetValueInt()) as CombatStyle)
	Endif
Endif
Endevent

Event OnDying(Actor akKiller)
	If (me.IsInFaction(nDragonFaction))
		me.removefromfaction(nDragonFaction)
		me.modAV("Health", -fHP)
		me.modAV("Magicka", -fMP)
		me.modAV("Stamina", -fSP)
		me.modAV("UnarmedDamage", -fMD) 
		me.modAV("DamageResist", -fAP)
		me.modAV("MagicResist", -fMR)
	Endif
Endevent

GlobalVariable Property DDMeleeValue  Auto
GlobalVariable Property DDAttValue  Auto
GlobalVariable Property DDArmorValue  Auto
GlobalVariable Property DDResValue  Auto
GlobalVariable Property nCS  Auto
Faction Property nDragonFaction  Auto  

FormList Property nCSList  Auto  

ActorBase Property AlduinBase  Auto  
