Quantcast

- bug fix: sometimes the spell with the highest priority was not prioritized while casting a spell

Sidoine De Wispelaere [03-08-09 - 11:55]
- bug fix: sometimes the spell with the highest priority was not prioritized while casting a spell
- default for mages of all specs

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@24 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
OvaleCompile.lua
OvaleIcone.lua
defaut/Guerrier.lua
defaut/Mage.lua
diff --git a/Condition.lua b/Condition.lua
index 9437928..ad8b695 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -124,6 +124,17 @@ Ovale.conditions=
 		end
 		return nil
 	end,
+	Casting = function(condition)
+		local spell = UnitCastingInfo("player")
+		if (not spell) then
+			return nil
+		end
+		if (Ovale:GetSpellInfoOrNil(condition[1])==spell) then
+			return 0
+		else
+			return nil
+		end
+	end,
 	-- Test if a list of checkboxes is off
 	-- 1,... : the checkboxes names
 	CheckBoxOff = function(condition)
diff --git a/Ovale.lua b/Ovale.lua
index c63e068..d033a70 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -541,6 +541,21 @@ function Ovale:ChercherBouton(sort)
 	end
 end

+function Ovale:InitCalculerMeilleureAction()
+	self.attenteFinCast = 0
+
+	-- On attend que le sort courant soit fini
+	local spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitCastingInfo("player")
+	if (spell) then
+		self.attenteFinCast = endTime/1000 - Ovale.maintenant
+	end
+
+	local spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitChannelInfo("player")
+	if (spell and not Ovale.canStopChannelling[spell]) then
+		self.attenteFinCast = endTime/1000 - Ovale.maintenant
+	end
+end
+
 function Ovale:CalculerMeilleureAction(element)
 	if (self.bug and not self.trace) then
 		return nil
@@ -590,6 +605,9 @@ function Ovale:CalculerMeilleureAction(element)
 				else
 					restant = duration - (self.maintenant - start);
 				end
+				if (restant<self.attenteFinCast) then
+					restant = self.attenteFinCast
+				end
 				if (Ovale.trace) then
 					self:Print("Action "..element.params[1].." remains "..restant)
 				end
diff --git a/OvaleCompile.lua b/OvaleCompile.lua
index 093125e..ccbd63e 100644
--- a/OvaleCompile.lua
+++ b/OvaleCompile.lua
@@ -114,7 +114,7 @@ local function ParseAddIcon(params, text)
 	text = string.gsub(text, "(%w+)%s*%((.-)%)", ParseFunction)
 	text = subtest(text, "node(%d+)%s+and%s+node(%d+)", ParseAnd)
 	text = subtest(text, "node(%d+)%s+or%s+node(%d+)", ParseOr)
-	text = subtest(text, "(%d+.?%d*)s%s+before%s+node(%d+)", ParseBefore)
+	text = subtest(text, "(%d+%.?%d*)s%s+before%s+node(%d+)", ParseBefore)

 	text = subtest(text, "{([^{}]*)}", ParseGroup)

diff --git a/OvaleIcone.lua b/OvaleIcone.lua
index 614d1e6..65101af 100644
--- a/OvaleIcone.lua
+++ b/OvaleIcone.lua
@@ -5,6 +5,7 @@
 		Ovale.traced = false
 	end

+	Ovale:InitCalculerMeilleureAction()
 	local minAttente = Ovale:CalculerMeilleureAction(self.masterNode)
 	local meilleureAction = Ovale.retourAction

@@ -32,23 +33,6 @@

 	if (minAttente~=nil and meilleureAction) then

-		-- On attend que le sort courant soit fini
-		local spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitCastingInfo("player")
-		if (spell) then
-			local attenteFinCast = endTime/1000 - Ovale.maintenant
-			if (attenteFinCast > minAttente) then
-				minAttente = attenteFinCast
-			end
-		end
-
-		local spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitChannelInfo("player")
-		if (spell and not Ovale.canStopChannelling[spell]) then
-			local attenteFinCast = endTime/1000 - Ovale.maintenant
-			if (attenteFinCast > minAttente) then
-				minAttente = attenteFinCast
-			end
-		end
-
 		if (meilleureAction~=self.actionCourante or self.ancienneAttente==nil or
 			(minAttente~=0 and minAttente>self.ancienneAttente+0.01)) then
 			self.actionCourante = meilleureAction
diff --git a/defaut/Guerrier.lua b/defaut/Guerrier.lua
index a0a365c..39094a6 100644
--- a/defaut/Guerrier.lua
+++ b/defaut/Guerrier.lua
@@ -74,8 +74,8 @@ AddIcon

 		if TargetLifePercent(less 20)
 		{
-			if Mana(more 39) Spell(WHIRLWIND)
-			if Mana(more 44) Spell(BLOODTHIRST)
+			Spell(WHIRLWIND)
+			Spell(BLOODTHIRST)
 			if BuffPresent(SLAMBUFF) and Mana(more 29) Spell(SLAM)
 			Spell(EXECUTE)
         }
@@ -91,8 +91,7 @@ AddIcon
         Spell(DEVASTATE)

         if TalentPoints(SLAMTALENT more 1)
-           and AfterWhiteHit(0.2)
-          Spell(SLAM)
+          Spell(SLAM)
      }

      if Stance(1) #combat
@@ -108,6 +107,9 @@ AddIcon
         Spell(CONCUSSIONBLOW)

         Spell(DEVASTATE)
+
+        if TalentPoints(SLAMTALENT more 1)
+          Spell(SLAM)
      }


diff --git a/defaut/Mage.lua b/defaut/Mage.lua
index e69de29..6331e95 100644
--- a/defaut/Mage.lua
+++ b/defaut/Mage.lua
@@ -0,0 +1,71 @@
+Ovale.defaut["MAGE"]=
+[[
+Define(TALENTLIVINGBOMB 1852)
+Define(TALENTPIERCINGICE 61)
+Define(TALENTCHILLEDTOTHEBONES 1856)
+Define(TALENTARCANEBARRAGE 1847)
+
+Define(HOTSTREAK 48108)
+Define(IMPROVEDSCORCH 22959)
+
+Define(PYROBLAST 11366)
+Define(LIVINGBOMB 44457)
+Define(SCORCH 2948)
+Define(FROSTFIREBOLT 44614)
+Define(FROSTBOLT 116)
+Define(FIREBALL 133)
+Define(ARCANEBARRAGE 44425)
+Define(ARCANEMISSILES 5143)
+Define(ARCANEBLAST 30451)
+
+Define(COMBUSTION 11129)
+Define(ICYVEINS 12472)
+Define(MIRRORIMAGE 55342)
+Define(SUMMONWATERELEMENTAL 31687)
+Define(PRESENCEOFMIND 12043)
+
+AddCheckBox(scorch SpellName(SCORCH))
+
+AddIcon
+{
+	if TalentPoints(TALENTLIVINGBOMB more 0)
+	{
+		#Fire spec
+		if BuffPresent(HOTSTREAK) Spell(PYROBLAST)
+		if TargetDebuffExpires(LIVINGBOMB 0 mine=1) Spell(LIVINGBOMB)
+		if TargetDebuffExpires(IMPROVEDSCORCH 2 stacks=5) and CheckBoxOn(scorch) Spell(SCORCH)
+		if TalentPoints(TALENTPIERCINGICE more 0)
+			Spell(FROSTFIREBOLT)
+		if TalentPoints(TALENTPIERCINGICE less 1)
+			Spell(FIREBALL)
+	}
+
+	if TalentPoints(TALENTCHILLEDTOTHEBONES more 0)
+	{
+		#Frost spec
+		Spell(SUMMONWATERELEMENTAL)
+		Spell(FROSTBOLT)
+	}
+
+	if TalentPoints(TALENTARCANEBARRAGE more 0)
+	{
+		#Arcane spec
+		unless BuffPresent(ARCANEBLAST stacks=3) or {BuffPresent(ARCANEBLAST stacks=2) and Casting(ARCANEBLAST)}
+			Spell(ARCANEBLAST)
+		Spell(ARCANEMISSILES)
+	}
+}
+
+AddIcon
+{
+	Spell(MIRRORIMAGE)
+}
+
+AddIcon
+{
+	Spell(COMBUSTION)
+	Spell(ICYVEINS)
+	Spell(PRESENCEOFMIND)
+}
+
+]]
\ No newline at end of file