--[[
[08:58 PM] Dump: value=UnitBuff("player","Shield of the Righteous")
[08:58 PM] [1]="Shield of the Righteous",
[08:58 PM] [2]="",
[08:58 PM] [3]=236265,
[08:58 PM] [4]=0,
[08:58 PM] [6]=4.5,
[08:58 PM] [7]=34675.812,
[08:58 PM] [8]="player",
[08:58 PM] [9]=false,
[08:58 PM] [10]=true,
[08:58 PM] [11]=132403,
[08:58 PM] [12]=false,
[08:58 PM] [13]=false,
[08:58 PM] [14]=true,
[08:58 PM] [15]=false,
[08:58 PM] [16]=1,
[08:58 PM] [17]=-60


01:05 PM] [Virag's DT]: 1 - COMBAT_LOG_EVENT_UNFILTERED
[01:05 PM] [Virag's DT]: 3 - SPELL_AURA_APPLIED
[01:05 PM] [Virag's DT]: 6 - Pinkiepiie
[01:05 PM] [Virag's DT]: 14 - Shield of the Righteous
[01:05 PM] [Virag's DT]: 16 - BUFF
]]

--EVERY FRAME
function()
	if UnitBuff("player", "Shield of the Righteous") then
		return true
	else
		aura_env.mitigation = 0
		return false
	end
end

--COMBAT_LOG_EVENT_UNFILTERED
function(...)
	local e = select(3, ...)
	if e == "SPELL_AURA_APPLIED" then
		local caster = select(6, ...)
		local name = select(14, ...)
		if caster == UnitName("player") and name == "Shield of the Righteous" then
			aura_env.mitigation = abs(select(17, UnitBuff("player", "Shield of the Righteous")))
		end
	end
end

--DISPLAY
function()
	if aura_env.mitigation then
		return aura_env.mitigation .. "%"
	end
end