Scriptname SuH_comES_milk extends activemagiceffect  

SuH_Fun property _Fun auto

GlobalVariable property SuH_PCSstackmaxmilk auto
GlobalVariable property SuH_PCSstackmilk auto
GlobalVariable property SuH_rank_lusciousliquids auto
GlobalVariable property SuH_rank_lusciousliquids2 auto
GlobalVariable property SuH_rank_valuestacker auto

;ent/ Actors
Actor property PlayerRef auto
;end/

Event OnEffectStart(Actor akTarget, Actor akCaster)
	if akTarget == PlayerRef ; If player consumes
		_Fun.XPcalc("PCmilk") ; Grant XP
		_Fun.STATcalc(PlayerRef, aPreset="PCmilk", stat="All") ; Grant Absorption
		int x = SuH_PCSstackmilk.GetValue() as int ; Milk Stacks
		int y = SuH_PCSstackmaxmilk.GetValue() as int ; Max Stacks
		if x < y
			int z = Math.Floor(x + (1 + SuH_rank_valuestacker.GetValue())) ; Final Stack Count
			if z < y
				SuH_PCSstackmilk.SetValue(z)
			else
				SuH_PCSstackmilk.SetValue(y)
			endIf
		endIf
		x = Math.Floor(SuH_rank_lusciousliquids.GetValue() * 5) ; LL Health Passive
		y = Math.Floor(SuH_rank_lusciousliquids2.GetValue() * 5) ; LL Magicka/Stamina Passive
		akTarget.RestoreActorValue("Health", x)
		akTarget.RestoreActorValue("Magicka", y)
		akTarget.RestoreActorValue("Stamina", y)
	endIf
endEvent