TRIGGER
function()
	if UnitGroupRolesAssigned("player") == "HEALER" then
		if UnitDebuff("target", "Necrotic Rot") then
			return true
		end
	end
	if UnitGroupRolesAssigned("player") == "TANK" then
		if UnitDebuff("player", "Necrotic Rot") then
			return true
		end
	end
end

TRIGGER DURATION
function()
	if UnitGroupRolesAssigned("player") == "HEALER" then
		if UnitDebuff("target", "Necrotic Rot") then
			aura_env.stacks = select(4, UnitDebuff("target", "Necrotic Rot"))
			aura_env.exptime = select(7, UnitDebuff("target", "Necrotic Rot"))
			aura_env.maxDur = select(6, UnitDebuff("target", "Necrotic Rot"))
		end
	end
	if UnitGroupRolesAssigned("player") == "TANK" then
		if UnitDebuff("player", "Necrotic Rot") then
			aura_env.stacks = select(4, UnitDebuff("player", "Necrotic Rot"))
			aura_env.exptime = select(7, UnitDebuff("player", "Necrotic Rot"))
			aura_env.maxDur = select(6, UnitDebuff("player", "Necrotic Rot"))
		end
	end
	if aura_env.stacks > 33 then
		aura_env.stacks = 33
	end
	return 33 - aura_env.stacks, 33, 1
end

TRIGGER NAME
function()
	return - (aura_env.stacks * 3)
end

DISPLAY
function()
	return aura_env.stacks
end

ANIMATION COLOR
function()
  local function range(val, min, max, max2)
    local val = 1 - (((max - val) / (max - min)) * max2)
    return val
  end
  local remtime = aura_env.exptime - GetTime()
  local c = range(remtime, 0, aura_env.maxDur, 1)
  c = 1 - c
  c expected as [0, 1]
  if c > 0.5 then
    c = 1 - (2 * (c - 0.5))
    return c, 1, 0, 1
  else
    c = c * 2
    return 1, c, 0 ,1
  end
end

INIT
aura_env.stacks = 0
aura_env.exptime = 0
aura_env.maxDur = 0