I use this code, i try rewrite to your koncept. Maybe help you. Sry for eng.
Save dname in function UpdateAuraIcon
lua Code:
if dname and matchdebuff then
--if dspellid == 209859 or dspellid == 113746 or dspellid == 228287 then return end -- 激勵?
local exist = false
if dname == "Bolstering" then
for index = 1, i do
if unitFrame.icons[index].name == dname then
unitFrame.icons[index].count = unitFrame.icons[index].count + 1
exist = true
end
end
elseif not exist then
if not unitFrame.icons[i] then
unitFrame.icons[i] = CreateAuraIcon(unitFrame.icons)
end
UpdateAuraIcon(unitFrame.icons[i], unit, index, "HARMFUL")
if i ~= 1 then
unitFrame.icons[i]:SetPoint("LEFT", unitFrame.icons[i-1], "RIGHT", 4, 0)
end
i = i + 1
end