From 7b79b451308e896b94f99e23074c073d4760a9a7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 16 Nov 2025 17:33:27 +0000 Subject: [PATCH] Fix debuff conditionals using wrong max duration for combo spells CRITICAL FIX: Debuff conditionals like [debuff:Rip<4] were using base duration (12s) instead of actual combo duration (28s for 5 CP). **Problem:** - SeedUnit rescans debuffs on target change/UNIT_AURA events - It called lib:GetDuration(spellID) without combo awareness - This overwrote combo-aware durations with base durations - pfUI cooldown module showed wrong max duration (12s vs 28s) - Conditional [debuff:Rip<4] triggered at wrong times **Solution:** 1. Updated lib:GetDuration to accept optional comboPoints parameter 2. Checks CleveRoids_ComboDurations[spellID][cp] FIRST before other sources 3. Priority: combo learned > caster learned > static database 4. SeedUnit now uses highest learned CP duration as fallback 5. When rescanning combo spells, assumes 5 CP if learned **Benefits:** - [debuff:Rip<4] now uses actual 28s max duration (5 CP) - pfUI cooldown displays correct duration - Conditionals trigger at correct times - Prevents base duration from overwriting learned duration **Example:** Cast Rip with 5 CP (28s), macro refreshes at <4s remaining (24s used) Previously: Would refresh at <4s of 12s base (8s used) - TOO EARLY! --- Utility.lua | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/Utility.lua b/Utility.lua index a92a0d2..afea42c 100644 --- a/Utility.lua +++ b/Utility.lua @@ -718,7 +718,16 @@ lib.learnCastTimers = lib.learnCastTimers or {} CleveRoids_LearnedDurations = CleveRoids_LearnedDurations or {} -function lib:GetDuration(spellID, casterGUID) +function lib:GetDuration(spellID, casterGUID, comboPoints) + -- Check combo-specific learned durations first if this is a combo spell + if comboPoints and CleveRoids_ComboDurations and CleveRoids_ComboDurations[spellID] then + local comboDuration = CleveRoids_ComboDurations[spellID][comboPoints] + if comboDuration and comboDuration > 0 then + return comboDuration + end + end + + -- Check caster-specific learned durations if casterGUID and CleveRoids_LearnedDurations[spellID] then local learned = CleveRoids_LearnedDurations[spellID][casterGUID] if learned and learned > 0 then @@ -726,6 +735,7 @@ function lib:GetDuration(spellID, casterGUID) end end + -- Fall back to static database return self.durations[spellID] or 0 end @@ -794,7 +804,20 @@ local function SeedUnit(unit) if spellID and lib.durations[spellID] then if not (lib.objects[guid] and lib.objects[guid][spellID]) then - lib:AddEffect(guid, unitName, spellID, lib:GetDuration(spellID), stacks) + -- 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] + break + end + end + end + duration = duration or lib:GetDuration(spellID) + lib:AddEffect(guid, unitName, spellID, duration, stacks) end end end @@ -805,7 +828,20 @@ local function SeedUnit(unit) if spellID and lib.durations[spellID] then if not (lib.objects[guid] and lib.objects[guid][spellID]) then - lib:AddEffect(guid, unitName, spellID, lib:GetDuration(spellID), stacks) + -- 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] + break + end + end + end + duration = duration or lib:GetDuration(spellID) + lib:AddEffect(guid, unitName, spellID, duration, stacks) end end end