From c8546df52a331597b75e511aa5e24a32d47416dc Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 16 Nov 2025 23:28:03 +0000 Subject: [PATCH] Fix debuff overflow detection and duration tracking for combodurations branch Applied the same overflow bug fixes to the combodurations branch to ensure compatibility with combo point-scaled debuffs. This fixes three issues: 1. lib:UnitDebuff() (line 799): Fixed UnitBuff() return value capture from 4 values to 3 values (UnitBuff only returns texture, stacks, spellID). Also changed overflow check from only checking static database to checking lib:GetDuration() which includes combo durations, learned durations, and static durations. 2. SeedUnit() debuff loop (line 837): Changed check from only lib.durations[] to lib:GetDuration() so debuffs with learned or combo-scaled durations are properly seeded into the tracking system. 3. SeedUnit() buff loop (line 867): Fixed UnitBuff() return value capture from 4 values to 3, and changed check from only lib.durations[] to lib:GetDuration() to properly track overflow debuffs with combo-scaled or learned durations. These fixes ensure that: - Overflow debuffs like Moonfire are properly detected by [nodebuff:] conditionals - Duration tracking works for overflow debuffs with combo point scaling (Rip, Rupture) - Duration tracking works for overflow debuffs with learned durations - All existing combo point tracking functionality is preserved --- Utility.lua | 87 ++++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 41 deletions(-) diff --git a/Utility.lua b/Utility.lua index 81ed0ca..6ab1a0f 100644 --- a/Utility.lua +++ b/Utility.lua @@ -796,8 +796,9 @@ function lib:UnitDebuff(unit, id) local texture, stacks, dtype, spellID = UnitDebuff(unit, id) if not texture or not spellID then - texture, stacks, _, spellID = UnitBuff(unit, id) - if texture and spellID and not lib.durations[spellID] then + texture, stacks, spellID = UnitBuff(unit, id) + -- Only accept buffs that are known debuffs (either static or learned durations, including combo durations) + if texture and spellID and lib:GetDuration(spellID) <= 0 then return nil end end @@ -833,60 +834,64 @@ local function SeedUnit(unit) local tex, stacks, dtype, spellID = UnitDebuff(unit, i) if not tex then break end - if spellID and lib.durations[spellID] then - if not (lib.objects[guid] and lib.objects[guid][spellID]) then - -- For combo spells, try to use the highest learned duration as a fallback - local duration = nil - if CleveRoids.IsComboScalingSpellID and CleveRoids.IsComboScalingSpellID(spellID) and - CleveRoids_ComboDurations and CleveRoids_ComboDurations[spellID] then - -- Use the longest learned duration (assume 5 CP) - for cp = 5, 1, -1 do - if CleveRoids_ComboDurations[spellID][cp] then - duration = CleveRoids_ComboDurations[spellID][cp] - if CleveRoids.debug then - local spellName = SpellInfo(spellID) or "Unknown" - DEFAULT_CHAT_FRAME:AddMessage( - string.format("|cffaaff00[DEBUG SeedUnit Debuff]|r %s (ID:%d) using learned %dCP duration:%ds", - spellName, spellID, cp, duration) - ) + if spellID then + local duration = lib:GetDuration(spellID) + if duration > 0 then + if not (lib.objects[guid] and lib.objects[guid][spellID]) then + -- For combo spells, try to use the highest learned duration as a fallback + if CleveRoids.IsComboScalingSpellID and CleveRoids.IsComboScalingSpellID(spellID) and + CleveRoids_ComboDurations and CleveRoids_ComboDurations[spellID] then + -- Use the longest learned duration (assume 5 CP) + for cp = 5, 1, -1 do + if CleveRoids_ComboDurations[spellID][cp] then + duration = CleveRoids_ComboDurations[spellID][cp] + if CleveRoids.debug then + local spellName = SpellInfo(spellID) or "Unknown" + DEFAULT_CHAT_FRAME:AddMessage( + string.format("|cffaaff00[DEBUG SeedUnit Debuff]|r %s (ID:%d) using learned %dCP duration:%ds", + spellName, spellID, cp, duration) + ) + end + break end - break end end + duration = duration or lib:GetDuration(spellID) + lib:AddEffect(guid, unitName, spellID, duration, stacks) end - duration = duration or lib:GetDuration(spellID) - lib:AddEffect(guid, unitName, spellID, duration, stacks) end end end for i=1, 32 do - local tex, stacks, _, spellID = UnitBuff(unit, i) + local tex, stacks, spellID = UnitBuff(unit, i) if not tex then break end - if spellID and lib.durations[spellID] then - if not (lib.objects[guid] and lib.objects[guid][spellID]) then - -- For combo spells, try to use the highest learned duration as a fallback - local duration = nil - if CleveRoids.IsComboScalingSpellID and CleveRoids.IsComboScalingSpellID(spellID) and - CleveRoids_ComboDurations and CleveRoids_ComboDurations[spellID] then - -- Use the longest learned duration (assume 5 CP) - for cp = 5, 1, -1 do - if CleveRoids_ComboDurations[spellID][cp] then - duration = CleveRoids_ComboDurations[spellID][cp] - if CleveRoids.debug then - local spellName = SpellInfo(spellID) or "Unknown" - DEFAULT_CHAT_FRAME:AddMessage( - string.format("|cffaaff00[DEBUG SeedUnit Buff]|r %s (ID:%d) using learned %dCP duration:%ds", - spellName, spellID, cp, duration) - ) + if spellID then + local duration = lib:GetDuration(spellID) + if duration > 0 then + if not (lib.objects[guid] and lib.objects[guid][spellID]) then + -- For combo spells, try to use the highest learned duration as a fallback + if CleveRoids.IsComboScalingSpellID and CleveRoids.IsComboScalingSpellID(spellID) and + CleveRoids_ComboDurations and CleveRoids_ComboDurations[spellID] then + -- Use the longest learned duration (assume 5 CP) + for cp = 5, 1, -1 do + if CleveRoids_ComboDurations[spellID][cp] then + duration = CleveRoids_ComboDurations[spellID][cp] + if CleveRoids.debug then + local spellName = SpellInfo(spellID) or "Unknown" + DEFAULT_CHAT_FRAME:AddMessage( + string.format("|cffaaff00[DEBUG SeedUnit Buff]|r %s (ID:%d) using learned %dCP duration:%ds", + spellName, spellID, cp, duration) + ) + end + break end - break end end + duration = duration or lib:GetDuration(spellID) + lib:AddEffect(guid, unitName, spellID, duration, stacks) end - duration = duration or lib:GetDuration(spellID) - lib:AddEffect(guid, unitName, spellID, duration, stacks) end end end