From 5ea01a9f2aebaf7dfbd2727b51222f93d30ae192 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Mon, 9 Dec 2013 02:14:58 +0000 Subject: [PATCH] Handle Eclipse in the state machine when crossing the zero threshold. git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1248 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleEclipse.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OvaleEclipse.lua b/OvaleEclipse.lua index 82c68d2..9d80aaa 100644 --- a/OvaleEclipse.lua +++ b/OvaleEclipse.lua @@ -188,6 +188,14 @@ function OvaleEclipse:ApplySpellAfterCast(state, spellId, targetGUID, startCast, -- Only adjust Eclipse energy if the spell moves the Eclipse bar in the right direction. if (direction <= 0 and energy < 0) or (direction >= 0 and energy > 0) then eclipse = eclipse + energy + + -- Crossing zero energy removes the corresponding Eclipse state. + if direction < 0 and eclipse <= 0 then + state:RemoveAuraOnGUID(self_guid, SOLAR_ECLIPSE, "HELPFUL", true, endCast) + elseif direction > 0 and eclipse >= 0 then + state:RemoveAuraOnGUID(self_guid, LUNAR_ECLIPSE, "HELPFUL", true, endCast) + end + -- Clamp Eclipse energy to min/max values and note that an Eclipse state will be reached after the spellcast. if eclipse <= -100 then eclipse = -100 -- 1.7.9.5