Here's a dry-coded example, so I have no idea if it works.
Lua Code:
-- todo: Track that someone in the raid is actually capable of battle rezzing and alive
local WhoDead, SecondsPerRez, ElapsedTime, NumRezzed = {}, 1, 0, 0
local f = CreateFrame('frame') f:Hide()
f:SetScript('OnEvent', function(self, event, ...) return self[event] and self[event](self, ...) end)
function f:ENCOUNTER_START(encounterID, encounterName, difficultyID, raidSize)
if difficultyID < 3 then return end
wipe(WhoDead)
SecondsPerRez, ElapsedTime, NumRezzed = 5400 / raidSize, 0, 0
self:RegisterEvent('INCOMING_RESURRECT_CHANGED')
self:Show()
end
f:RegisterEvent('ENCOUNTER_START')
function f:ENCOUNTER_END()
self:Hide()
self:UnregisterEvent('INCOMING_RESURRECT_CHANGED')
end
f:RegisterEvent('ENCOUNTER_END')
function f:INCOMING_RESURRECT_CHANGED(unit) -- Track who has received a rez within range
local name = UnitName(unit)
if name and not WhoDead[name] and UnitHasIncomingResurrection(unit) then
WhoDead[name] = true
end
end
f:SetScript('OnUpdate', function(self, elapsed)
ElapsedTime = ElapsedTime + elapsed
for name in pairs(WhoDead) do
if not UnitIsDeadOrGhost(name) and UnitIsConnected(name) then -- Dead unit is no longer dead
WhoDead[name] = nil
NumRezzed = NumRezzed + 1
end
end
local availableRezzes = 1 + floor(ElapsedTime / SecondsPerRez) - NumRezzed
-- Do something to display this number somewhere..
end)
It doesn't actually do anything with the "availableRezzes" number, so if you want this for an LDB display or something you'll need to add the appropriate code for that.
I have no idea how reincarnation is factored into the new rules, and I don't know if reincarnation or soulstones trigger an incoming rez event, so it might just be simpler to check UNIT_HEALTH to track when they've died or rezzed.