--HoTP 2.0
TRIGGER
function()
	return true
end

ICON --Trigger for scripts
function()
	aura_env.percentageHealth = aura_env.round((UnitHealth("player") / UnitHealthMax("player")) * 100, 0)
	aura_env.currentHealth = UnitHealth("player")
	aura_env.maxHealth = UnitHealthMax("player")
    aura_env.missingHealthPercentage = aura_env.round(((UnitHealthMax("player") - UnitHealth("player")) / UnitHealthMax("player")) * 100, 2)
    aura_env.missingHealth = UnitHealthMax("player") - UnitHealth("player")
	local healingMultiplier = 1.
	local versa = GetCombatRatingBonus(CR_VERSATILITY_DAMAGE_DONE)
	healingMultiplier = healingMultiplier + (healingMultiplier * (aura_env.traitLevel * aura_env.traitEffectiveness)) + (healingMultiplier * (versa / 100))
	for k,v in pairs(aura_env.buffs) do
		if UnitBuff("player", k) ~= nil then
			healingMultiplier = healingMultiplier + (healingMultiplier * v)
		end
	end
	local talent = select(10, GetTalentInfoByID(22430))
	if talent == true then
		healingMultiplier = healingMultiplier + (healingMultiplier * 0.3)
	end
	aura_env.hotpRelativeHeal = 0.3 * healingMultiplier --How much % hotp heals disregarding missing health
	aura_env.hotpAbsoluteRelativeHeal = aura_env.hotpRelativeHeal * aura_env.missingHealthPercentage --How much % hp hotp will heal regarding missing health
	aura_env.hotpAbsoluteHeal = aura_env.round(aura_env.hotpRelativeHeal * aura_env.missingHealth, 0)
	aura_env.newApsoluteHealth = aura_env.round(aura_env.currentHealth + aura_env.hotpAbsoluteHeal, 0)
	aura_env.newRelativeHealth = aura_env.round(aura_env.percentageHealth + aura_env.hotpAbsoluteRelativeHeal, 0)
	--print(healingMultiplier,aura_env.hotpRelativeHeal,aura_env.hotpAbsoluteRelativeHeal,aura_env.hotpAbsoluteHeal,aura_env.newApsoluteHealth,aura_env.newRelativeHealth) --DEBUG
	--print(aura_env.hotpAbsoluteRelativeHeal, aura_env.newRelativeHealth, aura_env.percentageHealth) --DEBUG
	--print(aura_env.hotpAbsoluteHeal, aura_env.newApsoluteHealth, aura_env.currentHealth) --DEBUG
	--print(aura_env.round(aura_env.hotpRelativeHeal * 100, 0)) --% of health hotp heals
end

DURATION
function()
	return aura_env.newRelativeHealth, 100, 1
end

INIT
aura_env.traitLevel = 7
aura_env.traitEffectiveness = 0.06
aura_env.buffs = 
{
	["Consecration"] = 0.3,
	["Avenging Wrath"] = 0.35,
	["Chains of Thrayn"] = 0.5,
	["Ilterendi, Crown Jewel of Silvermoon"] = 0.15
}
aura_env.round = function(var, n)
	if (n) then
		var = math.floor((var * 10^n) + 0.5) / (10^n)
	else
		var = math.floor(var+0.5)
	end
	return var
end
aura_env.percentageHealth = 0
aura_env.currentHealth = 0
aura_env.maxHealth = 0
aura_env.hotpRelativeHeal = 0
aura_env.hotpAbsoluteRelativeHeal = 0
aura_env.hotpAbsoluteHeal = 0
aura_env.newApsoluteHealth = 0
aura_env.newRelativeHealth = 0
aura_env.missingHealth = 0
aura_env.missingHealthPercentage = 0