Quantcast

added now=1 option to Eclipse

Sidoine De Wispelaere [03-06-11 - 10:25]
added now=1 option to Eclipse

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@362 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
diff --git a/Condition.lua b/Condition.lua
index b0c7235..ae2c9ce 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -555,7 +555,11 @@ Ovale.conditions=
 	end,
 	--Compare to eclipse power. <0 lunar, >0 solar
 	Eclipse = function(condition)
-		return compare(Ovale.state.eclipse, condition[1], condition[2])
+		if condition.now==1 then
+			return compare(Ovale.state.eclipse, condition[1], condition[2])
+		else
+			return compare(Ovale.state.nextEclipse, condition[1], condition[2])
+		end
 	end,
 	EffectiveMana = function(condition)
 		local limit = GetManaTime(condition[2], true)
diff --git a/Ovale.lua b/Ovale.lua
index 5d2a6e0..51fca8f 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -1251,6 +1251,8 @@ function Ovale:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd)

 	local newSpellInfo = self.spellInfo[spellId]

+	self.state.eclipse = self.state.nextEclipse
+
 	--On enregistre les infos sur le sort en cours
 	self.attenteFinCast = nextCast
 	self.currentSpellId = spellId
@@ -1301,12 +1303,19 @@ function Ovale:AddSpellToStack(spellId, startCast, endCast, nextCast, nocd)
 				self:AddRune(startCast, 2, newSpellInfo.unholy)
 			end
 			if newSpellInfo.eclipse then
-				self.state.eclipse = self.state.eclipse + newSpellInfo.eclipse
+				--[[self.state.eclipse = self.state.eclipse + newSpellInfo.eclipse
 				if self.state.eclipse < -100 then
 					self.state.eclipse = -100
 				elseif self.state.eclipse > 100 then
 					self.state.eclipse = 100
+				end]]
+				self.state.nextEclipse = self.state.eclipse + newSpellInfo.eclipse
+				if self.state.nextEclipse < -100 then
+					self.state.nextEclipse = -100
+				elseif self.state.nextEclipse > 100 then
+					self.state.nextEclipse = 100
 				end
+				self.state.nextEclipseTime = endCast + 0.5
 			end
 			if newSpellInfo.starsurge then
 				local buffAura = self:GetAura("player", "HELPFUL", 48517) --Solar
@@ -1456,6 +1465,8 @@ function Ovale:InitCalculerMeilleureAction()
 	self.state.mana = UnitPower("player")
 	self.state.shard = UnitPower("player", 7)
 	self.state.eclipse = UnitPower("player", 8)
+	self.state.nextEclipse = self.state.eclipse
+	self.state.nextEclipseTime = self.currentTime
 	self.state.holy = UnitPower("player", 9)
 	if self.className == "DEATHKNIGHT" then
 		for i=1,6 do