From f999aeb2c3c4f70c26de3b23eefa22bddc34901f Mon Sep 17 00:00:00 2001 From: pepopo978 Date: Fri, 22 Nov 2024 13:36:34 -0800 Subject: [PATCH] fix reducing immolate time when queuing conflagrate --- curses.lua | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/curses.lua b/curses.lua index 3f80559..5a4e1be 100644 --- a/curses.lua +++ b/curses.lua @@ -151,11 +151,7 @@ Cursive:RegisterEvent("UNIT_CASTEVENT", function(casterGuid, targetGuid, event, lastGuid = targetGuid Cursive:ScheduleEvent("addCurse" .. targetGuid .. curses.trackedCurseIds[spellID].name, curses.ApplyCurse, 0.2, self, spellID, targetGuid, GetTime()) elseif curses.conflagrateSpellIds[spellID] then - -- check if target has immolate - if curses:HasCurse(L["Immolate"], targetGuid) then - -- reduce duration by 3 sec - curses.guids[targetGuid][L["Immolate"]].duration = curses.guids[targetGuid][L["Immolate"]].duration - 3 - end + Cursive:ScheduleEvent("updateCurse" .. targetGuid .. L["Conflagrate"], curses.UpdateCurse, 0.2, self, spellID, targetGuid, GetTime()) end end end) @@ -172,10 +168,7 @@ Cursive:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE", PlaySoundFile("Interface\\AddOns\\Cursive\\Sounds\\resist.mp3") end elseif spell == L["Conflagrate"] and lastGuid then - if curses:HasCurse(L["Immolate"], lastGuid) then - -- increase duration by 3 sec to undo the deduction due to resist - curses.guids[lastGuid][L["Immolate"]].duration = curses.guids[lastGuid][L["Immolate"]].duration + 3 - end + Cursive:CancelScheduledEvent("updateCurse" .. lastGuid .. spell) end end end @@ -289,6 +282,16 @@ function curses:ApplyCurse(spellID, targetGuid, startTime) } end +function curses:UpdateCurse(spellID, targetGuid, startTime) + if curses.conflagrateSpellIds[spellID] then + -- check if target has immolate + if curses:HasCurse(L["Immolate"], targetGuid) then + -- reduce duration by 3 sec + curses.guids[targetGuid][L["Immolate"]].duration = curses.guids[targetGuid][L["Immolate"]].duration - 3 + end + end +end + function curses:RemoveCurse(guid, curseName) if curses.guids[guid] and curses.guids[guid][curseName] then curses.guids[guid][curseName] = nil