--EVERY FRAME
function()
    return true
end

--DURATION
function()
    local AP = 0
    for i = 1, 40 do
        local spellID = select(11, UnitBuff("player", i)) -- don't know which return arg it is
        if spellID == 214577 then
            local AP = select(17, UnitBuff("player", i))
            return aura_env.max - AP, aura_env.max, 1
        end
    end
end

--COMBAT_LOG_EVENT_UNFILTERED
function(...)
    local subevent = select(3, ...)
    local caster = select(6, ...)
    if subevent == "SPELL_AURA_APPLIED" and caster == UnitName("player") then
        local spell = select(13, ...)
        if spell == 214577 then
            aura_env.max = select(17, ...)
       end
   end
end

--INIT
aura_env.max = 0