Quantcast

runes: bug fix

Sidoine De Wispelaere [10-30-10 - 18:05]
runes: bug fix
blood dk: added death pact
balance druid: some fixes
shadow priest: new script
cast interrupt function now check channeling too
added TotemPresent function

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@322 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Condition.lua
Ovale.lua
Ovale.toc
defaut/Chevalier.lua
defaut/Druide.lua
defaut/Pretre.lua
diff --git a/Condition.lua b/Condition.lua
index 3a9008b..df8de71 100644
--- a/Condition.lua
+++ b/Condition.lua
@@ -1,5 +1,8 @@
 local LBCT = LibStub("LibBabble-CreatureType-3.0"):GetLookupTable()

+local runes = {}
+local runesCD = {}
+
 local runeType =
 {
 	blood = 1,
@@ -10,6 +13,7 @@ local runeType =

 local totemType =
 {
+	ghoul = 1,
 	fire = 1,
 	earth = 2,
 	water = 3,
@@ -679,38 +683,67 @@ Ovale.conditions=
 		return testbool(present, condition[1])
 	end,
 	Runes = function(condition)
-		local type = runeType[condition[1]]
 		local nombre = 0
 		local nombreCD = 0
 		local maxCD = nil
-		local minCD = nil
+
+		for i=1,4 do
+			runes[i] = 0
+			runesCD[i] = 0
+		end
+
+		local k=1
+		while true do
+			local type = runeType[condition[k*2-1]]
+			if not type then
+				break
+			end
+			local howMany = condition[k*2]
+			runes[type] = runes[type] + howMany
+			k = k + 1
+		end
+
 		for i=1,6 do
 			local rune = Ovale.state.rune[i]
-			if rune.type == type or (rune.type == 4 and not condition.nodeath) then
-				if (rune.cd == 0) then
-					nombre = nombre + 1
-				else
-					nombreCD = nombreCD + 1
-					if (maxCD == nil or rune.cd>maxCD) then
-						maxCD = rune.cd
-					end
-					if (minCD == nil or rune.cd<minCD) then
-						minCD = rune.cd
+			if runes[rune.type] > 0 then
+				runes[rune.type] = runes[rune.type] - 1
+				if rune.cd > runesCD[rune.type] then
+					runesCD[rune.type] = rune.cd
+				end
+			elseif rune.cd < runesCD[rune.type] then
+				runesCD[rune.type] = rune.cd
+			end
+		end
+
+		if not condition.nodeath then
+			for i=1,6 do
+				local rune = Ovale.state.rune[i]
+				if rune.type == 4 then
+					for j=1,3 do
+						if runes[j]>0 then
+							runes[j] = runes[j] - 1
+							if rune.cd > runesCD[j] then
+								runesCD[j] = rune.cd
+							end
+							break
+						elseif rune.cd < runesCD[j] then
+							runesCD[j] = rune.cd
+							break
+						end
 					end
 				end
 			end
 		end
-		local wanted = condition[2]
-		if (nombre >= wanted) then
-			return 0
-		elseif (nombre + nombreCD < wanted) then
-			return nil
-		elseif (wanted == nombre + 1) then
-			return minCD
-		else
-			-- Il ne peut y avoir que deux runes sur CD de toute façon
-			return maxCD
+
+		for i=1,4 do
+			if runes[i]> 0 then
+				return nil
+			end
+			if not maxCD or runesCD[i]>maxCD then
+				maxCD = runesCD[i]
+			end
 		end
+		return maxCD
 	end,
 	Speed = function(condition)
 		return compare(GetUnitSpeed("player")*100/7, condition[1], condition[2])
@@ -816,10 +849,16 @@ Ovale.conditions=
 		return testbool(IsSpellInRange(spellName,getTarget(condition.target))==1,condition[2])
 	end,
 	TargetIsCasting = function(condition)
-		return testbool(UnitCastingInfo(getTarget(condition.target)), condition[1])
+		local casting
+		local target = getTarget(condition.target)
+		return testbool(UnitCastingInfo(target) or UnitChannelInfo(target), condition[1])
 	end,
 	TargetIsInterruptible = function(condition)
-		local spell, rank, name, icon, start, ending, isTradeSkill, castID, protected = UnitCastingInfo(getTarget(condition.target))
+		local target = getTarget(condition.target)
+		local spell, rank, name, icon, start, ending, isTradeSkill, castID, protected = UnitCastingInfo(target)
+		if not spell then
+			spell, rank, name, icon, start, ending, isTradeSkill, protected = UnitChannelInfo(target)
+		end
 		return testbool(protected ~= nil and not protected, condition[1])
 	end,
 	TargetLife = function(condition)
@@ -885,6 +924,16 @@ Ovale.conditions=
 		end
 		return addTime(startTime + duration, -(condition[2] or 0))
 	end,
+	TotemPresent = function(condition)
+		local haveTotem, totemName, startTime, duration = GetTotemInfo(totemType[condition[1]])
+		if not startTime then
+			return nil
+		end
+		if (condition.totem and Ovale:GetSpellInfoOrNil(condition.totem)~=totemName) then
+			return nil
+		end
+		return startTime, startTime + duration
+	end,
 	Tracking = function(condition)
 		local what = Ovale:GetSpellInfoOrNil(condition[1])
 		local numTrackingTypes = GetNumTrackingTypes()
diff --git a/Ovale.lua b/Ovale.lua
index 8108a9f..e7b0464 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -1455,7 +1455,7 @@ function Ovale:GetActionInfo(element)
 	end

 	if (element.func == "Spell" ) then
-		if not self.spellList[spellId] then
+		if not self.spellList[spellId] and not self.actionSort[spellId] then
 			self:Log("Spell "..spellId.." not learnt")
 			return nil
 		end
@@ -1466,6 +1466,9 @@ function Ovale:GetActionInfo(element)

 		--if (not action or not GetActionTexture(action)) then
 			spellName = self.spellList[spellId]
+			if not spellName then
+				spellName = GetSpellInfo(spellId)
+			end
 			actionTexture = GetSpellTexture(spellId)
 			actionInRange = IsSpellInRange(spellName, target)
 			actionUsable = IsUsableSpell(spellId)
diff --git a/Ovale.toc b/Ovale.toc
index 1860488..757bfe4 100644
--- a/Ovale.toc
+++ b/Ovale.toc
@@ -3,7 +3,7 @@
 ## Notes: Show the icon of the next spell to cast
 ## Notes-frFR: Affiche l'icône du prochain sort à lancer
 ## Author: Sidoine
-## Version: 4.0.13
+## Version: 4.0.14
 ## OptionalDeps: Ace3, ButtonFacade, Recount, Skada, LibBabble-CreatureType-3.0
 ## SavedVariables: OvaleDB
 ## SavedVariablesPerCharacter: OvaleDBPC
diff --git a/defaut/Chevalier.lua b/defaut/Chevalier.lua
index 21361ff..ad34aa0 100644
--- a/defaut/Chevalier.lua
+++ b/defaut/Chevalier.lua
@@ -13,6 +13,7 @@ Define(DANCINGRUNEWEAPON 49028) #blood
 Define(DARKTRANSFORMATION 63560) #unholy
 Define(DEATHANDECAY 43265)
 Define(DEATHCOIL 47541)
+Define(DEATHPACT 48743)
 Define(DEATHSTRIKE 49998)
 	SpellInfo(DEATHSTRIKE unholy=-1 frost=-1)
 Define(EMPOWERRUNEWEAPON 47568)
@@ -66,6 +67,7 @@ Define(VAMPIRICBLOOD 55233) #blood
 Define(GLYPHHOWLINGBLAST 63335)

 #Buffs and debuffs
+Define(BLOODSWARM 81141)
 Define(SCARLETFEVER 81130)
 Define(BLOODPLAGUE 55078)
 	SpellInfo(BLOODPLAGUE duration=15)
@@ -87,10 +89,10 @@ AddIcon help=main mastery=1

 	if BuffExpires(strengthagility 2) and CheckBoxOn(horn) Spell(HORNOFWINTER)
 	if TargetDebuffExpires(lowerphysicaldamage) and CheckBoxOn(scarlet) and TargetClassification(worldboss)
-		Spell(BLOODBOIL)
+		if Runes(blood1) or BuffPresent(BLOODSWARM) Spell(BLOODBOIL)
 	Spell(RUNESTRIKE usable=1)

-	if Runes(unholy 1) and Runes(frost 1) Spell(DEATHSTRIKE)
+	if Runes(unholy 1 frost 1) Spell(DEATHSTRIKE)
 	if Runes(blood 1) Spell(HEARTSTRIKE)

 	if Mana(more 39) Spell(DEATHCOIL usable=1)
@@ -108,13 +110,13 @@ AddIcon help=aoe mastery=1
 	if TargetDebuffExpires(BLOODPLAGUE 0 mine=1) and Runes(unholy 1) Spell(PLAGUESTRIKE)

 	if {OtherDebuffPresent(BLOODPLAGUE) or OtherDebuffPresent(FROSTFEVER)} and {TargetDebuffPresent(BLOODPLAGUE) or TargetDebuffPresent(FROSTFEVER)}
-		if Runes(blood 1) Spell(BLOODBOIL usable=1)
+		if Runes(blood 1) or BuffPresent(BLOODSWARM) Spell(BLOODBOIL usable=1)
 	if TargetDebuffPresent(BLOODPLAGUE) and TargetDebuffPresent(FROSTFEVER)
 	{
 		if Runes(blood 1)
 			unless OtherDebuffPresent(BLOODPLAGUE) and OtherDebuffPresent(FROSTFEVER)
 				Spell(PESTILENCE usable=1)
-		if Runes(unholy 1) and Runes(frost 1) Spell(DEATHSTRIKE)
+		if Runes(unholy 1 frost 1) Spell(DEATHSTRIKE)
 		if Runes(blood 1) Spell(HEARTSTRIKE)
 	}

@@ -129,8 +131,8 @@ AddIcon help=main mastery=2

 	if TargetDebuffPresent(FROSTFEVER mine=1) and TargetDebuffPresent(BLOODPLAGUE mine=1)
 	{
-        if Runes(unholy 1 nodeath=1) and Runes(frost 1 nodeath=1) Spell(OBLITERATE)
-		if Runes(blood 1) and {CheckBoxOff(rolldes) or Runes(blood 2)} Spell(BLOODSTRIKE)
+        if Runes(unholy 1 frost 1 nodeath=1) Spell(OBLITERATE)
+		if Runes(blood 1) Spell(BLOODSTRIKE)
 	}

 	if TargetDebuffExpires(FROSTFEVER 0 mine=1) and Runes(frost 1)
@@ -142,7 +144,7 @@ AddIcon help=main mastery=2
 	Spell(FROSTSTRIKE usable=1)
 	if PetPresent(no) Spell(RAISEDEAD)
 	if CheckBoxOn(horn) Spell(HORNOFWINTER priority=2)
-	unless Runes(frost 1) and Runes(unholy 1) Spell(BLOODTAP)
+	unless Runes(frost 1 unholy 1) Spell(BLOODTAP)
 	if Runes(blood 2 nodeath=1)
 	{
 		Spell(HEARTSTRIKE priority=2)
@@ -152,7 +154,7 @@ AddIcon help=main mastery=2

 AddIcon help=aoe mastery=2
 {
-	if Runes(unholy 1) and Runes(frost 1) Spell(HOWLINGBLAST)
+	if Runes(unholy 1 frost 1) Spell(HOWLINGBLAST)
 	if Runes(unholy 1) Spell(DEATHANDECAY usable=1)
 	if Runes(blood 1)
 	{
@@ -176,7 +178,7 @@ AddIcon help=main mastery=3
 		if BuffPresent(SUDDENDOOM mine=1) Spell(DEATHCOIL usable=1)
 		if Mana(more 90) Spell(DEATHCOIL usable=1)
 		if Runes(unholy 1) Spell(SCOURGESTRIKE)
-        if Runes(blood 1 nodeath=1) and Runes(frost 1 nodeath=1) Spell(FESTERINGSTRIKE)
+        if Runes(blood 1 frost 1 nodeath=1) Spell(FESTERINGSTRIKE)
 	}
 	if TargetDebuffExpires(FROSTFEVER 0 mine=1) and Runes(frost 1) Spell(ICYTOUCH)
 	if TargetDebuffExpires(BLOODPLAGUE 0 mine=1) and Runes(unholy 1) Spell(PLAGUESTRIKE)
@@ -205,6 +207,7 @@ AddIcon help=cd
 	unless BuffPresent(BONESHIELD) Spell(BONESHIELD)
 	if BuffPresent(BLOODPRESENCE)
 	{
+		if TotemPresent(ghoul) Spell(DEATHPACT)
 		Spell(VAMPIRICBLOOD)
 		Spell(RUNETAP)
 		Spell(UNBREAKABLEARMOR)
diff --git a/defaut/Druide.lua b/defaut/Druide.lua
index 8346d6e..53a5cc7 100644
--- a/defaut/Druide.lua
+++ b/defaut/Druide.lua
@@ -87,38 +87,49 @@ ScoreSpells(FAERIEFERAL DEMOROAR MANGLEBEAR LACERATE SAVAGEROAR RIP

 AddIcon help=main mastery=1
 {
+	#Contributed by Grabielz
 	if CheckBoxOn(lucioles) and TargetDebuffExpires(lowerarmor 2) and TargetDeadIn(more 15)
-		Spell(FAERIEFIRE)
+		Spell(FAERIEFIRE nored=1)

 	if Speed(more 0)
 	{
 		if BuffPresent(SHOOTINGSTARS) Spell(STARSURGE)
+		if TargetDebuffExpires(INSECTSWARM 10 mine=1) and TargetDeadIn(more 6)
+			Spell(INSECTSWARM)
+		if BuffPresent(ECLIPSESOLAR)
+			Spell(SUNFIRE)
 		Spell(MOONFIRE)
 	}

+
+	if TargetDebuffExpires(INSECTSWARM 1 mine=1) and TargetDeadIn(more 6)
+		Spell(INSECTSWARM nored=1)
+
+	if TargetDebuffExpires(INSECTSWARM 3 mine=1) and TargetDeadIn(more 6) and BuffPresent(ECLIPSESOLAR) and Eclipse(less 16)
+		Spell(INSECTSWARM nored=1)
+
+	if TargetDebuffExpires(MOONFIRE 1 mine=1) and TargetDebuffExpires(SUNFIRE 1 mine=1) and TargetDeadIn(more 6)
+	{
+		if BuffPresent(ECLIPSESOLAR)
+			Spell(SUNFIRE nored=1)
+		Spell(MOONFIRE nored=1)
+	}
+
 	Spell(STARSURGE)

 	if BuffPresent(ECLIPSELUNAR) or Eclipse(equal -100)
 	{
-		if TargetDebuffExpires(MOONFIRE 0 mine=1) and TargetDeadIn(more 6)
-			Spell(MOONFIRE)
 		Spell(STARFIRE)
 	}

 	if BuffPresent(ECLIPSESOLAR) or Eclipse(equal 100)
 	{
-		if TargetDebuffExpires(INSECTSWARM 0 mine=1) and TargetDeadIn(more 6)
-			Spell(INSECTSWARM)
-		if TargetDebuffExpires(SUNFIRE 0 mine=1) and TargetDeadIn(more 6)
-			Spell(SUNFIRE)
 		Spell(WRATH)
 	}

 	if TargetDebuffExpires(INSECTSWARM 0 mine=1) and TargetDeadIn(more 6)
 		Spell(INSECTSWARM)

-	if TargetDebuffExpires(MOONFIRE 0 mine=1) and TargetDeadIn(more 6)
-		Spell(MOONFIRE)

 	if {Eclipse(equal 0) and CheckBoxOn(wrath)} or Eclipse(less 0)
 		Spell(WRATH)
diff --git a/defaut/Pretre.lua b/defaut/Pretre.lua
index 5c45945..ea6e43f 100644
--- a/defaut/Pretre.lua
+++ b/defaut/Pretre.lua
@@ -1,5 +1,7 @@
 Ovale.defaut["PRIEST"] =
 [[
+### defines ###
+
 #Buff
 Define(ORB 77487)
 Define(MSEFFECT 87178)
@@ -45,15 +47,11 @@ Define(MS 73510) # Mind Spike
 	SpellAddBuff(MS MSEFFECT=12 MM=6)

 Define(SWD 32379) # Shadow Word : Death
-	SpellInfo(SWD cd=10)
-	SpellInfo(SWD targetlifenocd=25 glyph=GLYPHSHADOWWORDDEATH)

 Define(ARCHANGEL 87151) #Archangel
 	SpellInfo(ARCHANGEL cd=90)
 	SpellAddBuff(ARCHANGEL DA=18)

-Define(GLYPHSHADOWWORDDEATH 55682)
-
 ### end defines ###

 ScoreSpells(MB SWP VT DP MF SWD MS)
@@ -87,10 +85,10 @@ AddIcon help=main mastery=3
 	if BuffPresent(DA) #specific DD-based rotation when under Dark Archangel
 	{
 		#Use SWD if we have enough life left
-		if LifePercent(more 20) Spell(SWD)
+		if TargetLifePercent(less 25) and LifePercent(more 20) Spell(SWD)

 		#Use MB on CD
-		Spell(MB)
+		if BuffPresent(ORB stacks=3) Spell(MB)

 		#Fill with MF
 		Spell(MF priority=2)
@@ -112,11 +110,11 @@ AddIcon help=main mastery=3
 	Spell(FIEND)

 	#Use SWD if we have enough life left and it is more useful than MB
-	if LifePercent(more 20) Spell(SWD)
-
-	#Use MB on CD
-	Spell(MB)
+	if TargetLifePercent(less 25) and LifePercent(more 20) Spell(SWD)

+        #Use MB when orbs are at 3 stacks
+	if BuffPresent(ORB stacks=3) Spell(MB)
+
 	#Fill with MF
 	Spell(MF priority=2)
 }
@@ -131,7 +129,21 @@ AddIcon help=cd
 # Add mana monitor
 AddIcon help=mana mastery=3
 {
-	if ManaPercent(less 5) Spell(DISPERSION)
+	if LifePercent(less 10)
+	{
+		Spell(DISPERSION)
+		Item(36892) #Health stone
+		Item(36893)
+		Item(36894)
+		Item(33447) #Life potion (lvl 80)
+
+	}
+	if ManaPercent(less 5)
+	{
+		Spell(DISPERSION)
+		Item(33448) #Mana potion (lvl 80)
+	}
 }

+
 ]]