From 2ad1de5f9423dfdb5bdce2f448741378f5e8db51 Mon Sep 17 00:00:00 2001 From: "Johnny C. Lam" Date: Fri, 15 Nov 2013 19:56:01 +0000 Subject: [PATCH] Generalize state:AddEclipse() to state:AddAuraToGUID(). git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1165 d5049fe3-3747-40f7-a4b5-f36d6801af5f --- OvaleAura.lua | 17 +++++++++-------- OvaleEclipse.lua | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/OvaleAura.lua b/OvaleAura.lua index 81bf982..cc40838 100644 --- a/OvaleAura.lua +++ b/OvaleAura.lua @@ -691,7 +691,7 @@ do end local start, ending, currentStacks, tick = state:GetAuraByGUID(guid, auraId, filter, true, target) - local newAura = state:NewAura(guid, auraId, filter) + local newAura = state:NewAura(guid, auraId, filter, OvaleState.currentTime) newAura.mine = true --[[ @@ -864,7 +864,7 @@ do return start, ending, count end - function statePrototype:NewAura(guid, spellId, filter) + function statePrototype:NewAura(guid, spellId, filter, gain) local state = self if not state.aura[guid] then state.aura[guid] = {} @@ -878,7 +878,7 @@ do local aura = state.aura[guid][filter][spellId] aura.serial = state.serial aura.mine = true - aura.gain = OvaleState.currentTime + aura.gain = gain return aura end @@ -944,12 +944,13 @@ do end end - -- Track a new Eclipse buff that starts at timestamp. - function statePrototype:AddEclipse(timestamp, spellId) + -- Add a new aura to the unit specified by GUID. + function statePrototype:AddAuraToGUID(guid, spellId, filter, mine, start, ending) local state = self - local aura = state:NewAura(self_guid, spellId, "HELPFUL") - aura.start = timestamp - aura.ending = nil + local aura = state:NewAura(guid, spellId, filter, start) + aura.mine = mine + aura.start = start + aura.ending = ending aura.stacks = 1 end end diff --git a/OvaleEclipse.lua b/OvaleEclipse.lua index 7615103..77c71ea 100644 --- a/OvaleEclipse.lua +++ b/OvaleEclipse.lua @@ -179,13 +179,13 @@ function OvaleEclipse:ApplySpellOnPlayer(state, spellId, startCast, endCast, nex if eclipse <= -100 then eclipse = -100 direction = 1 - state:AddEclipse(endCast, LUNAR_ECLIPSE) + state:AddAuraToGUID(self_guid, LUNAR_ECLIPSE, "HELPFUL", true, endCast, math.huge) -- Reaching Lunar Eclipse resets the cooldown of Starfall. state:ResetSpellCooldown(LUNAR_ECLIPSE, endCast) elseif eclipse >= 100 then eclipse = 100 direction = -1 - state:AddEclipse(endCast, SOLAR_ECLIPSE) + state:AddAuraToGUID(self_guid, SOLAR_ECLIPSE, "HELPFUL", true, endCast, math.huge) end end state.eclipse = eclipse -- 1.7.9.5